Skip to content

Latest commit

 

History

History
51 lines (41 loc) · 5.91 KB

vector.matrixbuilder.md

File metadata and controls

51 lines (41 loc) · 5.91 KB

Home > @josh-brown/vector > MatrixBuilder

MatrixBuilder class

Provides methods for constructing Matrices of a given type

Signature:

export declare class MatrixBuilder<S, V extends Vector<S>, M extends Matrix<S>> 

Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the MatrixBuilder class.

Methods

Method Modifiers Description
augment(left, right) Constructs a new matrix consisting of left and right next to one another. Throws an error of left and right do not have the same number of rows.
block(grid) Constructs a single matrix consisting of a grid of matrices combined together. Throws an error if any of the dimensions are incompatible.
blockDiagonal(matrices) Creates a block-diagonal matrix.
circulant(vector) Construct a circulant matrix using entries from the input vector
diagonal(diagonalEntries) Constructs a square diagonal matrix whose diagonal entries come from diagonalEntries
empty() Constructs a 0x0 matrix
exclude(matrix, rowToExclude, columnToExclude) Constructs a new matrix with all entries in row rowToExclude and in column columnToExclude removed.
fill(value, shape) Constructs a matrix of the specified dimension, whose entries are all the specified value
fromArray(data)
fromColumnVectors(columns) Builds a matrix from an array of column vectors
fromIndexFunction(shape, indexFunction) Builds a matrix with entries given by _entry = f(i, j)_ where _f_ is indexFunction and i and j are the indices of the element
fromNumberArray(numberData)
fromRowVectors(rows) Builds a matrix from an array of row vectors
fromSparseData(shape, sparseData)
hankel(firstColumn, lastRow) Constructs a Hankel matrix from the specified first column and last row. A Hankel matrix has constant anti-diagonals. If lastRow is not given, then a vector with the last entry of the first row in the first entry and zero elsewhere is assumed. The last entry of the first column must equal the first entry of the last row.
hilbert(size) Constructs a Hilbert matrix of the specified size
identity(size) Constructs a size x size identity matrix
ones(shape) Constructs a matrix of the specified dimensions, consisting of all ones
pascal(size, upper) Constructs a lower-triangular matrix whose entries are the binomial coefficients (j choose i). Constructs an upper triangular matrix when the second argument is true.
pascalSymmetric(size) Constructs a symmetric matrix whose entries are the binomial coefficients (i + j choose i)
random(shape, min, max) Constructs a matrix of the specified size whose entries are (uniformly-distributed) random numbers between min and max
randomNormal(shape, mean, standardDeviation) Constructs a matrix of the specified size whose entries are normally distributed with the specified mean and standard deviation.
repeat(matrix, rows, columns) Constructs a new matrix consisted of repetitions of a smaller matrix.
slice(matrix, rowStartIndex, columnStartIndex, rowEndIndex, columnEndIndex) Constructs a new matrix based on a rectangular slice of a larger matrix
toeplitz(firstColumn, firstRow) Constructs a Toeplitz matrix from the specified first column and first row. A Toeplitz matrix has constant diagonals. If firstRow is not given, then the complex conjugate of firstColumn is assumed. The first entry must be real because the first entry of the first column must equal the first entry of the first row.
triangularMask(shape, lower, includeDiagonal) Constructs a matrix that has ones on and above the diagonal, and zeros elsewhere.
tridiagonal(leftEntries, diagonalEntries, rightEntries) Constructs a square tridiagonal matrix whose diagonal entries correspond to the entries of diagonalEntries, whose entries in the left-off-diagonal correspond to the entries of leftEntries, and whose entries in the right-off-diagonal correspond fo the entries of rightEntries. The off-diagonals must have one fewer entry than the diagonal. Throws an error if the dimensions are not correct.
zeros(shape) Constructs a matrix of the specified dimensions, consisting of all zeros