Mat

slash.matrix.Mat
See theMat companion class
object Mat

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

Attributes

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

Members list

Type members

Types

type ColSize[T <: Tuple] = T match { case EmptyTuple => 0 case h *: _$2 => TupleSize[h] }

Attributes

Source
Mat.scala
type IsSingleton[T] = T match { case Singleton => true case Any => false }

Attributes

Source
Mat.scala
type Number = Int | Float | Long | Double

Attributes

Source
Mat.scala
type Prod[A <: Int, B <: Int] = A match { case 0 => 0 case S[aMinus1] => B + Prod[aMinus1, B] }

Attributes

Source
Mat.scala
type RowSize[T <: Tuple] = T match { case EmptyTuple => 0 case h *: t => S[RowSize[t]] }

Attributes

Source
Mat.scala
type TupleSize[T <: Tuple] = T match { case EmptyTuple => 0 case h *: t => S[TupleSize[t]] case Any => 1 }

Attributes

Source
Mat.scala

Value members

Concrete methods

def apply[M <: Int, N <: Int](arr2d: Array[Vec[N]])(using ValueOf[M], ValueOf[N]): Mat[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
Mat.scala
def apply[M <: Int, N <: Int](values: Array[Double])(using ValueOf[M], ValueOf[N]): Mat[M, N]

Construct a matrix from a one-dimensional packed array

Construct a matrix from a one-dimensional packed array

Type parameters

M

the number of rows

N

the number of columns

Value parameters

values

One-dimensional array of doubles, packed by rows.

Attributes

Throws
IllegalArgumentException

NArray length must equal M * N

Source
Mat.scala
def apply[M <: Int, N <: Int](values: Double*)(using ValueOf[M], ValueOf[N]): Mat[M, N]

Type parameters

M

the number of rows

N

the number of columns

Value parameters

values

the matrix elements.

Attributes

Returns

an M x N matrix consisting of values.

Source
Mat.scala
transparent inline def apply[M <: Int, N <: Int](tuparg: Tuple)(using ValueOf[M], ValueOf[N]): Mat[M, N]

Construct a Mat from a tuple literal. ((a,b,c...),(d,e,f,...),...). << nested tuple fields define rows (a,b,c...). << fields of single tuple define columns

Construct a Mat from a tuple literal. ((a,b,c...),(d,e,f,...),...). << nested tuple fields define rows (a,b,c...). << fields of single tuple define columns

if nested tuples share the same arity tuple Numeric fields converted to type Double non-numeric fields, if present converted to Double.NaN

Value parameters

tuparg

Tuple of Doubles or Tuple of Tuple of Double

Attributes

Returns

an M x N matrix consisting of values.

Throws
IllegalArgumentException

on non-numeric fields.

Source
Mat.scala
inline def apply[M <: Int, N <: Int](inline content: String)(using ValueOf[M], ValueOf[N]): Mat[M, N]

Construct a Mat from a String.

Construct a Mat from a String.

Type parameters

M

the number of rows

N

the number of columns

Value parameters

content

a String with rows of delimited numeric columns.

Attributes

Returns

an M x N matrix

Source
Mat.scala
inline def copyFrom[M <: Int, N <: Int](values: Array[Double])(using ValueOf[M], ValueOf[N]): Mat[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
Mat.scala
def diagonal[M <: Int, N <: Int](value: Double)(using ValueOf[M], ValueOf[N]): Mat[M, N]

Generate identity matrix scaled by value parameter.

Generate identity matrix scaled by value parameter.

Type parameters

M

number of rows.

N

number of columns.

Value parameters

value

scalar multiplier

x$2

implicit

x$3

implicit

Attributes

Returns

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

Source
Mat.scala
def diagonal[D <: Int](v: Vec[D])(using ValueOf[D]): Mat[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
Mat.scala
def diagonal[M <: Int, N <: Int, D <: Int](v: Vec[D])(using ValueOf[M], ValueOf[N], ValueOf[D]): Mat[M, N]

Attributes

Source
Mat.scala
inline def dims[T <: Tuple](inline tup: T): (Int, Int)

Attributes

Source
Mat.scala
inline def dmFix[N <: Int, M <: Int](inline m: AnyRef)(using ValueOf[M], ValueOf[N]): Mat[M, N]

Attributes

Source
Mat.scala
def fill[M <: Int, N <: Int](value: Double)(using ValueOf[M], ValueOf[N]): Mat[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
Mat.scala
inline def fromString(inline content: String): Mat[_ <: Int, _ <: Int]

Construct a Mat from a String.

Construct a Mat from a String.

Value parameters

content

a String with rows of delimited numeric columns.

Attributes

Returns

an M x N matrix

Source
Mat.scala
transparent inline def fromTuples[M <: Int, N <: Int](tuprows: Tuple*)(using ValueOf[M], ValueOf[N]): Mat[M, N]

Construct a Mat from a sequence of 2 or more Tuple literals. ((a,b,c...),(d,e,f,...),...).

Construct a Mat from a sequence of 2 or more Tuple literals. ((a,b,c...),(d,e,f,...),...).

Where: inner row tuples share the same arity tuple Numeric fields converted to type Double non-numeric fields, if present converted to Double.NaN

Value parameters

tuprows

a series of tuples, each representing a row.

Attributes

Returns

an M x N matrix consisting of values.

Source
Mat.scala
def identity[M <: Int, N <: Int](using ValueOf[M], ValueOf[N]): Mat[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
Mat.scala
def ones[M <: Int, N <: Int](using ValueOf[M], ValueOf[N]): Mat[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
Mat.scala
inline def random[M <: Int, N <: Int](using ValueOf[M], ValueOf[N]): Mat[M, N]

Construct a matrix of random values.

Construct a matrix of random values.

Attributes

Source
Mat.scala
inline def random[M <: Int, N <: Int](r: Random)(using ValueOf[M], ValueOf[N]): Mat[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
Mat.scala
inline def random[M <: Int, N <: Int](minNorm: Double, normMAX: Double)(using ValueOf[M], ValueOf[N]): Mat[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
Mat.scala
inline def random[M <: Int, N <: Int](minNorm: Double, normMAX: Double, r: Random)(using ValueOf[M], ValueOf[N]): Mat[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
Mat.scala
def random[M <: Int, N <: Int](interval: Interval[Double], r: Random)(using ValueOf[M], ValueOf[N]): Mat[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
Mat.scala
inline def sameSpace[M <: Int, N <: Int, P <: Int, Q <: Int](mat1: Mat[M, N], mat2: Mat[P, Q]): Boolean

Attributes

Source
Mat.scala
inline def toDouble(inline num: Number): Double

Attributes

Source
Mat.scala
def zeros[M <: Int, N <: Int](using ValueOf[M], ValueOf[N]): Mat[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
Mat.scala

Extensions

Extensions

extension (d: Double)
def *[M <: Int, N <: Int](m: Mat[M, N]): Mat[M, N]

Attributes

Source
Mat.scala