mat2

mat2()

2x2 Matrix

Methods

inneradd(out, a, b)mat2

Adds two mat2's
Name Type Description
out mat2 the receiving matrix
a mat2 the first operand
b mat2 the second operand
Returns:
out

inneradjoint(out, a)mat2

Calculates the adjugate of a mat2
Name Type Description
out mat2 the receiving matrix
a mat2 the source matrix
Returns:
out

innerclone(a)mat2

Creates a new mat2 initialized with values from an existing matrix
Name Type Description
a mat2 matrix to clone
Returns:
a new 2x2 matrix

innercopy(out, a)mat2

Copy the values from one mat2 to another
Name Type Description
out mat2 the receiving matrix
a mat2 the source matrix
Returns:
out

innercreate()mat2

Creates a new identity mat2
Returns:
a new 2x2 matrix

innerdeterminant(a)Number

Calculates the determinant of a mat2
Name Type Description
a mat2 the source matrix
Returns:
determinant of a

innerequals$1(a, b)Boolean

Returns whether or not the matrices have approximately the same elements in the same position.
Name Type Description
a mat2 The first matrix.
b mat2 The second matrix.
Returns:
True if the matrices are equal, false otherwise.

innerexactEquals(a, b)Boolean

Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
Name Type Description
a mat2 The first matrix.
b mat2 The second matrix.
Returns:
True if the matrices are equal, false otherwise.

innerfrob(a)Number

Returns Frobenius norm of a mat2
Name Type Description
a mat2 the matrix to calculate Frobenius norm of
Returns:
Frobenius norm

innerfromRotation(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);
Name Type Description
out mat2 mat2 receiving operation result
rad Number the angle to rotate the matrix by
Returns:
out

innerfromScaling(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);
Name Type Description
out mat2 mat2 receiving operation result
v vec2 Scaling vector
Returns:
out

innerfromValues(m00, m01, m10, m11)mat2

Create a new mat2 with the given values
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

inneridentity(out)mat2

Set a mat2 to the identity matrix
Name Type Description
out mat2 the receiving matrix
Returns:
out

innerinvert(out, a)mat2

Inverts a mat2
Name Type Description
out mat2 the receiving matrix
a mat2 the source matrix
Returns:
out

innerLDU(L, D, U, a)

Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix
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

innermul()

Alias for mat2.multiply

innermultiply(out, a, b)mat2

Multiplies two mat2's
Name Type Description
out mat2 the receiving matrix
a mat2 the first operand
b mat2 the second operand
Returns:
out

innermultiplyScalar(out, a, b)mat2

Multiply each element of the matrix by a scalar.
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

innermultiplyScalarAndAdd(out, a, b, scale)mat2

Adds two mat2's after multiplying each element of the second operand by a scalar value.
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

innerrotate(out, a, rad)mat2

Rotates a mat2 by the given angle
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

innerscale(out, a, v)mat2

Scales the mat2 by the dimensions in the given vec2
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

innerset(out, m00, m01, m10, m11)mat2

Set the components of a mat2 to the given values
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

innerstr(a)String

Returns a string representation of a mat2
Name Type Description
a mat2 matrix to represent as a string
Returns:
string representation of the matrix

innersub()

Alias for mat2.subtract

innersubtract(out, a, b)mat2

Subtracts matrix b from matrix a
Name Type Description
out mat2 the receiving matrix
a mat2 the first operand
b mat2 the second operand
Returns:
out

innertranspose(out, a)mat2

Transpose the values of a mat2
Name Type Description
out mat2 the receiving matrix
a mat2 the source matrix
Returns:
out