This project provides a high-performance implementation of Single Value Decomposition (SVD), followed by the PCA itself. It bridges the gap between low-level efficiency and high-level data science by utilizing a custom-compiled C shared library for Eigendecomposition while maintaining the flexibility of Python (NumPy/PyTorch) for data manipulation.
- Custom C Backend: Implements the QL Algorithm with Wilkinson shifts for fast and numerically stable Eigendecomposition.
- Performance Optimized: Compiled with
-O3and-fPICto leverage CPU-level optimizations via a shared library (libqr.so). - Advanced Visualization: Support for 2D/3D density projections, variance analysis, and image compression.
- Hybrid Architecture: Seamlessly integrates C-based math helpers with modern Python data stacks like PyTorch and Matplotlib.
qr.c: The core C source file containing the Wilkinson Symmetric QR/QL algorithms.libqr.so: Shared libraryPCA_via_SVD.ipynb: Demonstration of PCA on synthetic 2D and real datasets and high-dimensional variance visualization.svd.ipynb: Practical application of SVD for image processing and reconstruction.utilities.py: Helper functions, featuring visualizations and computation.
Here I show how the algorithm identifies the axes of maximum variance in a synthetic dataset.

Comparing original images against reconstructed versions using varying numbers of principal components.
