Xmipp  v3.23.11-Nereus
Macros | Functions
Linear algebra
Collaboration diagram for Linear algebra:

Macros

#define SVDMAXITER   1000
 

Functions

int AllocateMatrix (double **Matrix, long Lines, long Columns, int *Status)
 
int AllocateVector (double *(Vector[]), long Lines, int *Status)
 
int FreeMatrix (double **Matrix)
 
int FreeVector (double *(Vector[]))
 
int FrobeniusNorm (double *A, double *Norm, long Lines, long Columns)
 
int GetIdentitySquareMatrix (double *A, long Size)
 
int LinearLeastSquares (double *A, long Lines, long Columns, double B[], double X[], double Tolerance, int *Status)
 
int MatrixAdd (double *A, double *B, double *X, long Lines, long Columns)
 
int MatrixConditionNumber (double *A, long Lines, long Columns, double *ConditionNumber, double Tolerance, long MaxIterations, int *Status)
 
int MatrixGramSchmidtOrthonormalize (double *A, double *B, long Lines, long Columns, double Tolerance)
 
int MatrixMinor (double *A, double *B, long Lines, long Columns, long i, long j)
 
int MatrixMultiply (double *A, double *B, double *X, long Lines, long CommonSize, long Columns)
 
int MatrixRank (double *A, long Lines, long Columns, long *Rank, double Tolerance, long MaxIterations, int *Status)
 
int MatrixSubtract (double *A, double *B, double *X, long Lines, long Columns)
 
int MatrixTimesVector (double *A, double *B, double *X, long Lines, long Columns)
 
int MatrixTranspose (double *A, double *At, long Lines, long Columns)
 
int multiply_3Matrices (double *A, double *B, double *C, double *X, long Lines, long CommonSizeH, long CommonSizeW, long Columns)
 
int multiply_4Matrices (double *A, double *B, double *C, double *D, double *X, long Lines, long CommonSizeH1, long CommonSizeW1, long CommonSizeW2, long Columns)
 
int multiply_5Matrices (double *A, double *B, double *C, double *D, double *E, double *X, long Lines, long CommonSizeH1, long CommonSizeW1, long CommonSizeW2, long CommonSizeH2, long Columns)
 
int QRdecomposition (double *Q, double *R, long Lines, long Columns, double Tolerance, int *Status)
 
int SingularValueBackSubstitution (double *U, double W[], double *V, long Lines, long Columns, double B[], double X[], int *Status)
 
int SingularValueDecomposition (double *U, long Lines, long Columns, double W[], double *V, long MaxIterations, int *Status)
 
int SquareMatrixDeterminant (double *A, long Size, double *Determinant, int *Status)
 
int SquareMatrixInvertGauss (double *Direct, double *Inverse, long Size, double Tolerance, int *Status)
 
int SquareMatrixSquareRoot (double *A, double *B, long Size, double Tolerance, long MaxIterations, int *Status)
 
int SquareMatrixTrace (double *A, double *Trace, long Size)
 
int Vector3DcrossProduct (double A[], double B[], double X[])
 
int VectorAdd (double A[], double B[], double X[], long Lines)
 
int VectorAngle (double A[], double B[], double *Angle, long Lines, double Tolerance)
 
int VectorHomogenize (double A[], double X[], long Lines, double Tolerance)
 
int VectorNorm (double A[], double *Norm, long Lines)
 
int VectorNormalize (double A[], double X[], long Lines)
 
int VectorScalarProduct (double A[], double B[], double *X, long Lines)
 
int VectorScale (double A[], double X[], double Scale, long Lines)
 
int VectorSubtract (double A[], double B[], double X[], long Lines)
 

Detailed Description

Macro Definition Documentation

◆ SVDMAXITER

#define SVDMAXITER   1000

Definition at line 257 of file linearalgebra.h.

Function Documentation

◆ AllocateMatrix()

int AllocateMatrix ( double **  Matrix,
long  Lines,
long  Columns,
int *  Status 
)

◆ AllocateVector()

int AllocateVector ( double *  Vector[],
long  Lines,
int *  Status 
)

◆ FreeMatrix()

int FreeMatrix ( double **  Matrix)

◆ FreeVector()

int FreeVector ( double *  Vector[])

◆ FrobeniusNorm()

int FrobeniusNorm ( double *  A,
double *  Norm,
long  Lines,
long  Columns 
)

Compute the Frobenius norm of the matrix A. The size of A is (Lines x Columns). success: return(!ERROR); failure: return(ERROR)

◆ GetIdentitySquareMatrix()

int GetIdentitySquareMatrix ( double *  A,
long  Size 
)

◆ LinearLeastSquares()

int LinearLeastSquares ( double *  A,
long  Lines,
long  Columns,
double  B[],
double  X[],
double  Tolerance,
int *  Status 
)

◆ MatrixAdd()

int MatrixAdd ( double *  A,
double *  B,
double *  X,
long  Lines,
long  Columns 
)

◆ MatrixConditionNumber()

int MatrixConditionNumber ( double *  A,
long  Lines,
long  Columns,
double *  ConditionNumber,
double  Tolerance,
long  MaxIterations,
int *  Status 
)

Compute the condition number of the matrix A. The size of A is (Lines x Columns). ConditionNumber = -1.0 indicates a singular matrix.

success: return(!ERROR); failure: return(ERROR)

◆ MatrixGramSchmidtOrthonormalize()

int MatrixGramSchmidtOrthonormalize ( double *  A,
double *  B,
long  Lines,
long  Columns,
double  Tolerance 
)

Orthonormalize a matrix. The size of A and B is (Lines x Columns). The orthogonalization proceeds row-wise.

success: return(!ERROR); failure: return(ERROR)

◆ MatrixMinor()

int MatrixMinor ( double *  A,
double *  B,
long  Lines,
long  Columns,
long  i,
long  j 
)

Extract a minor matrix B from the major matrix A. The size of A is (Lines x Columns). The size of B is ((Lines - 1) x (Columns - 1)). The line to delete is i (indexing starts from 0). The column to delete is j (indexing starts from 0).

success: return(!ERROR); failure: return(ERROR)

◆ MatrixMultiply()

int MatrixMultiply ( double *  A,
double *  B,
double *  X,
long  Lines,
long  CommonSize,
long  Columns 
)

◆ MatrixRank()

int MatrixRank ( double *  A,
long  Lines,
long  Columns,
long *  Rank,
double  Tolerance,
long  MaxIterations,
int *  Status 
)

Compute the rank of the matrix A. The size of A is (Lines x Columns).

success: return(!ERROR); failure: return(ERROR)

◆ MatrixSubtract()

int MatrixSubtract ( double *  A,
double *  B,
double *  X,
long  Lines,
long  Columns 
)

◆ MatrixTimesVector()

int MatrixTimesVector ( double *  A,
double *  B,
double *  X,
long  Lines,
long  Columns 
)

◆ MatrixTranspose()

int MatrixTranspose ( double *  A,
double *  At,
long  Lines,
long  Columns 
)

◆ multiply_3Matrices()

int multiply_3Matrices ( double *  A,
double *  B,
double *  C,
double *  X,
long  Lines,
long  CommonSizeH,
long  CommonSizeW,
long  Columns 
)

Multiply 3 Matrices. X=A*B*C; A is of size Lines x CommonSizeH, B is of size CommonSizeH x CommonSizeW, C is of size CommonSizeW x Columns. Finally, X is of size Lines x Columns.

◆ multiply_4Matrices()

int multiply_4Matrices ( double *  A,
double *  B,
double *  C,
double *  D,
double *  X,
long  Lines,
long  CommonSizeH1,
long  CommonSizeW1,
long  CommonSizeW2,
long  Columns 
)

◆ multiply_5Matrices()

int multiply_5Matrices ( double *  A,
double *  B,
double *  C,
double *  D,
double *  E,
double *  X,
long  Lines,
long  CommonSizeH1,
long  CommonSizeW1,
long  CommonSizeW2,
long  CommonSizeH2,
long  Columns 
)

◆ QRdecomposition()

int QRdecomposition ( double *  Q,
double *  R,
long  Lines,
long  Columns,
double  Tolerance,
int *  Status 
)

Decompose the (Lines x Columns) input matrix Q into an orthonormal. Output matrix Q of same size (Lines x Columns) and an upper-diagonal. Square matrix R of size (Columns x Columns), such that the matrix. Product (Q * R) gives the input matrix, and such that the matrix. Product (Q^T * Q) gives the identity.

requirement: Columns <= Lines

success: return(!ERROR); failure: return(ERROR)

◆ SingularValueBackSubstitution()

int SingularValueBackSubstitution ( double *  U,
double  W[],
double *  V,
long  Lines,
long  Columns,
double  B[],
double  X[],
int *  Status 
)

◆ SingularValueDecomposition()

int SingularValueDecomposition ( double *  U,
long  Lines,
long  Columns,
double  W[],
double *  V,
long  MaxIterations,
int *  Status 
)

◆ SquareMatrixDeterminant()

int SquareMatrixDeterminant ( double *  A,
long  Size,
double *  Determinant,
int *  Status 
)

◆ SquareMatrixInvertGauss()

int SquareMatrixInvertGauss ( double *  Direct,
double *  Inverse,
long  Size,
double  Tolerance,
int *  Status 
)

◆ SquareMatrixSquareRoot()

int SquareMatrixSquareRoot ( double *  A,
double *  B,
long  Size,
double  Tolerance,
long  MaxIterations,
int *  Status 
)

Compute one out of the 2^Size square roots B of a matrix A such that B.B = A. The size of the matrices A and B is (Size x Size). B must provide an initial solution.

success: return(!ERROR); failure: return(ERROR)

◆ SquareMatrixTrace()

int SquareMatrixTrace ( double *  A,
double *  Trace,
long  Size 
)

Perform the vector cross product X = A x B. The size of A is (Size x Size)

success: return(!ERROR); failure: return(ERROR)

◆ Vector3DcrossProduct()

int Vector3DcrossProduct ( double  A[],
double  B[],
double  X[] 
)

◆ VectorAdd()

int VectorAdd ( double  A[],
double  B[],
double  X[],
long  Lines 
)

◆ VectorAngle()

int VectorAngle ( double  A[],
double  B[],
double *  Angle,
long  Lines,
double  Tolerance 
)

Compute the angle between two vectors *(n-D). The size of A and B is (Lines x 1). The angle unit is radian.

success: return(!ERROR); failure: return(ERROR)

◆ VectorHomogenize()

int VectorHomogenize ( double  A[],
double  X[],
long  Lines,
double  Tolerance 
)

Convert a vector from non-homogenous to homogenous coordinates. Satisfy (Vout = a * Vin) such that (Vout[last] = 1.0). The size of A and X is (Lines x 1).

success: return(!ERROR); failure: return(ERROR)

◆ VectorNorm()

int VectorNorm ( double  A[],
double *  Norm,
long  Lines 
)

◆ VectorNormalize()

int VectorNormalize ( double  A[],
double  X[],
long  Lines 
)

◆ VectorScalarProduct()

int VectorScalarProduct ( double  A[],
double  B[],
double *  X,
long  Lines 
)

◆ VectorScale()

int VectorScale ( double  A[],
double  X[],
double  Scale,
long  Lines 
)

◆ VectorSubtract()

int VectorSubtract ( double  A[],
double  B[],
double  X[],
long  Lines 
)