MatrixD

scalation.mathstat.MatrixD
See theMatrixD companion object
class MatrixD(val dim: Int, val dim2: Int, var v: Array[Array[Double]])

The MatrixD class stores and operates on Numeric Matrices of base type Double. the 'cfor' loop is used for innermost loops for faster execution.

Value parameters

dim

the first (row) dimension of the matrix

dim2

the second (column) dimension of the matrix

v

the 2D array used to store matrix elements

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class VMatrixD

Members list

Value members

Concrete methods

def *(y: MatrixD): MatrixD

Multiply this matrix and matrix y (requires y to have at least the dimensions of this). Alias rows to avoid double subscripting, use tiling/blocking, and optimized i, k, j loop order.

Multiply this matrix and matrix y (requires y to have at least the dimensions of this). Alias rows to avoid double subscripting, use tiling/blocking, and optimized i, k, j loop order.

Value parameters

y

the other matrix

Attributes

See also

software.intel.com/content/www/us/en/develop/documentation/advisor-cookbook/top/ optimize-memory-access-patterns-using-loop-interchange-and-cache-blocking-techniques.html

def *(y: VectorD): VectorD

Multiply this matrix and vector y (requires y to have at least dim2 elements). Alias rows to avoid double subscripting and use array ops.

Multiply this matrix and vector y (requires y to have at least dim2 elements). Alias rows to avoid double subscripting and use array ops.

Value parameters

y

the vector to multiply by

Attributes

def *(u: Double): MatrixD

Multiply this matrix and scaler u.

Multiply this matrix and scaler u.

Value parameters

u

the scalar to multiply by

Attributes

def *:(y: VectorD): VectorD

Multiply (row) vector y by this matrix. Note '*:' is right associative. vector = vector *: matrix

Multiply (row) vector y by this matrix. Note '*:' is right associative. vector = vector *: matrix

Value parameters

y

the vector to multiply by

Attributes

def *=(u: Double): MatrixD

Multiply (in-place) this matrix and scaler u.

Multiply (in-place) this matrix and scaler u.

Value parameters

u

the scalar to multiply by

Attributes

def *~(y: MatrixD): MatrixD

Multiply element-wise, this matrix and matrix y (requires y to have at least the dimensions of this). Alias rows to avoid double subscripting. Also known as Hadamard product.

Multiply element-wise, this matrix and matrix y (requires y to have at least the dimensions of this). Alias rows to avoid double subscripting. Also known as Hadamard product.

Value parameters

y

the other matrix

Attributes

def *~(u: VectorD): MatrixD

Multiply this matrix by vector u to produce another matrix v_ij * u_j. E.g., multiply a matrix by a diagonal matrix represented as a vector.

Multiply this matrix by vector u to produce another matrix v_ij * u_j. E.g., multiply a matrix by a diagonal matrix represented as a vector.

Value parameters

u

the vector to multiply by

Attributes

def *~:(u: VectorD): MatrixD

Multiply vector u by this matrix to produce another matrix u_i * v_ij. E.g., multiply a diagonal matrix represented as a vector by a matrix. This operator is right associative (vector *~: matrix).

Multiply vector u by this matrix to produce another matrix u_i * v_ij. E.g., multiply a diagonal matrix represented as a vector by a matrix. This operator is right associative (vector *~: matrix).

Value parameters

u

the vector to multiply by

Attributes

def +(y: MatrixD): MatrixD

Add this matrix and matrix y (requires y to have at least the dimensions of this). Alias rows to avoid double subscripting.

Add this matrix and matrix y (requires y to have at least the dimensions of this). Alias rows to avoid double subscripting.

Value parameters

y

the other matrix

Attributes

def +(u: VectorD): MatrixD

Add this matrix and (row) vector u.

Add this matrix and (row) vector u.

Value parameters

u

the vector to add

Attributes

def +(u: Double): MatrixD

Add this matrix and scaler u.

Add this matrix and scaler u.

Value parameters

u

the scalar to add

Attributes

def ++(y: MatrixD): MatrixD

Concatenate (row-wise) this matrix and matrix y (requires y to have the same column dimension as this).

Concatenate (row-wise) this matrix and matrix y (requires y to have the same column dimension as this).

Value parameters

y

the other matrix

Attributes

def ++^(y: MatrixD): MatrixD

Concatenate (column-wise) this matrix and matrix y (requires y to have the same row dimension as this).

Concatenate (column-wise) this matrix and matrix y (requires y to have the same row dimension as this).

Value parameters

y

the other matrix

Attributes

def +:(u: VectorD): MatrixD

Concatenate (row) vector u and this matrix, i.e., prepend u to this.

Concatenate (row) vector u and this matrix, i.e., prepend u to this.

Value parameters

u

the vector to be prepended as the new first row in new matrix

Attributes

def +=(y: MatrixD): MatrixD

Add (in-place) this matrix and matrix y (requires y to have at least the dimensions of this). Alias rows to avoid double subscripting.

Add (in-place) this matrix and matrix y (requires y to have at least the dimensions of this). Alias rows to avoid double subscripting.

Value parameters

y

the other matrix

Attributes

def +=(u: Double): MatrixD

Add (in-place) this matrix and scaler u.

Add (in-place) this matrix and scaler u.

Value parameters

u

the scalar to add

Attributes

def +^(u: VectorD): MatrixD

Add this matrix and (column) vector u.

Add this matrix and (column) vector u.

Value parameters

u

the vector to add

Attributes

def +^:(u: VectorD): MatrixD

Concatenate (column) vector u and this matrix, i.e., prepend u to this.

Concatenate (column) vector u and this matrix, i.e., prepend u to this.

Value parameters

u

the vector to be prepended as the new first column in new matrix

Attributes

def -(y: MatrixD): MatrixD

Subtract from this matrix the matrix y (requires y to have at least the dimensions of this). Alias rows to avoid double subscripting.

Subtract from this matrix the matrix y (requires y to have at least the dimensions of this). Alias rows to avoid double subscripting.

Value parameters

y

the other matrix

Attributes

def -(u: VectorD): MatrixD

Subtract from this matrix, the (row) vector u.

Subtract from this matrix, the (row) vector u.

Value parameters

u

the vector to subtract

Attributes

def -(u: Double): MatrixD

Subtract from this matrix, the scalar u.

Subtract from this matrix, the scalar u.

Value parameters

u

the scalar to subtract

Attributes

def -=(y: MatrixD): MatrixD

Subtract (in-place) from this matrix the matrix y (requires y to have at least the dimensions of this). Alias rows to avoid double subscripting.

Subtract (in-place) from this matrix the matrix y (requires y to have at least the dimensions of this). Alias rows to avoid double subscripting.

Value parameters

y

the other matrix

Attributes

def -=(u: Double): MatrixD

Subtract (in-place) from this matrix, the scalar u.

Subtract (in-place) from this matrix, the scalar u.

Value parameters

u

the scalar to subtract

Attributes

def -^(u: VectorD): MatrixD

Subtract from this matrix, the (column) vector u.

Subtract from this matrix, the (column) vector u.

Value parameters

u

the vector to subtract

Attributes

def /(y: MatrixD): MatrixD

Divide element-wise, this matrix by matrix y (requires y to have at least the dimensions of this). Alias rows to avoid double subscripting.

Divide element-wise, this matrix by matrix y (requires y to have at least the dimensions of this). Alias rows to avoid double subscripting.

Value parameters

y

the other matrix

Attributes

def /(u: VectorD): MatrixD

Divide element-wise, this matrix by (row) vector u.

Divide element-wise, this matrix by (row) vector u.

Value parameters

u

the vector to divide by

Attributes

def /(u: Double): MatrixD

Divide element-wise this matrix by scaler u.

Divide element-wise this matrix by scaler u.

Value parameters

u

the scalar to divide by

Attributes

def /=(u: Double): MatrixD

Divide (in-place) element-wise this matrix by scaler u.

Divide (in-place) element-wise this matrix by scaler u.

Value parameters

u

the scalar to divide by

Attributes

def /~(y: VectorD): VectorD

Solve for x using back substitution (/~) in the equation u * x = y where this matrix (u) must be upper triangular.

Solve for x using back substitution (/~) in the equation u * x = y where this matrix (u) must be upper triangular.

Value parameters

y

the constant vector

Attributes

See also

MatLab's / operator

def :+(u: VectorD): MatrixD

Concatenate this matrix and (row) vector u, i.e., append u to this.

Concatenate this matrix and (row) vector u, i.e., append u to this.

Value parameters

u

the vector to be appended as the new last row in new matrix

Attributes

def :^+(u: VectorD): MatrixD

Concatenate this matrix and (column) vector u, i.e., append u to this.

Concatenate this matrix and (column) vector u, i.e., append u to this.

Value parameters

u

the vector to be appended as the new last column in new matrix

Attributes

def =~(y: MatrixD): Boolean

Determine whether this matrix and matrix y are nearly equal.

Determine whether this matrix and matrix y are nearly equal.

Value parameters

y

the other matrix

Attributes

def apply(i: Int, j: Int): Double

Return the ELEMENT in row i, column j of this matrix. usage: x(3, 2)

Return the ELEMENT in row i, column j of this matrix. usage: x(3, 2)

Value parameters

i

the row index

j

the column index

Attributes

def apply(ir: Range, jr: Range): MatrixD

Return the intersection of the ROWS in range ir and COLUMNS in range jr of this matrix as a new independent matrix. usage: x(3 to 6, 2 to 4)

Return the intersection of the ROWS in range ir and COLUMNS in range jr of this matrix as a new independent matrix. usage: x(3 to 6, 2 to 4)

Value parameters

ir

the index range of rows to return

jr

the index range of columns to return

Attributes

inline def apply(i: Int): VectorD

Return the actual i-th ROW of this matrix. usage: x(3)

Return the actual i-th ROW of this matrix. usage: x(3)

Value parameters

i

the row index

Attributes

def apply(ir: Range): MatrixD

Return the ROWS in range ir of this matrix as a new independent matrix. usage: x(3 to 6)

Return the ROWS in range ir of this matrix as a new independent matrix. usage: x(3 to 6)

Value parameters

ir

the index range of rows to return

Attributes

def apply(ir: Range, j: Int): VectorD

Return the ROWS in range ir of this matrix for column j as a vector. usage: x(3 to 6)

Return the ROWS in range ir of this matrix for column j as a vector. usage: x(3 to 6)

Value parameters

ir

the index range of rows to return

j

the column index

Attributes

def apply(iset: Set[Int]): MatrixD

Return the ROWS in index set iset of this matrix as a new independent matrix. usage: x(Set (3, 5, 7))

Return the ROWS in index set iset of this matrix as a new independent matrix. usage: x(Set (3, 5, 7))

Value parameters

iset

the index set of rows to return

Attributes

def apply(idx: IndexedSeq[Int]): MatrixD

Return the ROWS in index sequence idx of this matrix as a new independent matrix. usage: x(Array (3, 5, 7))

Return the ROWS in index sequence idx of this matrix as a new independent matrix. usage: x(Array (3, 5, 7))

Value parameters

idx

the index sequence of rows to return

Attributes

def apply(idx: IndexedSeq[Int]): MatrixD
def apply(idx: Array[Int]): MatrixD
inline def apply(all: Char, j: Int): VectorD

Return the j-th COLUMN of this matrix as an independent vector. usage: x(?, 2)

Return the j-th COLUMN of this matrix as an independent vector. usage: x(?, 2)

Value parameters

all

use the all rows indicator ?

j

the column index

Attributes

def apply(all: Char, jr: Range): MatrixD

Return the COLUMNS in range jr of this matrix as a new independent matrix. usage: x(?, 2 to 4)

Return the COLUMNS in range jr of this matrix as a new independent matrix. usage: x(?, 2 to 4)

Value parameters

all

use the all rows indicator ?

jr

the index range of columns to return

Attributes

def apply(all: Char, jset: Set[Int]): MatrixD

Return the COLUMNS in index set jset of this matrix as a new independent matrix. usage: x(?, Set (2, 4, 6))

Return the COLUMNS in index set jset of this matrix as a new independent matrix. usage: x(?, Set (2, 4, 6))

Value parameters

all

use the all rows indicator ?

jset

the index set of columns to return

Attributes

def apply(all: Char, jdx: IndexedSeq[Int]): MatrixD

Return the COLUMNS in index sequence jdx of this matrix as a new independent matrix. usage: x(?, Array (2, 4, 6))

Return the COLUMNS in index sequence jdx of this matrix as a new independent matrix. usage: x(?, Array (2, 4, 6))

Value parameters

all

use the all rows indicator ?

jdx

the index set of columns to return

Attributes

inline def apply(diag: Char): VectorD

Return the main DIAGONAL of this matrix as a new independent vector. usage: x(?)

Return the main DIAGONAL of this matrix as a new independent vector. usage: x(?)

Value parameters

diag

use the all diagonal elements indicator ?

Attributes

def center(mu_x: VectorD): MatrixD

Center this matrix to zero mean, column-wise, by subtracting the mean.

Center this matrix to zero mean, column-wise, by subtracting the mean.

Value parameters

mu_x

the vector of column means for this matrix

Attributes

def col(col: Int, from: Int): VectorD

Get column col from the matrix, returning it as a vector.

Get column col from the matrix, returning it as a vector.

Value parameters

col

the column to extract from the matrix

from

the position to start extracting from

Attributes

def copy: MatrixD

Return a deep copy of this matrix (note: clone may not be deep). Uses Java's native Arrays.copyOf for efficient copying of 2D array.

Return a deep copy of this matrix (note: clone may not be deep). Uses Java's native Arrays.copyOf for efficient copying of 2D array.

Attributes

def corr: MatrixD

Return the correlation matrix for the columns of this matrix. If either variance is zero (column i, column j), will result in Not-a-Number (NaN), return one if the vectors are the same, or -0 (indicating undefined). Note: sample vs. population results in essentially the same values.

Return the correlation matrix for the columns of this matrix. If either variance is zero (column i, column j), will result in Not-a-Number (NaN), return one if the vectors are the same, or -0 (indicating undefined). Note: sample vs. population results in essentially the same values.

Attributes

See also

the related cos function

def corr(y: VectorD, skip: Int): VectorD

Return the correlation vector for the columns of this matrix with vector y.

Return the correlation vector for the columns of this matrix with vector y.

Value parameters

skip

the number of initial columns to skip (e.g., first column of all ones)

y

the vector to compute correlations with

Attributes

def cos: MatrixD

Return the cosine similarity matrix for the columns of matrix 'x'. If the vectors are centered, will give the correlation.

Return the cosine similarity matrix for the columns of matrix 'x'. If the vectors are centered, will give the correlation.

Attributes

See also

stats.stackexchange.com/questions/97051/] building-the-connection-between-cosine-similarity-and-correlation-in-r

def cov: MatrixD

Return the sample covariance matrix for the columns of this matrix.

Return the sample covariance matrix for the columns of this matrix.

Attributes

def cov_: MatrixD

Return the population covariance matrix for the columns of this matrix.

Return the population covariance matrix for the columns of this matrix.

Attributes

Multiply each column of this matrix by its other columns to forms a matrix consisting of all 2-way cross terms [ x_i * x_j ] for j < i.

Multiply each column of this matrix by its other columns to forms a matrix consisting of all 2-way cross terms [ x_i * x_j ] for j < i.

Attributes

Multiply each column of this matrix by its other two columns to forms a matrix consisting of all 3-way cross terms [ x_i * x_j * x_k ] for k < j < i.

Multiply each column of this matrix by its other two columns to forms a matrix consisting of all 3-way cross terms [ x_i * x_j * x_k ] for k < j < i.

Attributes

infix def diag(b: MatrixD): MatrixD

Combine this matrix with matrix b, placing them along the diagonal and filling in the bottom left and top right regions with zeros; [this, b].

Combine this matrix with matrix b, placing them along the diagonal and filling in the bottom left and top right regions with zeros; [this, b].

Value parameters

b

the matrix to combine with this matrix

Attributes

inline def dims: (Int, Int)

Return the row and column dimensions of this matrix.

Return the row and column dimensions of this matrix.

Attributes

infix def dot(y: MatrixD): MatrixD

Return the dot product of this matrix and matrix y (requires y to have at least the dimensions of this). Alias rows to avoid double subscripting, use tiling/blocking, and use array ops.

Return the dot product of this matrix and matrix y (requires y to have at least the dimensions of this). Alias rows to avoid double subscripting, use tiling/blocking, and use array ops.

Value parameters

y

the other matrix

Attributes

See also

en.wikipedia.org/wiki/Matrix_multiplication_algorithm

infix def dot(y: VectorD): VectorD

Return the dot product of this matrix and vector y.

Return the dot product of this matrix and vector y.

Value parameters

y

the vector to take the dot product with

Attributes

Flatten this matrix in row-major fashion, returning a vector containing all the elements from the matrix.

Flatten this matrix in row-major fashion, returning a vector containing all the elements from the matrix.

Attributes

def insert(j: Int, k: Int, u: VectorD): Unit

Insert vector u into this matrix at j-th COLUMN after shifting j ... k-1 right.

Insert vector u into this matrix at j-th COLUMN after shifting j ... k-1 right.

Value parameters

j

the start column index [... j ... k k+1 ... ] -->

k

the end column index [... u j ... k+1 ... ]

u

the vector to insert into column j

Attributes

Return the inverse of this matrix using the inverse method in the Fac_LU object. Note, other factorizations also compute the inverse.

Return the inverse of this matrix using the inverse method in the Fac_LU object. Note, other factorizations also compute the inverse.

Attributes

See also

Fac_Inv, Fac_Cholesky, Fac-QR.

def isNonnegative: Boolean

Return whether this matrix is non-negative (has no elements less than 0).

Return whether this matrix is non-negative (has no elements less than 0).

Attributes

def isSymmetric: Boolean

Return whether this matrix is symmetric (i.e, equals its transpose).

Return whether this matrix is symmetric (i.e, equals its transpose).

Attributes

def lower: MatrixD

Return the dim-by-dim2 lower triangle of this matrix (rest are zero).

Return the dim-by-dim2 lower triangle of this matrix (rest are zero).

Attributes

Map each row of this matrix by applying function f to each row vector and returning the collected result as a vector.

Map each row of this matrix by applying function f to each row vector and returning the collected result as a vector.

Value parameters

f

the vector to scalar function to apply

Attributes

def max: VectorD

Return the maximum value for each column in the matrix.

Return the maximum value for each column in the matrix.

Attributes

def mean: VectorD

Compute the column means of this matrix.

Compute the column means of this matrix.

Attributes

def min: VectorD

Return the minimum value for each column in the matrix.

Return the minimum value for each column in the matrix.

Attributes

Map each row of this matrix by applying function f to each row vector and returning the collected result as a matrix.

Map each row of this matrix by applying function f to each row vector and returning the collected result as a matrix.

Value parameters

f

the vector to vector function to apply

Attributes

def mmax: Double

Return the maximum value for the entire matrix.

Return the maximum value for the entire matrix.

Attributes

def mmin: Double

Return the minimum value for the entire matrix.

Return the minimum value for the entire matrix.

Attributes

infix def mul(y: MatrixD): MatrixD

Multiply this matrix and matrix y (requires y to have at least the dimensions of this). Alias rows to avoid double subscripting, transpose y first and use array ops. A simpler, less efficient version of '*'.

Multiply this matrix and matrix y (requires y to have at least the dimensions of this). Alias rows to avoid double subscripting, transpose y first and use array ops. A simpler, less efficient version of '*'.

Value parameters

y

the other matrix

Attributes

def norm1: Double

Compute the 1-norm of this matrix, i.e., the maximum 1-norm of the column vectors. This is useful for comparing matrices (a - b).norm1.

Compute the 1-norm of this matrix, i.e., the maximum 1-norm of the column vectors. This is useful for comparing matrices (a - b).norm1.

Attributes

See also

en.wikipedia.org/wiki/Matrix_norm

inline def normF: Double

Compute the Frobenius-norm of 'this' matrix, i.e., the square root of the sum of the squared values over all the elements (sqrt (sse)).

Compute the Frobenius-norm of 'this' matrix, i.e., the square root of the sum of the squared values over all the elements (sqrt (sse)).

Attributes

See also

en.wikipedia.org/wiki/Matrix_norm#Frobenius_norm

def normFSq: Double

Compute the square of the Frobenius-norm of this matrix, i.e., the sum of the squared values over all the elements (sse).

Compute the square of the Frobenius-norm of this matrix, i.e., the sum of the squared values over all the elements (sse).

Attributes

def not(i: Int): MatrixD

Return all but the i-th ROW of this matrix as a new independent matrix. usage: x.not(3)

Return all but the i-th ROW of this matrix as a new independent matrix. usage: x.not(3)

Value parameters

i

the row index to exclude

Attributes

def not(idx: IndexedSeq[Int]): MatrixD

Return all but the ROWS in index sequence idx of this matrix as a new independent matrix. usage: x.not(Array (3, 5, 7))

Return all but the ROWS in index sequence idx of this matrix as a new independent matrix. usage: x.not(Array (3, 5, 7))

Value parameters

idx

the index sequence of rows to exclude

Attributes

def not(all: Char, j: Int): MatrixD

Return all but the j-th COLUMN of this matrix as a new independent matrix.. usage: x.not(?, 2)

Return all but the j-th COLUMN of this matrix as a new independent matrix.. usage: x.not(?, 2)

Value parameters

all

use the all rows indicator ?

j

the column index to exclude

Attributes

Return a matrix that is in the reverse row order of this matrix.

Return a matrix that is in the reverse row order of this matrix.

Attributes

def set(i: Int, u: VectorD): Unit

Set this matrix's i-th ROW to the elements in vector u. May have left-over elements in row unassigned.

Set this matrix's i-th ROW to the elements in vector u. May have left-over elements in row unassigned.

Value parameters

i

the row index

u

the vector value to assign

Attributes

def setAll(s: Double): Unit

Set all the elements of this ENTIRE matrix to the scalar s.

Set all the elements of this ENTIRE matrix to the scalar s.

Value parameters

s

the scalar value to assign

Attributes

def setCol(j: Int, s: Double): Unit

Set all the elements in the j-th COLUMN of this matrix to the scalar s.

Set all the elements in the j-th COLUMN of this matrix to the scalar s.

Value parameters

j

the column index

s

the scalar value to assign

Attributes

def setDiag(u: VectorD, k: Int): Unit

Set the k-th DIAGONAL of this matrix to the elements in vector u.

Set the k-th DIAGONAL of this matrix to the elements in vector u.

Value parameters

k

how far above the main diagonal, e.g., (-1, 0, 1) for (sub, main, super)

u

the vector to set the diagonal to

Attributes

def showDiff(y: MatrixD): Unit

Show how this matrix and matrix y differ, the first element and row that differ.

Show how this matrix and matrix y differ, the first element and row that differ.

Value parameters

y

the other matrix

Attributes

def split(idx: Set[Int]): (MatrixD, MatrixD)

Split the rows from this matrix to form two matrices: one from the rows in idx (e.g., testing set) and the other from rows not in idx (e.g., training set). Note split and split_ produce different row orders.

Split the rows from this matrix to form two matrices: one from the rows in idx (e.g., testing set) and the other from rows not in idx (e.g., training set). Note split and split_ produce different row orders.

Value parameters

idx

the set of row indices to include/exclude

Attributes

inline def split(idx: IndexedSeq[Int]): (MatrixD, MatrixD)
def split_(idx: IndexedSeq[Int]): (MatrixD, MatrixD)

Split the rows from this matrix to form two matrices: one from the rows in idx (e.g., testing set) and the other from rows not in idx (e.g., training set). Concise, but less efficient than split.

Split the rows from this matrix to form two matrices: one from the rows in idx (e.g., testing set) and the other from rows not in idx (e.g., training set). Concise, but less efficient than split.

Value parameters

idx

the row indices to include/exclude

Attributes

def stdev: VectorD

Compute the column standard deviations of this matrix.

Compute the column standard deviations of this matrix.

Attributes

def sum: Double

Compute the sum of this matrix, i.e., the sum of all its elements.

Compute the sum of this matrix, i.e., the sum of all its elements.

Attributes

def sumV: VectorD

Compute the column sums of this matrix, i.e., the sums for each of its columns.

Compute the column sums of this matrix, i.e., the sums for each of its columns.

Attributes

def sumVr: VectorD

Compute the row sums of this matrix, i.e., the sums for each of its rows.

Compute the row sums of this matrix, i.e., the sums for each of its rows.

Attributes

def swap(i: Int, k: Int): Unit

Swap (in-place) rows i and k in this matrix.

Swap (in-place) rows i and k in this matrix.

Value parameters

i

the first row in the swap

k

the second row in the swap

Attributes

def swap(i: Int, k: Int, col: Int): Unit

Swap (in-place) the elements in rows i and k starting from column col.

Swap (in-place) the elements in rows i and k starting from column col.

Value parameters

col

the starting column for the swap

i

the first row in the swap

k

the second row in the swap

Attributes

def swapCol(j: Int, l: Int): Unit

Swap (in-place) columns j and l in this matrix.

Swap (in-place) columns j and l in this matrix.

Value parameters

j

the first column in the swap

l

the second column in the swap

Attributes

def toInt: MatrixD

Convert this matrix to a matrix where all the elements have integer values.

Convert this matrix to a matrix where all the elements have integer values.

Attributes

Convert this matrix to the same matrix, i.e., return this matrix.

Convert this matrix to the same matrix, i.e., return this matrix.

Attributes

override def toString: String

Convert this matrix to a string.

Convert this matrix to a string.

Attributes

Definition Classes
Any
def trace: Double

Compute the trace of this matrix, i.e., the sum of the elements on the main diagonal. Should also equal the sum of the eigenvalues.

Compute the trace of this matrix, i.e., the sum of the elements on the main diagonal. Should also equal the sum of the eigenvalues.

Attributes

See also

Eigen.scala

Transpose this matrix (swap columns <=> rows). Note: new MatrixD (dim2, dim, v.transpose) does not work when a dimension is 0.

Transpose this matrix (swap columns <=> rows). Note: new MatrixD (dim2, dim, v.transpose) does not work when a dimension is 0.

Attributes

Return the negative of this matrix (unary minus).

Return the negative of this matrix (unary minus).

Attributes

inline def update(i: Int, j: Int, s: Double): Unit

Update the ELEMENT in row i, column j of this matrix. usage: x(i, j) = 5

Update the ELEMENT in row i, column j of this matrix. usage: x(i, j) = 5

Value parameters

i

the row index

j

the column index

s

the scalar value to assign

Attributes

inline def update(i: Int, u: VectorD): Unit

Update the elements in the i-th ROW of this matrix. usage: x(i) = u

Update the elements in the i-th ROW of this matrix. usage: x(i) = u

Value parameters

i

the row index

u

the vector to assign

Attributes

def update(all: Char, j: Int, u: VectorD): Unit

Update the elements in the j-th COLUMN of this matrix. usage: x(?, 2) = u

Update the elements in the j-th COLUMN of this matrix. usage: x(?, 2) = u

Value parameters

all

use the all rows indicator ?

j

the column index

u

the vector to assign

Attributes

def update(d1: Char, d2: Char, s: Double): Unit

Update the main DIAGONAL of this matrix according to the given scalar. usage: x(?, ?) = 5

Update the main DIAGONAL of this matrix according to the given scalar. usage: x(?, ?) = 5

Value parameters

d1

use the all diagonal elements indicator ?

d2

use the all diagonal elements indicator ?

s

the scalar value to assign

Attributes

def update(d1: Char, d2: Char, u: VectorD): Unit

Update the main DIAGONAL of this matrix according to the given vector. usage: x(?, ?) = u

Update the main DIAGONAL of this matrix according to the given vector. usage: x(?, ?) = u

Value parameters

d1

use the all diagonal elements indicator ?

d2

use the all diagonal elements indicator ?

u

the vector to assign

Attributes

def upper: MatrixD

Return the dim2-by-dim2 upper triangle of this matrix (rest are zero).

Return the dim2-by-dim2 upper triangle of this matrix (rest are zero).

Attributes

Compute the column variances of this matrix.

Compute the column variances of this matrix.

Attributes

def write(fileName: String): Unit

Write this matrix to a CSV-formatted text file with name fileName.

Write this matrix to a CSV-formatted text file with name fileName.

Value parameters

fileName

the name of file to hold the data

Attributes

def ~^(p: Double): MatrixD

Raise the elements in this matrix to the p-th power (e.g., x~^2 = x *~ x) Being element-wise, x~^2 is not x * x.

Raise the elements in this matrix to the p-th power (e.g., x~^2 = x *~ x) Being element-wise, x~^2 is not x * x.

Value parameters

p

the scalar power

Attributes

def ~^^(p: Int): MatrixD

Raise this matrix to the p-th power (for some integer p >= 1) using a divide and conquer algorithm and matrix multiplication (x~^^2 = x * x).

Raise this matrix to the p-th power (for some integer p >= 1) using a divide and conquer algorithm and matrix multiplication (x~^^2 = x * x).

Value parameters

p

the power to raise this matrix to

Attributes

inline def Ƭ: MatrixD
inline def (y: MatrixD): MatrixD
inline def (y: VectorD): VectorD
inline def (y: MatrixD): MatrixD
inline def (y: VectorD): MatrixD

Concrete fields

val dim: Int
val dim2: Int
val indices: Range

The row index range

The row index range

Attributes

val indices2: Range

The column index range

The column index range

Attributes