The `MatrixD companion object provides factory methods.
Attributes
Members list
Value members
Concrete methods
Create a matrix from repeated values.
Create a matrix from repeated values.
Value parameters
- dim
-
the (row, column) dimensions
- u
-
the repeated values
Attributes
Create a square matrix of dimension dim where all elements equal zero.
Create a square matrix of dimension dim where all elements equal zero.
Value parameters
- dim
-
the square dimensions
Attributes
Create a matrix from a variable argument list of vectors (row-wise). Use transpose to make it column-wise.
Create a matrix from a variable argument list of vectors (row-wise). Use transpose to make it column-wise.
Value parameters
- vs
-
the vararg list of vectors
Attributes
Create a matrix from an mutable IndexedSeq of vectors (row-wise). Use transpose to make it column-wise.
Create a matrix from an mutable IndexedSeq of vectors (row-wise). Use transpose to make it column-wise.
Value parameters
- vs
-
the indexed sequence of vectors
Attributes
Create a matrix from an immutable IndexedSeq of vectors (row-wise), as produce by for yield. Use transpose to make it column-wise.
Create a matrix from an immutable IndexedSeq of vectors (row-wise), as produce by for yield. Use transpose to make it column-wise.
Value parameters
- vs
-
the indexed sequence of vectors
Attributes
Extract the i-th vectors from a pair of matrices.
Extract the i-th vectors from a pair of matrices.
Value parameters
- i
-
the extraction index
- x_y
-
the matrix pair
Attributes
Create a diagonal matrix of dimensions dim by dim2 where all elements equal zero, except the main diagonal where elements are set to y_i.
Create a diagonal matrix of dimensions dim by dim2 where all elements equal zero, except the main diagonal where elements are set to y_i.
Value parameters
- dim
-
the row dimension
- dim2
-
the column dimension
- y
-
the vector to set the main diagonal to
Attributes
Create an identity matrix of dimensions dim by dim2 where all elements equal zero, except the main diagonal where elements are set to one.
Create an identity matrix of dimensions dim by dim2 where all elements equal zero, except the main diagonal where elements are set to one.
Value parameters
- dim
-
the row dimension
- dim2
-
the column dimension
Attributes
Create a matrix of dimensions dim by dim2 where all elements equal to the given value.
Create a matrix of dimensions dim by dim2 where all elements equal to the given value.
Value parameters
- dim
-
the row dimension
- dim2
-
the column dimension
- value
-
the given value to assign to all elements
Attributes
Create an m-by-1 matrix from an m-vector (column-wise).
Create an m-by-1 matrix from an m-vector (column-wise).
Value parameters
- v
-
the vector to build the matrix from
Attributes
Create a matrix by reading from a text file, e.g., a CSV file.
Create a matrix by reading from a text file, e.g., a CSV file.
Value parameters
- fileName
-
the name of file holding the data
- fullPath
-
flag indicating whether to use full-path or path relative to 'DATA_DIR' defaults to false (relative paths)
- skip
-
the initial number of lines/rows to skip
- skipCol
-
the initial number of columns to skip
- sp
-
the character used to separate values (',', '\t', ...)
- stop
-
the line/row number to stop before reaching the EOF (exclusive)
Attributes
- See also
-
the
writemethod in the class to write a matrix to a CSV file.
Create a matrix and a header by reading from a text file, e.g., a CSV file. Assumes the column names (header) is in the first line of the file.
Create a matrix and a header by reading from a text file, e.g., a CSV file. Assumes the column names (header) is in the first line of the file.
Value parameters
- fileName
-
the name of file holding the data
- fullPath
-
flag indicating whether to use full-path or path relative to 'DATA_DIR' defaults to false (relative paths)
- skipCol
-
the initial number of columns to skip
- sp
-
the character used to separate values (',', '\t', ...)
- stop
-
the line/row number to stop before reaching the EOF (exclusive)
Attributes
- See also
-
the
writemethod in the class to write a matrix to a CSV file.
Create a matrix-vector pair (x, y) by reading from a text file, e.g., a CSV file. Use readFileIter to only read the necessary columns from the file.
Create a matrix-vector pair (x, y) by reading from a text file, e.g., a CSV file. Use readFileIter to only read the necessary columns from the file.
Value parameters
- fileName
-
the name of file holding the data
- fullPath
-
flag indivating whether to use full-path or path relative to 'DATA_DIR' defaults to false (relative paths)
- skip
-
the initial number of lines to skip
- sp
-
the character used to separate values (',', '\t', ...)
- xCols
-
the columns that are to make up the x-matrix
- yCol
-
the column that is to make up the y-vector (use the default -1 to skip this)
Attributes
Create a matrix by reading from a text file, e.g., a CSV file. Convert string columns into ordinal/integer columns.
Create a matrix by reading from a text file, e.g., a CSV file. Convert string columns into ordinal/integer columns.
Value parameters
- fileName
-
the name of file holding the data
- fullPath
-
flag indicating whether to use full-path or path relative to 'DATA_DIR' defaults to false (relative paths)
- ordCols
-
the set of ordinal columns (column indices)
- ordStrs
-
the corresponding strings for the ordinal/integer values
- skip
-
the initial number of lines/rows to skip
- skipCol
-
the initial number of columns to skip
- sp
-
the character used to separate values (',', '\t', ...)
Attributes
Create a lower triangular matrix from repeated values for elements below the main diagonal. The rest of the elements are all zero.
Create a lower triangular matrix from repeated values for elements below the main diagonal. The rest of the elements are all zero.
Value parameters
- dim
-
the (row, column) dimensions
- u
-
the repeated values
Attributes
Given a string value, convert it to an ordinal/integer based on the ordStr mapping.
Given a string value, convert it to an ordinal/integer based on the ordStr mapping.
Value parameters
- ordStr
-
the VectorS containing strings that can be ordered, e.g., VectorS ("low", "medium", "high") for 0, 1, 2
- str
-
the string to be mapped to an ordinal value
Attributes
Create a matrix of dimension dim by 1 that consists of all ones.
Create a matrix of dimension dim by 1 that consists of all ones.
Value parameters
- dim
-
the row dimension
Attributes
Compute the outer product of vector x and vector y. The result of the outer product is a matrix where element (i, j) is the product of i-th element of x with the j-th element of y, an x.dim by y.dim matrix.
Compute the outer product of vector x and vector y. The result of the outer product is a matrix where element (i, j) is the product of i-th element of x with the j-th element of y, an x.dim by y.dim matrix.
Value parameters
- x
-
the first vector
- y
-
the second vector