Contains the AugmentedMatrix class, which encodes augmented matrices.
Author: Novak / cszach@proton.me
- AugmentedMatrix
- ~AugmentedMatrix ⇐
Matrix
- new AugmentedMatrix(left, right)
- .leftMatrix ⇒
Matrix
- .rightMatrix ⇒
Matrix
- .size :
object
- .numberOfEntries :
number
- .elements :
Array.<number>
- .rows ⇒
Array.<Array>
- .columns ⇒
Array.<Array>
- .mainDiagonal ⇒
Array.<number>
- .clone() ⇒
Matrix
- .equals(matrix) ⇒
boolean
- .entry(i, j) ⇒
number
- .row(r) ⇒
Array.<number>
- .column(c) ⇒
Array.<number>
- .leadingCoefficient(r) ⇒
number
- .forEach(callback, thisArg)
- .forEachRow(callback, thisArg)
- .forEachColumn(callback, thisArg)
- .interchargeRows(r, s) ⇒
Matrix
- .multiplyRowByScalar(r, k) ⇒
Matrix
- .addRowTimesScalarToRow(r, s, k) ⇒
Matrix
- .transpose() ⇒
Matrix
- .multiplyScalar(k) ⇒
Matrix
- .negate() ⇒
Matrix
- .add(matrix) ⇒
Matrix
- .sub(matrix) ⇒
Matrix
- .multiply(matrix) ⇒
Matrix
- ~AugmentedMatrix ⇐
AugmentedMatrix~AugmentedMatrix ⇐ Matrix
Encodes augmented matrices and their operations in Linear Algebra.
This class inherits class methods from Matrix with the
exception that transpose
, add
, sub
, and multiply
cannot be used.
The size
property has two more elements: left
—which is the number of
columns of the left matrix—and right
—that of the right matrix.
Kind: inner class of AugmentedMatrix
Extends: Matrix
See: Matrix for common properties
- ~AugmentedMatrix ⇐
Matrix
- new AugmentedMatrix(left, right)
- .leftMatrix ⇒
Matrix
- .rightMatrix ⇒
Matrix
- .size :
object
- .numberOfEntries :
number
- .elements :
Array.<number>
- .rows ⇒
Array.<Array>
- .columns ⇒
Array.<Array>
- .mainDiagonal ⇒
Array.<number>
- .clone() ⇒
Matrix
- .equals(matrix) ⇒
boolean
- .entry(i, j) ⇒
number
- .row(r) ⇒
Array.<number>
- .column(c) ⇒
Array.<number>
- .leadingCoefficient(r) ⇒
number
- .forEach(callback, thisArg)
- .forEachRow(callback, thisArg)
- .forEachColumn(callback, thisArg)
- .interchargeRows(r, s) ⇒
Matrix
- .multiplyRowByScalar(r, k) ⇒
Matrix
- .addRowTimesScalarToRow(r, s, k) ⇒
Matrix
- .transpose() ⇒
Matrix
- .multiplyScalar(k) ⇒
Matrix
- .negate() ⇒
Matrix
- .add(matrix) ⇒
Matrix
- .sub(matrix) ⇒
Matrix
- .multiply(matrix) ⇒
Matrix
Constructs an AugmentedMatrix
instance, which encodes an augmented matrix.
Input matrices are cloned and assumed to have equal number of rows.
Param | Type | Description |
---|---|---|
left | Matrix |
The left part of the augmented matrix. |
right | Matrix |
The right part of the augmented matrix. |
augmentedMatrix.leftMatrix ⇒ Matrix
Returns the left matrix of this augmented matrix.
Kind: instance property of AugmentedMatrix
Returns: Matrix
- The left matrix
augmentedMatrix.rightMatrix ⇒ Matrix
Returns the right matrix of this augmented matrix.
Kind: instance property of AugmentedMatrix
Returns: Matrix
- The right matrix
Contains the dimensions of this matrix as an object in the
form { rows, columns }
.
Kind: instance property of AugmentedMatrix
Overrides: size
The number of entries in this matrix.
Kind: instance property of AugmentedMatrix
Overrides: numberOfEntries
Stores the elements of this matrix in row-major order.
Kind: instance property of AugmentedMatrix
Overrides: elements
Returns the rows of this matrix in an array.
Kind: instance property of AugmentedMatrix
Overrides: rows
Returns: Array.<Array>
- The rows in this matrix
Returns the columns of this matrix in an array.
Kind: instance property of AugmentedMatrix
Overrides: columns
Returns: Array.<Array>
- The columns in this matrix
Returns the main diagonal of this matrix.
Kind: instance property of AugmentedMatrix
Overrides: mainDiagonal
Returns: Array.<number>
- The entries in the main diagonal of this matrix
Creates and returns a clone of this matrix instance.
Kind: instance method of AugmentedMatrix
Overrides: clone
Returns: Matrix
- A clone of this instance
Checks if this matrix and another matrix are equal.
Kind: instance method of AugmentedMatrix
Overrides: equals
Returns: boolean
- true
if the two matrices are equal, false
otherwise
Param | Type | Description |
---|---|---|
matrix | Matrix |
The matrix to compare this matrix to. |
Returns the entry in the specified row and column in this matrix.
Kind: instance method of AugmentedMatrix
Overrides: entry
Returns: number
- The entry
Param | Type | Description |
---|---|---|
i | number |
The row that contains the entry (1-indexed). |
j | number |
The column that contains the entry (1-indexed). |
Returns a row in this matrix as a JavaScript array.
Kind: instance method of AugmentedMatrix
Overrides: row
Returns: Array.<number>
- The row's entries
Param | Type | Description |
---|---|---|
r | number |
Row number (1-indexed). |
Returns a column in this matrix as a JavaScript array.
Kind: instance method of AugmentedMatrix
Overrides: column
Returns: Array.<number>
- The column's entries
Param | Type | Description |
---|---|---|
c | number |
Column number (1-indexed). |
Returns the leading coefficient of a row, or undefined
if the row does
not have a leading coefficient.
Kind: instance method of AugmentedMatrix
Overrides: leadingCoefficient
Returns: number
- The leading coefficient of the row
Param | Type | Description |
---|---|---|
r | number |
Row number (1-indexed). |
Executes a function for each entry in this matrix. Entries are iterated in row-major order.
Kind: instance method of AugmentedMatrix
Overrides: forEach
Param | Type | Description |
---|---|---|
callback | forEach |
The function to execute per iteration. |
thisArg | object |
The argument to use as this in the function. |
Executes a function for each row in this matrix.
Kind: instance method of AugmentedMatrix
Overrides: forEachRow
Param | Type | Description |
---|---|---|
callback | forEachRow |
The function to execute per iteration. |
thisArg | object |
The argument to use as this in the function. |
Executes a function for each column in this matrix.
Kind: instance method of AugmentedMatrix
Overrides: forEachColumn
Param | Type | Description |
---|---|---|
callback | forEachColumn |
The function to execute per iteration. |
thisArg | object |
The argument to use as this in the function. |
Intercharges two rows in this matrix.
Kind: instance method of AugmentedMatrix
Overrides: interchargeRows
Returns: Matrix
- This matrix
Param | Type | Description |
---|---|---|
r | number |
First row number (1-indexed). |
s | number |
Second row number (1-indexed). |
Multiplies a row in this matrix by a nonzero scalar.
Kind: instance method of AugmentedMatrix
Overrides: multiplyRowByScalar
Returns: Matrix
- This matrix
Param | Type | Description |
---|---|---|
r | number |
Row number (1-indexed). |
k | number |
The nonzero scalar to multiply the row by. |
Adds multiples of a row to another row in this matrix.
Kind: instance method of AugmentedMatrix
Overrides: addRowTimesScalarToRow
Returns: Matrix
- This matrix
Param | Type | Default | Description |
---|---|---|---|
r | number |
The row that gets added (1-indexed position). | |
s | number |
The row to multiply the scalar by and then add to row r (1-indexed position). |
|
k | number |
1 |
The scalar to multiply row s by. |
Transposes this matrix in place.
Kind: instance method of AugmentedMatrix
Overrides: transpose
Returns: Matrix
- This matrix
Todo
- Optimize this method by removing the medium
Multiplies this matrix by a scalar.
Kind: instance method of AugmentedMatrix
Overrides: multiplyScalar
Returns: Matrix
- This matrix
Param | Type | Description |
---|---|---|
k | number |
The scalar to multiply this matrix by. |
Multiplies this matrix by -1.
Kind: instance method of AugmentedMatrix
Overrides: negate
Returns: Matrix
- This matrix
Adds a matrix to this matrix.
Kind: instance method of AugmentedMatrix
Overrides: add
Returns: Matrix
- This matrix
Param | Type | Description |
---|---|---|
matrix | Matrix |
The matrix to add to this matrix. |
Subtracts a matrix from this matrix.
Kind: instance method of AugmentedMatrix
Overrides: sub
Returns: Matrix
- This matrix
Param | Type | Description |
---|---|---|
matrix | Matrix |
The matrix to subtract this matrix to. |
Multiplies this matrix by another matrix. If the input matrix is not compatible for multiplication, return this matrix unchanged.
Kind: instance method of AugmentedMatrix
Overrides: multiply
Returns: Matrix
- This matrix
Param | Type | Description |
---|---|---|
matrix | Matrix |
The matrix to post-multiply this matrix to. |