module LA

Included Modules

Defined in:

linalg.cr
linalg/banded.cr
linalg/cholesky.cr
linalg/eig.cr
linalg/expm.cr
linalg/lapack_helper.cr
linalg/linalg.cr
linalg/lu.cr
linalg/matfun.cr
linalg/mult.cr
linalg/qr.cr
linalg/rq_lq_ql.cr
linalg/schur.cr
matrix/banded_matrix.cr
matrix/flag_checks.cr
matrix/flags.cr
matrix/general_matrix.cr
matrix/iteration.cr
matrix/matrix.cr
matrix/special_matrix.cr
matrix/submatrix.cr

Class Method Summary

Instance Method Summary

Class Method Detail

def self.cho_solve(a, b, *, overwrite_b = false) #

[View source]
def self.coshm(mat) #

[View source]
def self.cosm(mat) #

[View source]
def self.eigs(a, b, *, need_left : Bool, need_right : Bool, overwrite_a = false, overwrite_b = false) #

See GeneralMatrix#eigss(*, b : GeneralMatrix(T), need_left : Bool, need_right : Bool, overwrite_a = false, overwrite_b = false).


[View source]
def self.expm(mat) #

[View source]
def self.inv(matrix, *, overwrite_a = false) #

Calculate matrix inversion.

Arguments:

  • matrix (Matrix(T)) : The matrix to invert.
  • overwrite_a (Bool) : If true, allows overwriting the input matrix. Default: false.

Returns:

  • GeneralMatrix(T) : The inverted matrix.

See GeneralMatrix#inv! for details of algorithm.


[View source]
def self.lapack_version #

Returns the LAPACK version as a tuple {major, minor, patch}.

LAPACK Routine:

  • Uses ilaver (LAPACK version query).

[View source]
def self.lstsq(a, b, method : LSMethod = LSMethod::Auto, *, overwrite_a = false, overwrite_b = false, cond = -1) #

Solves the linear least squares problem min ||A*X - B||.

Arguments:

  • a (Matrix(T)) : Coefficient matrix.
  • b (Matrix(T)) : Right-hand side matrix.
  • method (LSMethod) : Algorithm to use. Default: LSMethod::Auto.
  • overwrite_a (Bool) : If true, allows overwriting a. Default: false.
  • overwrite_b (Bool) : If true, allows overwriting b. Default: false.
  • cond (Number) : Cutoff for rank determination. Default: -1 (machine precision).

Returns:

  • Tuple(GeneralMatrix(T), Int32, Array(T)) : Solution X, effective rank, singular values (if applicable).

See Matrix#lstsq for details.


[View source]
def self.qz(a, b, *, overwrite_a = false, overwrite_b = false) #

[View source]
def self.sinhm(mat) #

[View source]
def self.sinm(mat) #

[View source]
def self.solve(a, b, *, overwrite_a = false, overwrite_b = false) #

Solves the linear system A * X = B.

Arguments:

  • a (Matrix(T)) : Coefficient matrix.
  • b (Matrix(T)) : Right-hand side matrix.
  • overwrite_a (Bool) : If true, allows overwriting a. Default: false.
  • overwrite_b (Bool) : If true, allows overwriting b. Default: false.

Returns:

  • GeneralMatrix(T) : Solution matrix X.

See Matrix#solve for details.


[View source]
def self.solvels(a, b, *, overwrite_a = false, overwrite_b = false, cond = -1) #

Solves the linear least squares problem using QR factorization.

Arguments:

  • a (Matrix(T)) : Coefficient matrix.
  • b (Matrix(T)) : Right-hand side matrix.
  • overwrite_a (Bool) : If true, allows overwriting a. Default: false.
  • overwrite_b (Bool) : If true, allows overwriting b. Default: false.
  • cond (Number) : Cutoff for rank determination. Default: -1 (machine precision).

Returns:

  • GeneralMatrix(T) : Solution matrix X.

See Matrix#solvels for details.


[View source]
def self.svd(matrix, *, overwrite_a = false) #

Computes the singular value decomposition (SVD) of a matrix.

Arguments:

  • matrix (Matrix(T)) : Input matrix.
  • overwrite_a (Bool) : If true, allows overwriting matrix. Default: false.

Returns:

  • Tuple(GeneralMatrix(T), Array(T), GeneralMatrix(T)) : U, singular values, V^T.

See Matrix#svd for details.


[View source]
def self.tanhm(mat) #

[View source]
def self.tanm(mat) #

[View source]

Instance Method Detail

def coshm(mat) #

[View source]
def cosm(mat) #

[View source]
def expm(mat) #

[View source]
def sinhm(mat) #

[View source]
def sinm(mat) #

[View source]
def tanhm(mat) #

[View source]
def tanm(mat) #

[View source]