Matrix

slash.matrix.Matrix
See theMatrix companion class
object Matrix

This library is fundamentally an adaptation of the Java Matrix library, JaMa, by MathWorks Inc. and the National Institute of Standards and Technology.

Attributes

Companion
class
Source
Matrix.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Matrix.type

Members list

Value members

Concrete methods

def apply[M <: Int, N <: Int](arr2d: NArray[Vec[N]])(using ValueOf[M], ValueOf[N]): Matrix[M, N]

Construct a matrix from a 2-D array.

Construct a matrix from a 2-D array.

Value parameters

arr2d

Two-dimensional array of doubles. arr2d(row)(column).

Attributes

Throws
IllegalArgumentException

All rows must have the same length

Source
Matrix.scala
def apply[M <: Int, N <: Int](values: DoubleArray)(using ValueOf[M], ValueOf[N]): Matrix[M, N]

Construct a matrix by copying a one-dimensional packed array

Construct a matrix by copying a one-dimensional packed array

Value parameters

A

Number of rows.

values

One-dimensional array of doubles, packed by rows.

Attributes

Throws
IllegalArgumentException

Array length must be a multiple of A.

Source
Matrix.scala
inline def copyFrom[M <: Int, N <: Int](values: DoubleArray)(using ValueOf[M], ValueOf[N]): Matrix[M, N]

Construct a matrix from a copy of an array.

Construct a matrix from a copy of an array.

Value parameters

values

array of doubles.

Attributes

Throws
IllegalArgumentException

All rows must have the same length

Source
Matrix.scala
def diagonal[M <: Int, N <: Int](value: Double)(using ValueOf[M], ValueOf[N]): Matrix[M, N]

Generate identity matrix scaled by value parameter.

Generate identity matrix scaled by value parameter.

Value parameters

columns

Number of colums.

rows

Number of rows.

value

scalar multiplier.

Attributes

Returns

An MxN matrix with ones on the diagonal and zeros elsewhere.

Source
Matrix.scala
def diagonal[D <: Int](v: Vec[D])(using ValueOf[D]): Matrix[D, D]

Generate a square matrix with the supplied vector along the diagonal.

Generate a square matrix with the supplied vector along the diagonal.

Value parameters

v

a vector

Attributes

Source
Matrix.scala
def diagonal[M <: Int, N <: Int, D <: Int](v: Vec[D])(using ValueOf[M], ValueOf[N], ValueOf[D]): Matrix[M, N]

Attributes

Source
Matrix.scala
def fill[M <: Int, N <: Int](value: Double)(using ValueOf[M], ValueOf[N]): Matrix[M, N]

Construct an MxN constant matrix.

Construct an MxN constant matrix.

Type parameters

M

the number of rows

N

the number of columns

Value parameters

value

Fill the matrix with this scalar value.

Attributes

Returns

an MxN constant matrix.

Source
Matrix.scala
def identity[M <: Int, N <: Int](using ValueOf[M], ValueOf[N]): Matrix[M, N]

Generate identity matrix

Generate identity matrix

Type parameters

M

the number of rows

N

the number of columns

Attributes

Returns

An MxN matrix with ones on the diagonal and zeros elsewhere.

Source
Matrix.scala
def ones[M <: Int, N <: Int](using ValueOf[M], ValueOf[N]): Matrix[M, N]

Construct an MxN matrix of ones.

Construct an MxN matrix of ones.

Type parameters

M

the number of rows

N

the number of columns

Attributes

Source
Matrix.scala
inline def random[M <: Int, N <: Int](r: Random)(using ValueOf[M], ValueOf[N]): Matrix[M, N]

Generates an MxN matrix which consists of elements randomized between [-1.0, 1.0] inclusive.

Generates an MxN matrix which consists of elements randomized between [-1.0, 1.0] inclusive.

Type parameters

M

the number of rows

N

the number of columns

Value parameters

r

optional random instance.

Attributes

Returns

An MxN matrix with uniformly distributed random elements.

Source
Matrix.scala
inline def random[M <: Int, N <: Int](minNorm: Double, normMAX: Double)(using ValueOf[M], ValueOf[N]): Matrix[M, N]

Generate matrix with random elements

Generate matrix with random elements

Type parameters

M

the number of rows

N

the number of columns

Value parameters

minNorm

Minimum random generated value allowed, inclusive.

normMAX

Maximum random generated value allowed, inclusive.

Attributes

Returns

An MxN matrix with uniformly distributed random elements.

Source
Matrix.scala
inline def random[M <: Int, N <: Int](minNorm: Double, normMAX: Double, r: Random)(using ValueOf[M], ValueOf[N]): Matrix[M, N]

Generate matrix with random elements

Generate matrix with random elements

Type parameters

M

the number of rows

N

the number of columns

Value parameters

minNorm

Minimum random generated value allowed, inclusive.

normMAX

Maximum random generated value allowed, inclusive.

r

optional random instance.

Attributes

Returns

An MxN matrix with uniformly distributed random elements.

Source
Matrix.scala
def random[M <: Int, N <: Int](interval: Interval[Double], r: Random)(using ValueOf[M], ValueOf[N]): Matrix[M, N]

Generate matrix with random elements

Generate matrix with random elements

Type parameters

M

the number of rows

N

the number of columns

Value parameters

interval

from which to draw matrix component values.

r

optional random instance.

Attributes

Returns

An MxN matrix with uniformly distributed random elements.

Source
Matrix.scala
def zeros[M <: Int, N <: Int](using ValueOf[M], ValueOf[N]): Matrix[M, N]

Construct an MxN matrix of zeros.

Construct an MxN matrix of zeros.

Type parameters

M

the number of rows

N

the number of columns

Attributes

Source
Matrix.scala