Methods
(static) add(out, a, b) → {mat2}
Adds two mat2's
Parameters:
Name | Type | Description |
---|---|---|
out |
mat2 | the receiving matrix |
a |
mat2 | the first operand |
b |
mat2 | the second operand |
Returns:
out
- Type
- mat2
(static) adjoint(out, a) → {mat2}
Calculates the adjugate of a mat2
Parameters:
Name | Type | Description |
---|---|---|
out |
mat2 | the receiving matrix |
a |
mat2 | the source matrix |
Returns:
out
- Type
- mat2
(static) clone(a) → {mat2}
Creates a new mat2 initialized with values from an existing matrix
Parameters:
Name | Type | Description |
---|---|---|
a |
mat2 | matrix to clone |
Returns:
a new 2x2 matrix
- Type
- mat2
(static) copy(out, a) → {mat2}
Copy the values from one mat2 to another
Parameters:
Name | Type | Description |
---|---|---|
out |
mat2 | the receiving matrix |
a |
mat2 | the source matrix |
Returns:
out
- Type
- mat2
(static) create() → {mat2}
Creates a new identity mat2
Returns:
a new 2x2 matrix
- Type
- mat2
(static) determinant(a) → {Number}
Calculates the determinant of a mat2
Parameters:
Name | Type | Description |
---|---|---|
a |
mat2 | the source matrix |
Returns:
determinant of a
- Type
- Number
(static) equals(a, b) → {Boolean}
Returns whether or not the matrices have approximately the same elements in the same position.
Parameters:
Name | Type | Description |
---|---|---|
a |
mat2 | The first matrix. |
b |
mat2 | The second matrix. |
Returns:
True if the matrices are equal, false otherwise.
- Type
- Boolean
(static) exactEquals(a, b) → {Boolean}
Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
Parameters:
Name | Type | Description |
---|---|---|
a |
mat2 | The first matrix. |
b |
mat2 | The second matrix. |
Returns:
True if the matrices are equal, false otherwise.
- Type
- Boolean
(static) frob(a) → {Number}
Returns Frobenius norm of a mat2
Parameters:
Name | Type | Description |
---|---|---|
a |
mat2 | the matrix to calculate Frobenius norm of |
Returns:
Frobenius norm
- Type
- Number
(static) fromRotation(out, rad) → {mat2}
Creates a matrix from a given angle
This is equivalent to (but much faster than):
mat2.identity(dest);
mat2.rotate(dest, dest, rad);
Parameters:
Name | Type | Description |
---|---|---|
out |
mat2 | mat2 receiving operation result |
rad |
Number | the angle to rotate the matrix by |
Returns:
out
- Type
- mat2
(static) fromScaling(out, v) → {mat2}
Creates a matrix from a vector scaling
This is equivalent to (but much faster than):
mat2.identity(dest);
mat2.scale(dest, dest, vec);
Parameters:
Name | Type | Description |
---|---|---|
out |
mat2 | mat2 receiving operation result |
v |
vec2 | Scaling vector |
Returns:
out
- Type
- mat2
(static) fromValues(m00, m01, m10, m11) → {mat2}
Create a new mat2 with the given values
Parameters:
Name | Type | Description |
---|---|---|
m00 |
Number | Component in column 0, row 0 position (index 0) |
m01 |
Number | Component in column 0, row 1 position (index 1) |
m10 |
Number | Component in column 1, row 0 position (index 2) |
m11 |
Number | Component in column 1, row 1 position (index 3) |
Returns:
out A new 2x2 matrix
- Type
- mat2
(static) identity(out) → {mat2}
Set a mat2 to the identity matrix
Parameters:
Name | Type | Description |
---|---|---|
out |
mat2 | the receiving matrix |
Returns:
out
- Type
- mat2
(static) invert(out, a) → {mat2}
Inverts a mat2
Parameters:
Name | Type | Description |
---|---|---|
out |
mat2 | the receiving matrix |
a |
mat2 | the source matrix |
Returns:
out
- Type
- mat2
(static) LDU(L, D, U, a)
Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix
Parameters:
Name | Type | Description |
---|---|---|
L |
mat2 | the lower triangular matrix |
D |
mat2 | the diagonal matrix |
U |
mat2 | the upper triangular matrix |
a |
mat2 | the input matrix to factorize |
(static) mul()
Alias for mat2.multiply
(static) multiply(out, a, b) → {mat2}
Multiplies two mat2's
Parameters:
Name | Type | Description |
---|---|---|
out |
mat2 | the receiving matrix |
a |
mat2 | the first operand |
b |
mat2 | the second operand |
Returns:
out
- Type
- mat2
(static) multiplyScalar(out, a, b) → {mat2}
Multiply each element of the matrix by a scalar.
Parameters:
Name | Type | Description |
---|---|---|
out |
mat2 | the receiving matrix |
a |
mat2 | the matrix to scale |
b |
Number | amount to scale the matrix's elements by |
Returns:
out
- Type
- mat2
(static) multiplyScalarAndAdd(out, a, b, scale) → {mat2}
Adds two mat2's after multiplying each element of the second operand by a scalar value.
Parameters:
Name | Type | Description |
---|---|---|
out |
mat2 | the receiving vector |
a |
mat2 | the first operand |
b |
mat2 | the second operand |
scale |
Number | the amount to scale b's elements by before adding |
Returns:
out
- Type
- mat2
(static) rotate(out, a, rad) → {mat2}
Rotates a mat2 by the given angle
Parameters:
Name | Type | Description |
---|---|---|
out |
mat2 | the receiving matrix |
a |
mat2 | the matrix to rotate |
rad |
Number | the angle to rotate the matrix by |
Returns:
out
- Type
- mat2
(static) scale(out, a, v) → {mat2}
Scales the mat2 by the dimensions in the given vec2
Parameters:
Name | Type | Description |
---|---|---|
out |
mat2 | the receiving matrix |
a |
mat2 | the matrix to rotate |
v |
vec2 | the vec2 to scale the matrix by |
Returns:
out
- Type
- mat2
(static) set(out, m00, m01, m10, m11) → {mat2}
Set the components of a mat2 to the given values
Parameters:
Name | Type | Description |
---|---|---|
out |
mat2 | the receiving matrix |
m00 |
Number | Component in column 0, row 0 position (index 0) |
m01 |
Number | Component in column 0, row 1 position (index 1) |
m10 |
Number | Component in column 1, row 0 position (index 2) |
m11 |
Number | Component in column 1, row 1 position (index 3) |
Returns:
out
- Type
- mat2
(static) str(a) → {String}
Returns a string representation of a mat2
Parameters:
Name | Type | Description |
---|---|---|
a |
mat2 | matrix to represent as a string |
Returns:
string representation of the matrix
- Type
- String
(static) sub()
Alias for mat2.subtract
(static) subtract(out, a, b) → {mat2}
Subtracts matrix b from matrix a
Parameters:
Name | Type | Description |
---|---|---|
out |
mat2 | the receiving matrix |
a |
mat2 | the first operand |
b |
mat2 | the second operand |
Returns:
out
- Type
- mat2
(static) transpose(out, a) → {mat2}
Transpose the values of a mat2
Parameters:
Name | Type | Description |
---|---|---|
out |
mat2 | the receiving matrix |
a |
mat2 | the source matrix |
Returns:
out
- Type
- mat2