LinearAlgebra Module

Types

Type Description

Factorization

Functions and values

Function or value Description

Cholesky a

Full Usage: Cholesky a

Parameters:
Returns: Matrix<float>

Given A[n,n] real symmetric positive definite.
Finds the cholesky decomposition L such that L' * L = A.
May fail if not positive definite.

a : matrix

Returns: Matrix<float>

Example

Determinant A

Full Usage: Determinant A

Parameters:
Returns: float

Compute the determinant of a matrix by performing an LU decomposition since if A = P'LU,
then det(A) = det(P') * det(L) * det(U).

A : Matrix<float>

Returns: float

Example

EVD m

Full Usage: EVD m

Parameters:
    m : 'a

Returns: 'b

Compoutes for an N-by-N real nonsymmetric matrix A, the eigenvalue decomposition eigenvalues and right eigenvectors. The right eigenvector v(j) of A satisfies A * v(j) = lambda(j) * v(j) where lambda(j) is its eigenvalue. The computed eigenvectors are normalized to have Euclidean norm equal to 1 and largest component real. Uses the LAPACK subroutine dgeev with arguments JOBVR = 'V' and JOBVL = 'N'

Returns the real (first array) and imaginary (second array) parts of the eigenvalues and a matrix containing the corresponding eigenvectors

m : 'a
Returns: 'b

EigenSpectrumWhenSymmetric a

Full Usage: EigenSpectrumWhenSymmetric a

Parameters:
Returns: Matrix<float> * Vector<float>

Compute eigenvalues and eigenvectors for a real symmetric matrix.
Returns arrays of the values and vectors (both based on reals).
This call may fail.

a : Matrix<float>

Returns: Matrix<float> * Vector<float>

Example

EigenValues m

Full Usage: EigenValues m

Parameters:
    m : 'a -

Returns: 'b

Compute eigenvalues of a square real matrix.
Returns arrays containing the eigenvalues which may be complex.
This call may fail.

m : 'a

Returns: 'b

Example

EigenValuesWhenSymmetric a

Full Usage: EigenValuesWhenSymmetric a

Parameters:
    a : 'a -

Returns: 'b

Compute eigenvalues for a real symmetric matrix.
Returns array of real eigenvalues.
This call may fail.

a : 'a

Returns: 'b

Example

Hessenberg A

Full Usage: Hessenberg A

Parameters:
Returns: matrix * Matrix<float>
A : matrix
Returns: matrix * Matrix<float>

Inverse a

Full Usage: Inverse a

Parameters:
Returns: Matrix<float>

Given A[n,n] find it's inverse.
This call may fail.

a : Matrix<float>

Returns: Matrix<float>

Example

LU a

Full Usage: LU a

Parameters:
Returns: (int -> int) * Matrix<float> * Matrix<float>

Given A[n,n] real matrix.
Finds P,L,U such that L*U = P*A with L,U lower/upper triangular.

a : Matrix<float>

Returns: (int -> int) * Matrix<float> * Matrix<float>

Example

LeastSquares a b

Full Usage: LeastSquares a b

Parameters:
Returns: Vector<float>

Given A[m,n] and B[m] solves AX = B for X[n].
When m => n, have over constrained system, finds least squares solution for X.
When m < n, have under constrained system, finds least norm solution for X.

a : Matrix<float>

b : vector

Returns: Vector<float>

Example

LeastSquaresCholesky a b

Full Usage: LeastSquaresCholesky a b

Parameters:
Returns: Vector<float>

Given A[m,n] and b[m] solves AX = b for X[n].
When the system is under constrained,
for example when the columns of A are not linearly independent,
then it will not give sensible results.

a : Matrix<float>

b : Vector<float>

Returns: Vector<float>

Example

QR a

Full Usage: QR a

Parameters:
Returns: matrix * matrix

Given A[m,n] finds Q[m,m] and R[k,n] where k = min m n.
Have A = Q.R when m < =n.
Have A = Q.RX when m > n and RX[m,n] is R[n,n] row extended with (m-n) zero rows.

a : matrix

Returns: matrix * matrix

Example

SVD a

Full Usage: SVD a

Parameters:
Returns: vector * Matrix<float> * Matrix<float>

Returns the full Singular Value Decomposition of the input MxN matrix A : A = U * SIGMA * V**T in the tuple (S, U, V**T), where S is an array containing the diagonal elements of SIGMA.

uses the LAPACK routine dgesdd with the argument JOBZ = 'A'

a : Matrix<float>
Returns: vector * Matrix<float> * Matrix<float>

Service ()

Full Usage: Service ()

Parameters:
    () : unit

Returns: ILinearAlgebra
() : unit
Returns: ILinearAlgebra

SolveLinearSystem A b

Full Usage: SolveLinearSystem A b

Parameters:
Returns: Vector<float>
A : matrix
b : vector
Returns: Vector<float>

SolveLinearSystems A B

Full Usage: SolveLinearSystems A B

Parameters:
Returns: Matrix<float>
A : matrix
B : matrix
Returns: Matrix<float>

SolveTriangularLinearSystem A b isLower

Full Usage: SolveTriangularLinearSystem A b isLower

Parameters:
Returns: Vector<float>
A : matrix
b : vector
isLower : bool
Returns: Vector<float>

SolveTriangularLinearSystems A B isLower

Full Usage: SolveTriangularLinearSystems A B isLower

Parameters:
Returns: Matrix<float>
A : matrix
B : matrix
isLower : bool
Returns: Matrix<float>

hatmatrix A

Full Usage: hatmatrix A

Parameters:
Returns: Matrix<float>

computes the hat matrix by the QR decomposition of the designmatrix used in ordinary least squares approaches

A : Matrix<float>

Returns: Matrix<float>

Example

leverage A

Full Usage: leverage A

Parameters:
Returns: vector

computes the leverage directly by QR decomposition of the designmatrix used in ordinary least squares approaches
and computing of the diagnonal entries of the Hat matrix, known as the leverages of the regressors

A : Matrix<float>

Returns: vector

Example

leverageBy A

Full Usage: leverageBy A

Parameters:
Returns: Vector<float>

computes the hat matrix by the QR decomposition of the designmatrix used in ordinary least squares approaches

A : Matrix<float>

Returns: Vector<float>

Example

preDivideByMatrix a b

Full Usage: preDivideByMatrix a b

Parameters:
Returns: Matrix<float>

Given A[n,m] and B[n,k] solve for X[m,k] such that AX = B
This call may fail.

a : matrix

b : matrix

Returns: Matrix<float>

Example

preDivideByVector A b

Full Usage: preDivideByVector A b

Parameters:
Returns: Vector<float>

Given A[n,m] and B[n] solve for x[m] such that Ax = B
This call may fail.

A : matrix

b : vector

Returns: Vector<float>

Example

spectralNorm a

Full Usage: spectralNorm a

Parameters:
Returns: float

spectral norm of a matrix (for Frobenius norm use Matrix.norm)

a : Matrix<float>

Returns: float

Example

thinSVD a

Full Usage: thinSVD a

Parameters:
Returns: vector * Matrix<float> * Matrix<float>

Returns the thin Singular Value Decomposition of the input MxN matrix A A = U * SIGMA * V**T in the tuple (S, U, V), where S is an array containing the diagonal elements of SIGMA. The first min(M,N) columns of U and the first min(M,N) rows of V**T are returned in the arrays U and VT;

uses the LAPACK routine dgesdd with the argument JOBZ = 'S'

a : Matrix<float>
Returns: vector * Matrix<float> * Matrix<float>