VMatrixD

scalation.mathstat.VMatrixD
See theVMatrixD companion object
class VMatrixD(dim_: Int, dim2_: Int, val dim2v: Int, formulas: Array[Array[Int]], v_: Array[Array[Double]]) extends MatrixD

The VMatrixD class maintains virtual-matrices where the first dim2 columns are stored, while the last dim2v are virtual, i.e., calculated as needed. Virtual-matrices offer memory reduction for Quadratic, Cubic, and Symbolic Regression, where augmented columns can be calculated rather than stored.

Value parameters

dim2_

the stored second (column) dimension of the matrix

dim2v

the virtual second (column) dimension of the matrix

dim_

the first (row) dimension of the matrix

formulas

the formulas used to calculate the last dim2v columns Array (1, 1) => x1 * x1; Array (1, 2) => x1 * x2

v_

the 2D array used to store matrix the first dim2_ columns

Attributes

See also

scalation.modeling.SymbolicRegression

Companion
object
Graph
Supertypes
class MatrixD
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def *(y: MatrixD): MatrixD

Multiply this virtual-matrix by matrix y (requires y to have at least the dimensions of this). FIX - to be optimized, needs to handle case of y being a virtual matrix

Multiply this virtual-matrix by matrix y (requires y to have at least the dimensions of this). FIX - to be optimized, needs to handle case of y being a virtual matrix

Value parameters

y

the other matrix

Attributes

Definition Classes
override def *(y: VectorD): VectorD

Multiply this virtual-matrix by vector y (requires y to have at least the dimensions of this).

Multiply this virtual-matrix by vector y (requires y to have at least the dimensions of this).

Value parameters

y

the vector to multiple by

Attributes

Definition Classes
override def apply(i: Int, j: Int): Double

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

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

Value parameters

i

the row index

j

the column index

Attributes

Definition Classes

Multiply the transpose this virtual-matrix by itself, e.g., X^T X.

Multiply the transpose this virtual-matrix by itself, e.g., X^T X.

Attributes

Multiply the transpose this virtual-matrix by vector y, e.g., X^T y.

Multiply the transpose this virtual-matrix by vector y, e.g., X^T y.

Value parameters

y

the vector to multiply by

Attributes

override def toMatrixD: MatrixD

Convert this virtual-matrix to a regular (fully stored) matrix.

Convert this virtual-matrix to a regular (fully stored) matrix.

Attributes

Definition Classes

Inherited methods

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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
def +(u: Double): MatrixD

Add this matrix and scaler u.

Add this matrix and scaler u.

Value parameters

u

the scalar to add

Attributes

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
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

Inherited from:
MatrixD
def apply(idx: Array[Int]): MatrixD

Attributes

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

Attributes

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD

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

Inherited from:
MatrixD

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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
inline def dims: (Int, Int)

Return the row and column dimensions of this matrix.

Return the row and column dimensions of this matrix.

Attributes

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD

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

Inherited from:
MatrixD
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

Inherited from:
MatrixD

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.

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD

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

Inherited from:
MatrixD
def max: VectorD

Return the maximum value for each column in the matrix.

Return the maximum value for each column in the matrix.

Attributes

Inherited from:
MatrixD
def mean: VectorD

Compute the column means of this matrix.

Compute the column means of this matrix.

Attributes

Inherited from:
MatrixD
def min: VectorD

Return the minimum value for each column in the matrix.

Return the minimum value for each column in the matrix.

Attributes

Inherited from:
MatrixD

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

Inherited from:
MatrixD
def mmax: Double

Return the maximum value for the entire matrix.

Return the maximum value for the entire matrix.

Attributes

Inherited from:
MatrixD
def mmin: Double

Return the minimum value for the entire matrix.

Return the minimum value for the entire matrix.

Attributes

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD

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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

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

Attributes

Inherited from:
MatrixD
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

Inherited from:
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

Inherited from:
MatrixD
def stdev: VectorD

Compute the column standard deviations of this matrix.

Compute the column standard deviations of this matrix.

Attributes

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
override def toString: String

Convert this matrix to a string.

Convert this matrix to a string.

Attributes

Definition Classes
MatrixD -> Any
Inherited from:
MatrixD
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

Inherited from:
MatrixD

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

Inherited from:
MatrixD

Return the negative of this matrix (unary minus).

Return the negative of this matrix (unary minus).

Attributes

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD

Compute the column variances of this matrix.

Compute the column variances of this matrix.

Attributes

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
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

Inherited from:
MatrixD
inline def Ƭ: MatrixD

Attributes

Inherited from:
MatrixD
inline def (y: VectorD): VectorD

Attributes

Inherited from:
MatrixD
inline def (y: MatrixD): MatrixD

Attributes

Inherited from:
MatrixD
inline def (y: VectorD): MatrixD

Attributes

Inherited from:
MatrixD
inline def (y: MatrixD): MatrixD

Attributes

Inherited from:
MatrixD

Concrete fields

val dim2v: Int

Inherited fields

val dim: Int

Attributes

Inherited from:
MatrixD
val dim2: Int

Attributes

Inherited from:
MatrixD
val indices: Range

The row index range

The row index range

Attributes

Inherited from:
MatrixD
val indices2: Range

The column index range

The column index range

Attributes

Inherited from:
MatrixD