GEOSX
|
This class contains a collection of BLAS and LAPACK linear algebra operations for GEOSX array1d and array2d. More...
#include <BlasLapackLA.hpp>
Public Types | |
enum | RandomNumberDistribution : integer { RandomNumberDistribution::UNIFORM_01 = 1, RandomNumberDistribution::UNIFORM_m1p1 = 2, RandomNumberDistribution::NORMAL_01 = 3 } |
This enum class specifies the type of distribution for generating random real numbers. More... | |
template<typename T > | |
using | Vec = arraySlice1d< T > |
Alias for 1d slice representing a vector. | |
template<typename T > | |
using | MatRowMajor = arraySlice2d< T, MatrixLayout::ROW_MAJOR > |
Alias for 2d slice representing a row-major dense matrix. | |
template<typename T > | |
using | MatColMajor = arraySlice2d< T, MatrixLayout::COL_MAJOR > |
Alias for 2d slice representing a column-major dense matrix. | |
Static Public Member Functions | |
static real64 | vectorNorm1 (Vec< real64 const > const &X) |
Returns the 1-norm of the vector. More... | |
static real64 | vectorNorm2 (Vec< real64 const > const &X) |
Returns the two norm of the vector. More... | |
static real64 | vectorNormInf (Vec< real64 const > const &X) |
Returns the infinity-norm of the vector. More... | |
static real64 | determinant (MatRowMajor< real64 const > const &A) |
Returns the determinant of a square matrix. More... | |
static real64 | determinant (MatColMajor< real64 const > const &A) |
Returns the determinant of a square matrix. More... | |
static real64 | matrixNormInf (MatRowMajor< real64 const > const &A) |
Returns the infinity norm of the matrix. More... | |
static real64 | matrixNormInf (MatColMajor< real64 const > const &A) |
Returns the infinity norm of the matrix. More... | |
static real64 | matrixNorm1 (MatRowMajor< real64 const > const &A) |
Returns the one norm of the matrix. More... | |
static real64 | matrixNorm1 (MatColMajor< real64 const > const &A) |
Returns the one norm of the matrix. More... | |
static real64 | matrixNormFrobenius (MatRowMajor< real64 const > const &A) |
Returns the Frobenius norm of the matrix. More... | |
static real64 | matrixNormFrobenius (MatColMajor< real64 const > const &A) |
Returns the Frobenius norm of the matrix. More... | |
static void | vectorVectorAdd (Vec< real64 const > const &X, Vec< real64 > const &Y, real64 const alpha=1.) |
Vector-Vector sum; Y = alpha* Y . More... | |
static void | matrixMatrixAdd (MatRowMajor< real64 const > const &A, MatRowMajor< real64 > const &B, real64 const alpha=1.) |
Matrix-Matrix sum; B = alpha* B . More... | |
static void | matrixMatrixAdd (MatColMajor< real64 const > const &A, MatColMajor< real64 > const &B, real64 const alpha=1.) |
Matrix-Matrix sum; B = alpha* B . More... | |
static void | vectorScale (real64 const alpha, Vec< real64 > const &X) |
In-place scalar-vector product; X = alpha* More... | |
static void | matrixScale (real64 const alpha, MatRowMajor< real64 > const &A) |
In-place scalar-matrix product; A = alpha* More... | |
static void | matrixScale (real64 const alpha, MatColMajor< real64 > const &A) |
In-place scalar-matrix product; A = alpha* More... | |
static real64 | vectorDot (Vec< real64 const > const &X, Vec< real64 const > const &Y) |
Returns the dot product of two vectors. More... | |
static void | matrixVectorMultiply (MatRowMajor< real64 const > const &A, Vec< real64 const > const &X, Vec< real64 > const &Y, real64 const alpha=1.0, real64 const beta=0.0) |
Matrix-Vector product; Y = alpha* More... | |
static void | matrixTVectorMultiply (MatRowMajor< real64 const > const &A, Vec< real64 const > const &X, Vec< real64 > const &Y, real64 const alpha=1.0, real64 const beta=0.0) |
transpose(Matrix)-Vector product; Y = alpha* More... | |
static void | matrixMatrixMultiply (MatRowMajor< real64 const > const &A, MatRowMajor< real64 const > const &B, MatRowMajor< real64 > const &C, real64 const alpha=1.0, real64 const beta=0.0) |
Matrix-Matrix product; C = alpha* More... | |
static void | matrixTMatrixMultiply (MatRowMajor< real64 const > const &A, MatRowMajor< real64 const > const &B, MatRowMajor< real64 > const &C, real64 const alpha=1.0, real64 const beta=0.0) |
transpose(Matrix)-Matrix product; C = alpha* More... | |
static void | matrixMatrixTMultiply (MatRowMajor< real64 const > const &A, MatRowMajor< real64 const > const &B, MatRowMajor< real64 > const &C, real64 const alpha=1.0, real64 const beta=0.0) |
Matrix-transpose(Matrix) product; C = alpha* More... | |
static void | matrixTMatrixTMultiply (MatRowMajor< real64 const > const &A, MatRowMajor< real64 const > const &B, MatRowMajor< real64 > const &C, real64 const alpha=1.0, real64 const beta=0.0) |
transpose(Matrix)-transpose(Matrix) product; C = alpha* More... | |
static void | matrixInverse (MatRowMajor< real64 const > const &A, MatRowMajor< real64 > const &Ainv, real64 &detA) |
Computes the inverse matrix; Ainv = inverse(A) . More... | |
static void | matrixInverse (MatColMajor< real64 const > const &A, MatColMajor< real64 > const &Ainv, real64 &detA) |
Computes the inverse matrix; Ainv = inverse(A) . More... | |
static void | matrixInverse (MatRowMajor< real64 const > const &A, MatRowMajor< real64 > const &Ainv) |
Computes the inverse matrix; Ainv = inverse(A) . More... | |
static void | matrixInverse (MatColMajor< real64 const > const &A, MatColMajor< real64 > const &Ainv) |
Computes the inverse matrix; Ainv = inverse(A) . More... | |
static void | vectorCopy (Vec< real64 const > const &X, Vec< real64 > const &Y) |
Vector copy; Y = X . More... | |
static void | matrixCopy (MatRowMajor< real64 const > const &A, MatRowMajor< real64 > const &B) |
Matrix copy; B = A . More... | |
static void | matrixCopy (MatColMajor< real64 const > const &A, MatColMajor< real64 > const &B) |
Matrix copy; B = A . More... | |
static void | setRandomNumberGeneratorSeed (arraySlice1d< int const > const &seed) |
Set the random number generator seed. More... | |
static void | getRandomNumberGeneratorSeed (arraySlice1d< int > const &seed) |
Get the random number generator seed. More... | |
static void | vectorRand (Vec< real64 > const &X, RandomNumberDistribution const &idist=RandomNumberDistribution::UNIFORM_01) |
Sets vector entries to random real numbers. More... | |
static void | matrixRand (MatRowMajor< real64 > const &A, RandomNumberDistribution const &idist=RandomNumberDistribution::UNIFORM_01) |
Sets matrix entries to random real numbers. More... | |
static void | matrixRand (MatColMajor< real64 > const &A, RandomNumberDistribution const &idist=RandomNumberDistribution::UNIFORM_01) |
Sets matrix entries to random real numbers. More... | |
static void | matrixSVD (MatRowMajor< real64 const > const &A, MatRowMajor< real64 > const &U, Vec< real64 > const &S, MatRowMajor< real64 > const &VT) |
Computes the singular value decomposition of A. More... | |
static void | matrixSVD (MatColMajor< real64 const > const &A, MatColMajor< real64 > const &U, Vec< real64 > const &S, MatColMajor< real64 > const &VT) |
Computes the singular value decomposition of A. More... | |
static void | matrixEigenvalues (MatRowMajor< real64 const > const &A, Vec< std::complex< real64 > > const &lambda) |
Computes the eigenvalues of A. More... | |
static void | matrixEigenvalues (MatColMajor< real64 const > const &A, Vec< std::complex< real64 > > const &lambda) |
Computes the eigenvalues of A. More... | |
This class contains a collection of BLAS and LAPACK linear algebra operations for GEOSX array1d and array2d.
Definition at line 34 of file BlasLapackLA.hpp.
|
strong |
This enum class specifies the type of distribution for generating random real numbers.
Enumerator | |
---|---|
UNIFORM_01 | uniform distribution (0,1) |
UNIFORM_m1p1 | uniform distribution (-1,1) |
NORMAL_01 | normal distribution (0,1) |
Definition at line 52 of file BlasLapackLA.hpp.
|
static |
Returns the determinant of a square matrix.
[in] | A | GEOSX array2d. |
|
static |
Returns the determinant of a square matrix.
[in] | A | GEOSX array2d. |
|
static |
Get the random number generator seed.
[out] | seed | GEOSX array1d, dimension (4). |
|
static |
Matrix copy; B
= A
.
[in] | A | GEOSX array2d. |
[out] | B | GEOSX array2d. |
A
and B
have the same size.
|
static |
Matrix copy; B
= A
.
[in] | A | GEOSX array2d. |
[out] | B | GEOSX array2d. |
A
and B
have the same size.
|
static |
Computes the eigenvalues of A.
If size(A) = (N,N), this function expects: size(lambda) = N On exit, lambda contains the eigenvalues of A
[in] | A | GEOSX array2d. |
[out] | lambda | GEOSX array1d. |
|
static |
Computes the eigenvalues of A.
If size(A) = (N,N), this function expects: size(lambda) = N On exit, lambda contains the eigenvalues of A
[in] | A | GEOSX array2d. |
[out] | lambda | GEOSX array1d. |
|
static |
Computes the inverse matrix; Ainv
= inverse(A)
.
Computes the inverse of the square matrix A
and stores it in Ainv
, and also returns the determinant of A
.
[in] | A | GEOSX array2d. |
[out] | Ainv | GEOSX array2d. |
[out] | detA | Determinant of matrix A . |
Ainv
already has the same size as A
.A
is practically computed as the transpose matrix of the transpose matrix inverse using lapack operation based on column-major ordering. This removes the need for any copy/transposition that would be required operating with the row-major layout.
|
static |
Computes the inverse matrix; Ainv
= inverse(A)
.
Computes the inverse of the square matrix A
and stores it in Ainv
, and also returns the determinant of A
.
[in] | A | GEOSX array2d. |
[out] | Ainv | GEOSX array2d. |
[out] | detA | Determinant of matrix A . |
Ainv
already has the same size as A
.A
is practically computed as the transpose matrix of the transpose matrix inverse using lapack operation based on column-major ordering. This removes the need for any copy/transposition that would be required operating with the row-major layout.
|
static |
Computes the inverse matrix; Ainv
= inverse(A)
.
Computes the inverse of the square matrix A
and stores it in Ainv
.
[in] | A | GEOSX array2d. |
[out] | Ainv | GEOSX array2d. |
Ainv
already has the same size as A
.A
is practically computed as the transpose matrix of the transpose matrix inverse using lapack operation based on column-major ordering. This removes the need for any copy/transposition that would be required operating with the row-major layout.
|
static |
Computes the inverse matrix; Ainv
= inverse(A)
.
Computes the inverse of the square matrix A
and stores it in Ainv
.
[in] | A | GEOSX array2d. |
[out] | Ainv | GEOSX array2d. |
Ainv
already has the same size as A
.A
is practically computed as the transpose matrix of the transpose matrix inverse using lapack operation based on column-major ordering. This removes the need for any copy/transposition that would be required operating with the row-major layout.
|
static |
Matrix-Matrix sum; B
= alpha*
A
+B
.
Computes (alpha*
A
+B
) and overwrites the result on p B, with optional scaling.
[in] | A | GEOSX array2d. |
[in,out] | B | GEOSX array2d. |
[in] | alpha | Optional scalar to multiply with A . |
A
and B
have the same size.
|
static |
Matrix-Matrix sum; B
= alpha*
A
+B
.
Computes (alpha*
A
+B
) and overwrites the result on p B, with optional scaling.
[in] | A | GEOSX array2d. |
[in,out] | B | GEOSX array2d. |
[in] | alpha | Optional scalar to multiply with A . |
A
and B
have the same size.
|
static |
Matrix-Matrix product; C
= alpha*
A*
B
+beta*
C
.
Computes matrix-matrix product with optional scaling and accumulation.
[in] | A | GEOSX array2d. |
[in] | B | GEOSX array2d. |
[in,out] | C | GEOSX array1d. |
[in] | alpha | Optional scalar to multiply with A* |
[in] | beta | Optional parameter to control the accumulation. |
A
and B
have compatible sizes and that C
already has the right size.
|
static |
Matrix-transpose(Matrix) product; C
= alpha*
A*
transpose(B)
+beta*
C
.
Computes matrix-transpose(matrix) product with optional scaling and accumulation.
[in] | A | GEOSX array2d. |
[in] | B | GEOSX array2d. |
[in,out] | C | GEOSX array1d. |
[in] | alpha | Optional scalar to multiply with A*transpose (B). |
[in] | beta | Optional parameter to control the accumulation. |
A
and transpose(B)
have compatible sizes and that C
already has the right size.
|
static |
Returns the one norm of the matrix.
[in] | A | GEOSX array2d. |
|
static |
Returns the one norm of the matrix.
[in] | A | GEOSX array2d. |
|
static |
Returns the Frobenius norm of the matrix.
[in] | A | GEOSX array2d. |
|
static |
Returns the Frobenius norm of the matrix.
[in] | A | GEOSX array2d. |
|
static |
Returns the infinity norm of the matrix.
[in] | A | GEOSX array2d. |
|
static |
Returns the infinity norm of the matrix.
[in] | A | GEOSX array2d. |
|
static |
Sets matrix entries to random real numbers.
Sets matrix entries to random real numbers from a uniform or normal distribution without specifying the seed of the random number generator.
[out] | A | GEOSX array1d. |
[in] | idist | Optional RandomNumberDistribution enum value specifying the distribution of the random numbers. |
|
static |
Sets matrix entries to random real numbers.
Sets matrix entries to random real numbers from a uniform or normal distribution without specifying the seed of the random number generator.
[out] | A | GEOSX array1d. |
[in] | idist | Optional RandomNumberDistribution enum value specifying the distribution of the random numbers. |
|
static |
In-place scalar-matrix product; A
= alpha*
A
.
[in] | alpha | Scalar to multiply with A . |
[in,out] | A | GEOSX array2d. |
|
static |
In-place scalar-matrix product; A
= alpha*
A
.
[in] | alpha | Scalar to multiply with A . |
[in,out] | A | GEOSX array2d. |
|
static |
Computes the singular value decomposition of A.
If size(A) = (M,N), this function expects: size(U) = (M,min(M,N)), size(VT) = (min(M,N),N), and size(S) = min(M,N) On exit, S contains the singular values of A and U contains an orthonormal basis of range(A)
[in] | A | GEOSX array2d. |
[out] | U | GEOSX array2d. |
[out] | S | GEOSX array1d. |
[out] | VT | GEOSX array2d. |
|
static |
Computes the singular value decomposition of A.
If size(A) = (M,N), this function expects: size(U) = (M,min(M,N)), size(VT) = (min(M,N),N), and size(S) = min(M,N) On exit, S contains the singular values of A and U contains an orthonormal basis of range(A)
[in] | A | GEOSX array2d. |
[out] | U | GEOSX array2d. |
[out] | S | GEOSX array1d. |
[out] | VT | GEOSX array2d. |
|
static |
transpose(Matrix)-Matrix product; C
= alpha*
transpose(A)*
B
+beta*
C
.
Computes transpose(matrix)-matrix product with optional scaling and accumulation.
[in] | A | GEOSX array2d. |
[in] | B | GEOSX array2d. |
[in,out] | C | GEOSX array2d. |
[in] | alpha | Optional scalar to multiply with transpose(A)* |
[in] | beta | Optional parameter to control the accumulation. |
transpose(A)
and B
have compatible sizes and that C
already has the right size.
|
static |
transpose(Matrix)-transpose(Matrix) product; C
= alpha*
transpose(A)*
transpose(B)
+beta*
C
.
Computes transpose(matrix)-transpose(matrix) product with optional scaling and accumulation.
[in] | A | GEOSX array2d. |
[in] | B | GEOSX array2d. |
[in,out] | C | GEOSX array1d. |
[in] | alpha | Optional scalar to multiply with tranpose(A)*transpose (B). |
[in] | beta | Optional parameter to control the accumulation. |
tranpose(A)
and transpose(B)
have compatible sizes and that C
already has the right size.
|
static |
transpose(Matrix)-Vector product; Y
= alpha*
transpose(A)*
X
+beta*
Y
.
Computes transpose(matrix)-vector product with optional scaling and accumulation.
[in] | A | GEOSX array2d. |
[in] | X | GEOSX array1d. |
[in,out] | Y | GEOSX array1d. |
[in] | alpha | Optional scalar to multiply with transpose(A)* |
[in] | beta | Optional parameter to control the accumulation. |
X
and Y
have compatible sizes with transpose(A)
.
|
static |
Matrix-Vector product; Y
= alpha*
A*
X
+beta*
Y
.
Computes matrix-vector product with optional scaling and accumulation.
[in] | A | GEOSX array2d. |
[in] | X | GEOSX array1d. |
[in,out] | Y | GEOSX array1d. |
[in] | alpha | Optional scalar to multiply with A* |
[in] | beta | Optional parameter to control the accumulation. |
X
and Y
have compatible sizes with A
.
|
static |
Set the random number generator seed.
[in] | seed | GEOSX array1d, dimension (4). The elements must be between 0 and 4095, and seed(4) must be odd. |
|
static |
Vector copy; Y
= X
.
[in] | X | GEOSX array1d. |
[out] | Y | GEOSX array1d. |
X
and Y
have the same size.
|
static |
Returns the dot product of two vectors.
[in] | X | GEOSX array1d. |
[in] | Y | GEOSX array1d. |
Returns the 1-norm of the vector.
[in] | X | GEOSX array1d. |
Returns the two norm of the vector.
[in] | X | GEOSX array1d. |
Returns the infinity-norm of the vector.
[in] | X | GEOSX array1d. |
|
static |
Sets vector entries to random real numbers.
Sets vector entries to random real numbers from a uniform or normal distribution without specifying the seed of the random number generator.
[out] | X | GEOSX array1d. |
[in] | idist | Optional RandomNumberDistribution enum value specifying the distribution of the random numbers. |
In-place scalar-vector product; X
= alpha*
X
.
[in] | alpha | Scalar to multiply with X . |
[in,out] | X | GEOSX array1d. |
|
static |
Vector-Vector sum; Y
= alpha*
X
+Y
.
Computes (alpha*
X
+Y
) and overwrites the result on Y
, with optional scaling.
[in] | X | GEOSX array1d. |
[in,out] | Y | GEOSX array1d. |
[in] | alpha | Optional scalar to multiply with X . |
X
and Y
have the same size.