ai.dragonfly.math.matrix.util

Members list

Type members

Classlikes

case class CannotExpressMatrixAsVector[M <: Int, N <: Int](m: Matrix[M, N]) extends Exception

Attributes

Source
Exceptions.scala
Supertypes
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
case class MatrixNotSymmetricPositiveDefinite[M <: Int, N <: Int](m: Matrix[M, N]) extends Exception

Attributes

Source
Exceptions.scala
Supertypes
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
case class UnsupportedMatrixDimension(rows: Int, columns: Int) extends Exception

Attributes

Source
Exceptions.scala
Supertypes
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all

Extensions

Extensions

extension [M <: Int, N <: Int](a: Matrix[M, N])(a: Matrix[M, N])(using ValueOf[M], ValueOf[N], ValueOf[Min[M, N]], N =:= M =:= false)
def solve[V <: Int](b: Matrix[M, V])(using ValueOf[V]): Matrix[N, V]

Solve a * x = b

Solve a * x = b

Value parameters

b

right hand side

Attributes

Returns

least squares solution x = Matrix[M, V] such that a * x = b

Source
util.scala
extension [MN <: Int](m: Matrix[MN, MN])(m: Matrix[MN, MN])(using ValueOf[MN])

Matrix determinant https://en.wikipedia.org/wiki/Determinant the determinant is nonzero if and only if the matrix is invertible and the linear map represented by the matrix is an isomorphism

Matrix determinant https://en.wikipedia.org/wiki/Determinant the determinant is nonzero if and only if the matrix is invertible and the linear map represented by the matrix is an isomorphism

Attributes

Returns

the determinant of this matrix.

Source
util.scala
def inverse: Matrix[MN, MN]

https://en.wikipedia.org/wiki/Invertible_matrix

https://en.wikipedia.org/wiki/Invertible_matrix

Computes the inverse of Square Matrix m.

Attributes

Returns

the inverse of matrix m

Throws
RuntimeException

"Matrix is singular." )

Source
util.scala
def solve[V <: Int](b: Matrix[MN, V])(using ValueOf[V]): Matrix[MN, V]

Solve a * x = b

Solve a * x = b

Value parameters

b

right hand side

Attributes

Returns

x = Matrix[MN, V] such that a * x = b

Source
util.scala
extension [M <: Int, N <: Int](m: Matrix[M, N])(m: Matrix[M, N])(using ValueOf[M], ValueOf[N], ValueOf[Min[M, N]], M >= N =:= true)
def cond: Double

Matrix condition (2 norm)

Matrix condition (2 norm)

Attributes

Returns

ratio of largest to smallest singular value.

Source
util.scala
def leftInverse: Matrix[N, M]

Solve b * m = I[N, N] m = Matrix[M, N] with M > N and Rank = N, has a left inverse b = Matrix[N, M] such that b * m = I[N, N]

Solve b * m = I[N, N] m = Matrix[M, N] with M > N and Rank = N, has a left inverse b = Matrix[N, M] such that b * m = I[N, N]

Attributes

Returns

b = Matrix[N, M] the Left Inverse of Matrix m.

Source
util.scala
def norm2: Double

Two norm

Two norm

Attributes

Returns

maximum singular value.

Source
util.scala
def rank: Int

Matrix rank

Matrix rank

Attributes

Returns

effective numerical rank, obtained from SV.

Source
util.scala
extension [M <: Int, N <: Int](m: Matrix[M, N])(m: Matrix[M, N])(using ValueOf[M], ValueOf[N], ValueOf[Min[M, N]], N > M =:= true)
def rightInverse(using ValueOf[Min[M, M]]): Matrix[N, M]

m = Matrix[M, N] with M < N and Rank = M, has a right inverse b = Matrix[N, M] such that m * b = Identity[M, M]

m = Matrix[M, N] with M < N and Rank = M, has a right inverse b = Matrix[N, M] such that m * b = Identity[M, M]

Attributes

Returns

the Right Inverse of Matrix a.

Source
util.scala
extension [N <: Int](thisVector: Vec[N])(thisVector: Vec[N])(using ValueOf[N])
inline def *[M <: Int](thatMatrix: Matrix[N, M])(using ValueOf[M]): Matrix[1, M]

Attributes

Source
util.scala
inline def asColumnMatrix: Matrix[N, 1]

Attributes

Source
util.scala
inline def asRowMatrix: Matrix[1, N]

Attributes

Source
util.scala
def times[M <: Int](thatMatrix: Matrix[N, M])(using ValueOf[M]): Matrix[1, M]

Attributes

Source
util.scala