LIBIRWLS
ParallelAlgorithms.h File Reference

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...
 

Detailed Description

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.

Author
Roberto Diaz Morales
Date
23 Aug 2016

Function Documentation

§ freeMemory()

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.

Parameters
ThreadsThe number of threads to parallelize the linear algebra functions.
See also
updateMemory()

§ getSubMatrix()

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.

Parameters
matrixThe original matrix.
size1The number of rows fo the original matrix.
size2The number of columns of the original matrix.
O1The row where the submatrix starts.
O2The column where the submatrix starts.
AThe pointer where the submatrix will be storaged.
size3Number of rows of the submatrix to storage.
size4Number of columns of the submatrix to storage.
nCoresNumber of threads to perform this task.

§ initMemory()

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.

Parameters
ThreadsThe number of threads to parallelize the linear algebra functions.
sizeThe 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).
See also
updateMemory()

§ ParallelChol()

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.

Parameters
matrixThe matrix to perform the cholesky factorization.
rThe number of rows of matrix
cThe number of columns of matrix.
roThe row where the submatrix starts.
coThe column where the submatrix starts.
nThe order of the square submatrix
nCoresThe number of threads to perform the task.
deepIt is a recursive function, this parameter tell the recursion deep to use.
See also
Chol()

§ ParallelLinearSystem()

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.

Parameters
matrix1The first matrix.
r1The number of rows of matrix1.
c1The number of columns of matrix1.
ro1The row where the submatrix starts.
co1The column where the submatrix starts.
matrix2The second matrix.
r2The number of rows of matrix2.
c2The number of columns of matrix2.
ro2The row where the second submatrix starts.
co2The column where the second submatrix starts.
nThe number of rows of the submatrix1
mThe number of columns of the submatrix2.
resultThe matrix where the result should be storaged.
rrThe number of rows of matrix result.
crThe number of columns of matrix result.
rorThe row where the result submatrix starts.
corThe column where the result submatrix starts.
nCoresThe number of threads to launch to solve the task.

§ ParallelVectorMatrix()

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.

Parameters
m1The vector.
sizeThe length of the vector and the order of the square matrix.
m2The square matrix.
resultThe matrix to storage the result.
numThreadsNumber of threads to pefrom this task.

§ ParallelVectorMatrixT()

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.

Parameters
m1The vector.
sizeThe length of the vector and the order of the square matrix.
m2The square matrix.
resultThe matrix to storage the result.
numThreadsNumber of threads to pefrom this task.

§ putSubMatrix()

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.

Parameters
matrixThe original matrix where the submatrix will be allocated.
size1The number of rows fo the original matrix.
size2The number of columns of the original matrix.
O1The row of the original matrix where the submatrix starts.
O2The column of the original matrix where the submatrix starts.
AThe pointer where the submatrix is storaged.
size3Number of rows of the submatrix that is storaged.
size4Number of columns of the submatrix that is storaged.
nCoresNumber of threads to perform this task.

§ updateMemory()

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.

Parameters
ThreadsThe number of threads to parallelize the linear algebra functions.
sizeThe 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).
See also
initMemory()