tensor v0.7.0 Matrix
Summary
Functions
Returns the n-th column of the matrix as a Vector
Returns the columns of this matrix as a list of Vectors
Creates a square matrix where the diagonal elements are filled with the elements of list.
The second argument is an optional identity to be used for all elements not part of the diagonal
Builds a Matrix up from a list of vectors
Creates an ‘identity’ matrix
Returns the values in the main diagonal (top left to bottom right) as list
Calculates the Scalar Multiplication or Matrix Multiplication of a * b
Creates a new matrix of dimensions width x height
Returns the n-th row of the matrix as a Vector
Takes a vector, and returns a 1×n matrix
Returns the rows of this matrix as a list of Vectors
True if the matrix is square and the same as its transpose
Converts a matrix to a list of lists
Returns the sum of the main diagonal of a square matrix
Functions
Returns the n-th column of the matrix as a Vector.
If you’re doing a lot of calls to column, consider transposing the matrix
and calling rows on that transposed matrix, as it will be faster.
Creates a square matrix where the diagonal elements are filled with the elements of list.
The second argument is an optional identity to be used for all elements not part of the diagonal.
Builds a Matrix up from a list of vectors.
Will only work as long as the vectors have the same length.
Creates an ‘identity’ matrix.
This is a square matrix of size size that has the diag_identity value (default: 1) at the diagonal, and the rest is 0.
Optionally pass in a third argument, which is the value the rest of the elements in the matrix will be set to.
Calculates the Scalar Multiplication or Matrix Multiplication of a * b.
If b is a number, then a new matrix where all values will be multiplied by b are returned.
if b is a matrix, then Matrix Multiplication is performed.
This will only work as long as the height of a is the same as the width of b.
This operation internally builds up a list-of-lists, and finally transforms that back to a matrix.
Creates a new matrix of dimensions width x height.
Optionally pass in a fourth argument, which will be the default values the matrix will be filled with. (default: 0)
Returns the sum of the main diagonal of a square matrix.
Note that this method will fail when called with a non-square matrix