Add two matrices, M1 and M2, together.
Parameters |
M1 : Array First matrix.
M2 : Array Second matrix.
|
---|---|
Returns |
M : Array Addition of M1, M2.
|
Errors |
An error is thrown if:
|
Perform an affine transformation 2D vector, v, by factors tx and ty.
Parameters |
v : Array A 2D vector.
tx : Number The x-factor.
ty : Number The y-factor.
|
---|---|
Returns |
Vaff : Array Affined v.
|
Errors |
An error is thrown if:
|
Create a deep copy of a matrix, M.
Parameters |
M : Array The matrix to copy.
|
---|---|
Returns |
Mnew : Array Deep copy of M.
|
Errors |
An error is thrown if:
|
Calculates the determinant of a square matrix, M.
Parameters |
M : Array A square matrix.
|
---|---|
Returns |
num : Number The determinant of M.
|
Errors |
An error is thrown if:
|
Calculate the dot product of two vectors, vA and vB.
Parameters |
vA : Array First vector.
vB : Array Second vector.
|
---|---|
Returns |
num : Array Dot product of vA,vB.
|
Errors |
An error is thrown if:
|
Performs Gauss-Jordan elimination on the matrix M with an error bound of eps. eps is an optional argument.
Parameters |
M : Array A matrix.
eps : Number The error bound.
|
---|---|
Returns |
Mnew : Array The row-reduced version of M.
|
Errors |
This function does not raise any errors. |
Gets the nth column of a matrix, M as a vector.
Parameters |
M : Array A matrix.
|
---|---|
Returns |
col : Array nth column of M.
|
Errors |
An error is thrown if:
|
Creates a n-by-n identity matrix.
Parameters |
n : Int The size of the identity matrix.
|
---|---|
Returns |
M : Array Identity matrix of size n.
|
Errors |
This function does not raise any errors. |
Calculates the inverse of a square matrix M.
Parameters |
M : Array A square matrix.
|
---|---|
Returns |
Mnew : Array The inverse of M.
|
Errors |
An error is thrown if:
|
Determines if a matrix, M, is (weak) column diagonally dominant.
Parameters |
M : Array The matrix to test.
|
---|---|
Returns |
bool : Boolean true if M is column diagonally dominant, false otherwise.
|
Errors |
An error is thrown if:
|
Determines if a matrix, M, is (weak) row diagonally dominant.
Parameters |
M : Array The matrix to test.
|
---|---|
Returns |
bool : Boolean true if M is row diagonally dominant, false otherwise.
|
Errors |
An error is thrown if:
|
Determines if a matrix, M, is square.
Parameters |
M : Array The matrix to test.
|
---|---|
Returns |
bool : Boolean true if M is square, false otherwise.
|
Errors |
An error is thrown if:
|
Determines if a matrix, M, is strictly column diagonally dominant.
Parameters |
M : Array The matrix to test.
|
---|---|
Returns |
bool : Boolean true if M is strictly column diagonally dominant, false otherwise.
|
Errors |
An error is thrown if:
|
Determines if a matrix, M, is strictly row diagonally dominant.
Parameters |
M : Array The matrix to test.
|
---|---|
Returns |
bool : Boolean true if M is strictly row diagonally dominant, false otherwise.
|
Errors |
An error is thrown if:
|
Calculates the LUP decomposition of a square matrix, M. An array containing the three matrices is returned.
Parameters |
M : Array A square matrix.
|
---|---|
Returns |
LUP : Array An array containing L, U, P.
|
Errors |
An error is thrown if:
|
Applies a function, f, to every element in the matrix (or vector) M. f can only take one parameter.
Parameters |
M : Array A matrix or vector
f : Function A one-parameter function.
|
---|---|
Returns |
Mmapped : Array A copy of M, but with f applied to each element.
|
Errors |
This function does not raise any errors. |
Multiply two matrices, M1 and M2, together.
Parameters |
M1 : Array First matrix.
M2 : Array Second matrix.
|
---|---|
Returns |
M : Array Multiplication of M1, M2.
|
Errors |
An error is thrown if:
|
Calculate the outer product of two vectors, vA and vB.
Parameters |
vA : Array First vector.
vB : Array Second vector.
|
---|---|
Returns |
M : Array Outer product of vA,vB.
|
Errors |
An error is thrown if:
|
Reorders the columns of a matrix M as specified by a set of column indices, L.
Parameters |
M : Array The matrix to reorder.
L : Array The set of column indices.
|
---|---|
Returns |
Mnew : Array Reordered M.
|
Errors |
An error is thrown if:
|
Reorders the rows of a matrix M as specified by a set of integers, L.
Parameters |
M : Array The matrix to reorder.
L : Array The set of row indices.
|
---|---|
Returns |
Mnew : Array Reordered M.
|
Errors |
An error is thrown if:
|
Reverses the order the of columns of a matrix M.
Parameters |
M : Array The matrix to reverse.
|
---|---|
Returns |
Mnew : Array Reversed M.
|
Errors |
This function does not raise any errors. |
Reverses the order the of rows of a matrix M.
Parameters |
M : Array The matrix to reverse.
|
---|---|
Returns |
Mnew : Array Reversed M.
|
Errors |
This function does not raise any errors. |
Rotate a 2D vector, v, by angle degrees in a direction dir. dir is an optional argument.
Parameters |
v : Array A 2D vector.
angle : Number An angle in degrees.
dir : String A direction. Options are clockwise and counterclockwise.
Default value is counterclockwise.
|
---|---|
Returns |
Vnew : Array Rotated v.
|
Errors |
An error is thrown if:
|
Add the multiple of a row, scale*fromRow, to another row, toRow, both of matrix M.
Parameters |
M : Array A matrix.
fromRow : Int Row to be multiplied.
toRow : Int Row to be added to.
scale : Number Scaling factor.
|
---|---|
Returns |
Mnew : Array Altered M.
|
Errors |
This function does not raise any errors. |
Row-reduces the matrix M with an error bound of eps. eps is an optional argument. Identical to matrix.GaussJordanElimination.
Parameters |
M : Array A matrix.
eps : Number The error bound.
|
---|---|
Returns |
Mnew : Array The row-reduced version of M.
|
Errors |
This function does not raise any errors. |
Scale row row of a matrix M by a factor k.
Parameters |
M : Array A matrix.
row : Int The row number.
k : Number Scaling factor.
|
---|---|
Returns |
Mnew : Array Scaled M.
|
Errors |
This function does not raise any errors. |
Switch rows row1 and row2 of a matrix M with each other.
Parameters |
M : Array A matrix.
row1 : Int First row number.
row2 : Int Second row number.
|
---|---|
Returns |
Mnew : Array Swapped M.
|
Errors |
This function does not raise any errors. |
Multiply a matrix, M, by a scalar, a.
Parameters |
M : Array The matrix to multiply.
a : Number The scalar value.
|
---|---|
Returns |
M : Array Multiplication of a, M1.
|
Errors |
This function does not raise any errors. |
Scale a 2D vector, v, by scale factors x and y.
Parameters |
v : Array A 2D vector.
x : Number The x-scaling.
y : Number The y-scaling.
|
---|---|
Returns |
Vsca : Array Scaled v.
|
Errors |
An error is thrown if:
|
Shear a 2D vector, v, by a shear factor k in a direction (x or y) dir.
Parameters |
v : Array A 2D vector.
k : Number The shear factor.
dir : String A direction. Options are 'xaxis' and 'yaxis'.
|
---|---|
Returns |
Vsh : Array Sheared v.
|
Errors |
An error is thrown if:
|
Subtract two matrices, M1 and M2, from one another.
Parameters |
M1 : Array First matrix.
M2 : Array Second matrix.
|
---|---|
Returns |
M : Array Subtraction of M2 from M1.
|
Errors |
An error is thrown if:
|
Calculates the trace of a square matrix, M.
Parameters |
M : Array A square matrix.
|
---|---|
Returns |
tr : Number The trace of M.
|
Errors |
An error is thrown if:
|
Creates a n-by-m matrix filled with zeros.
Parameters |
n : Int Number of rows.
m : Int Number of columns.
|
---|---|
Returns |
M : Array A matrix of zeros.
|
Errors |
An error is thrown if:
|
Creates a n-by-n zigzag matrix starting at a corner, point, and moving in an initial direction dir.
Parameters |
n : Int Dimension of zigzag matrix.
point : String Corner to start at. Options are top-left ('TR'), top-right ('TR'),
bottom-left ('BL') and bottom-right ('BR').
dir : String Direction to start iterating. Options are vertical ('v') or
horizontal ('H').
|
---|---|
Returns |
M : Array A zigzag matrix.
|
Errors |
An error is thrown if:
|