enum LA::MatrixFlags

Overview

MatrixFlags represent properties of matrix (symmetric, positive definite etc) They are used to automatically select faster algorithms from LAPACK. Flags are partially enforced by runtime checks, with the possibility of user override. Examples:

a.detect(MatrixFlags::Symmetric) # will perform a check and if matrix is symmetric, corresponding flag will be set
a.detect # perform check for all flags
a.assume!(MatrixFlags::Symmetric) # we know that matrix is symmetric, so we use `assume!` to set flag without check
a.transpose # will return clone of matrix, as for symmetrix matrices `a == a.transpose`
Simple operations correctly update flags:
(a + Mat.diag(*a.size)).flags.symmetric # => True
But direct access reset flags
a[1,1] = 1
a.flags.symmetric? # => False

Note that simple flag access doesn't perform check, so a.flags.symmetric? can be false for symmetric matrix, unless you called detect before.

Defined in:

matrix/flags.cr

Enum Members

Symmetric = 1

This flag shows that matrix is symmetric (equal to its transpose)

Hermitian = 2

This flag shows that matrix is hermitian (equal to its conjtranspose))

PositiveDefinite = 4

This flag shows that matrix is positive definite

Orthogonal = 8

This flag shows that matrix is orthogonal (its columns and rows are orthonormal vectors)

UpperTriangular = 16

This flag shows that matrix is upper triangular (all the entries below the main diagonal are zero)

LowerTriangular = 32

This flag shows that matrix is lower triangular (all the entries above the main diagonal are zero)

Triangular = 48

Combination of UpperTriangular | LowerTriangular for internal use

None = 0
All = 63

Instance Method Summary

Instance Method Detail

def add(f2 : MatrixFlags, alpha, beta) #

[View source]
def diagonal? #

returns true if matrix is diagonal (both UpperTriangular and LowerTriangular)


[View source]
def hermitian? #

[View source]
def lower_triangular? #

[View source]
def none? #

[View source]
def orthogonal? #

[View source]
def positive_definite? #

[View source]
def symmetric? #

[View source]
def triangular? #

returns true if matrix is either UpperTriangular or LowerTriangular


[View source]
def upper_triangular? #

[View source]