The primary goal of this project is to implement the Random SVD (rSVD) algorithm, which addresses standard matrix decompositions. These decompositions include the pivoted QR factorization, eigenvalue decomposition, and singular value decomposition (SVD). The project emphasizes the use of randomization as a powerful tool for low-rank matrix approximation. This approach not only enhances the efficiency of utilizing modern computational architectures but also enables effective handling of massive data sets.
Before you begin, ensure you have met the following requirements:
-
C++ Compiler: This project requires a C++ compiler to build the source code. You can use
g++
or any other C++ compiler that supports C++11 or later. -
MPI (Message Passing Interface): MPI is essential for parallel computing in this project. Ensure you have MPI installed on your system.
-
Eigen Library: This project depends on the Eigen library for linear algebra operations. Download and install Eigen from eigen.tuxfamily.org.
-
Clone the repository:
git clone https://github.com/AMSC22-23/rSVD_Kamaneh_Raganato_Terrana.git
-
Navigate to the project directory:
cd rSVD_Kamaneh_Raganato_Terrana
-
Navigate to the image_compression directory:
cd image_compression
-
Build the project:
make main
To execute the main program, follow these steps:
- Navigate to the program's root directory.
- Run the program by providing the name of the image you wish to compress from the
./data/input/img
directory. - Specify the number of processors to be used. Note: For the parallel version, the number of processors must be a perfect square (e.g., 1, 4, 9, ...).
mpirun -np 4 bin/main 1024_01.jpg
make clean
To assess different components of the program, various tests are available in the ./tests
directory.
Compile the tests with the following command:
make test
There are two types of tests for each component:
- A test ending with the number
1
takes matrices from./data/input/
mat as input and writes the corresponding output to./data/output
.
mpirun -np 4 bin/QR_test1
A test file ending with the number 2
uses hardcoded matrices as input, allowing users to modify them according to their needs.
mpirun -np 4 bin/rSVD_test2
Feel free to explore and adapt the tests based on your specific requirements.