LIBIRWLS
|
Functions to perform parallel linear algebra tasks. More...
Go to the source code of this file.
Functions | |
void | initMemory (int Threads, int size) |
Function to allocate auxiliar memory to be used in the algebra operations. More... | |
void | freeMemory (int Threads) |
Function to free auxiliar memory to be used in the algebra operations. More... | |
void | updateMemory (int Threads, int size) |
Function to update auxiliar memory to be used in the algebra operations. More... | |
void | getSubMatrix (double *matrix, int size1, int size2, int O1, int O2, double *A, int size3, int size4, int nCores) |
This function saves a piece of a matrix in the auxiliar memory. More... | |
void | putSubMatrix (double *matrix, int size1, int size2, int O1, int O2, double *A, int size3, int size4, int nCores) |
This function loads a piece of a matrix in the auxiliar memory and storage it in a matrix. More... | |
void | ParallelChol (double *matrix, int r, int c, int ro, int co, int n, int nCores, int deep) |
Main function that performs a parallel cholesky factorization. More... | |
void | ParallelLinearSystem (double *matrix1, int r1, int c1, int ro1, int co1, double *matrix2, int r2, int c2, int ro2, int co2, int n, int m, double *result, int rr, int cr, int ror, int cor, int nCores) |
Main function to solve a linear system in parallel. More... | |
void | ParallelVectorMatrixT (double *m1, int size, double *m2, double *result, int numThreads) |
This function performs a product of a vector and the transpose of a square matrix in parallel. More... | |
void | ParallelVectorMatrix (double *m1, int size, double *m2, double *result, int numThreads) |
This function performs a product of a vector and a square matrix in parallel. More... | |
Functions to perform parallel linear algebra tasks.
Parallel procedures to solve linear systems, cholesky factorization, matrix products or triangular matrix inversion.
This library also contains many auxiliar functions that are not detailed here with the goal of obtained a readable documentation. Their are only designed to be called by the main functions described here. However, that functions are detailed described in the source code.
void freeMemory | ( | int | Threads | ) |
Function to free auxiliar memory to be used in the algebra operations.
The parallel lineal algebra functions of this module require some memory for every thead to allocate temporal results. This function must be called after any other function.
Threads | The number of threads to parallelize the linear algebra functions. |
void getSubMatrix | ( | double * | matrix, |
int | size1, | ||
int | size2, | ||
int | O1, | ||
int | O2, | ||
double * | A, | ||
int | size3, | ||
int | size4, | ||
int | nCores | ||
) |
This function saves a piece of a matrix in the auxiliar memory.
This is an auxiliry function of the linear algebra funtions. It is used to save a submatrix of a matrix given as a parameter in the auxiliar memory.
matrix | The original matrix. |
size1 | The number of rows fo the original matrix. |
size2 | The number of columns of the original matrix. |
O1 | The row where the submatrix starts. |
O2 | The column where the submatrix starts. |
A | The pointer where the submatrix will be storaged. |
size3 | Number of rows of the submatrix to storage. |
size4 | Number of columns of the submatrix to storage. |
nCores | Number of threads to perform this task. |
void initMemory | ( | int | Threads, |
int | size | ||
) |
Function to allocate auxiliar memory to be used in the algebra operations.
The parallel lineal algebra functions of this module require some memory for every thead to allocate temporal results. This function must be called before any other function.
Threads | The number of threads to parallelize the linear algebra functions. |
size | The size of the dimensions of the matrices that will be handle. If a matrix has a rows and b columns, then n=max(a,b). |
void ParallelChol | ( | double * | matrix, |
int | r, | ||
int | c, | ||
int | ro, | ||
int | co, | ||
int | n, | ||
int | nCores, | ||
int | deep | ||
) |
Main function that performs a parallel cholesky factorization.
This function performs a parallel cholesky factorization on a sqaure submatrix of a matrix recived as an argument. It uses openmp to create to parallelize the task using different threads and every one of them performs a subtask using the function Chol.
matrix | The matrix to perform the cholesky factorization. |
r | The number of rows of matrix |
c | The number of columns of matrix. |
ro | The row where the submatrix starts. |
co | The column where the submatrix starts. |
n | The order of the square submatrix |
nCores | The number of threads to perform the task. |
deep | It is a recursive function, this parameter tell the recursion deep to use. |
void ParallelLinearSystem | ( | double * | matrix1, |
int | r1, | ||
int | c1, | ||
int | ro1, | ||
int | co1, | ||
double * | matrix2, | ||
int | r2, | ||
int | c2, | ||
int | ro2, | ||
int | co2, | ||
int | n, | ||
int | m, | ||
double * | result, | ||
int | rr, | ||
int | cr, | ||
int | ror, | ||
int | cor, | ||
int | nCores | ||
) |
Main function to solve a linear system in parallel.
This function solves a linear system of two submatrices of matrix1 and matrix2. It uses openmp to create different threads and every one of them performs a subtask using the function LinearSystem. If submatrix1 is the submatrix of matrix1 and submatrix2 is the submatrix of matrix2 then it performs (submatrix1)^-1*submatrix2.
matrix1 | The first matrix. |
r1 | The number of rows of matrix1. |
c1 | The number of columns of matrix1. |
ro1 | The row where the submatrix starts. |
co1 | The column where the submatrix starts. |
matrix2 | The second matrix. |
r2 | The number of rows of matrix2. |
c2 | The number of columns of matrix2. |
ro2 | The row where the second submatrix starts. |
co2 | The column where the second submatrix starts. |
n | The number of rows of the submatrix1 |
m | The number of columns of the submatrix2. |
result | The matrix where the result should be storaged. |
rr | The number of rows of matrix result. |
cr | The number of columns of matrix result. |
ror | The row where the result submatrix starts. |
cor | The column where the result submatrix starts. |
nCores | The number of threads to launch to solve the task. |
void ParallelVectorMatrix | ( | double * | m1, |
int | size, | ||
double * | m2, | ||
double * | result, | ||
int | numThreads | ||
) |
This function performs a product of a vector and a square matrix in parallel.
This function performs a product of a vector and a matrix in parallel.
This function performs a vector matrix product in parallel.
m1 | The vector. |
size | The length of the vector and the order of the square matrix. |
m2 | The square matrix. |
result | The matrix to storage the result. |
numThreads | Number of threads to pefrom this task. |
void ParallelVectorMatrixT | ( | double * | m1, |
int | size, | ||
double * | m2, | ||
double * | result, | ||
int | numThreads | ||
) |
This function performs a product of a vector and the transpose of a square matrix in parallel.
This function performs a product of a vector and the transpose of a matrix in parallel.
m1 | The vector. |
size | The length of the vector and the order of the square matrix. |
m2 | The square matrix. |
result | The matrix to storage the result. |
numThreads | Number of threads to pefrom this task. |
void putSubMatrix | ( | double * | matrix, |
int | size1, | ||
int | size2, | ||
int | O1, | ||
int | O2, | ||
double * | A, | ||
int | size3, | ||
int | size4, | ||
int | nCores | ||
) |
This function loads a piece of a matrix in the auxiliar memory and storage it in a matrix.
This is an auxiliry function of the linear algebra funtions. It is used to load a matrix from the auxiliar memory and storage it as a submatrix of another matrix.
matrix | The original matrix where the submatrix will be allocated. |
size1 | The number of rows fo the original matrix. |
size2 | The number of columns of the original matrix. |
O1 | The row of the original matrix where the submatrix starts. |
O2 | The column of the original matrix where the submatrix starts. |
A | The pointer where the submatrix is storaged. |
size3 | Number of rows of the submatrix that is storaged. |
size4 | Number of columns of the submatrix that is storaged. |
nCores | Number of threads to perform this task. |
void updateMemory | ( | int | Threads, |
int | size | ||
) |
Function to update auxiliar memory to be used in the algebra operations.
The parallel lineal algebra functions of this module require some memory for every thead to allocate temporal results. This function must be called if we allocated the memory using the function initMemory and we are going to work with bigger matrices.
Threads | The number of threads to parallelize the linear algebra functions. |
size | The size of the dimensions of the matrices that will be handle. If a matrix has a rows and b columns, then n=max(a,b). |