org.encog.mathutil.matrices

Class MatrixMath

• ```public final class MatrixMath
extends Object```
This class can perform many different mathematical operations on matrixes. The matrixes passed in will not be modified, rather a new matrix, with the operation performed, will be returned.
• Method Summary

Methods
Modifier and Type Method and Description
`static Matrix` ```add(Matrix a, Matrix b)```
`static void` ```copy(Matrix source, Matrix target)```
Copy from one matrix to another.
`static Matrix` ```deleteCol(Matrix matrix, int deleted)```
Delete one column from the matrix.
`static Matrix` ```deleteRow(Matrix matrix, int deleted)```
Delete a row from the matrix.
`static double` `determinant(Matrix m)`
`static Matrix` ```divide(Matrix a, double b)```
Return a matrix with each cell divided by the specified value.
`static double` ```dotProduct(Matrix a, Matrix b)```
Compute the dot product for the two matrixes.
`static Matrix` `identity(int size)`
Return an identity matrix of the specified size.
`static Matrix` ```multiply(Matrix a, double b)```
Return the result of multiplying every cell in the matrix by the specified value.
`static double[]` ```multiply(Matrix a, double[] d)```
`static Matrix` ```multiply(Matrix a, Matrix b)```
Return the product of the first and second matrix.
`static Matrix` ```subtract(Matrix a, Matrix b)```
Return the results of subtracting one matrix from another.
`static Matrix` `transpose(Matrix input)`
Return the transposition of a matrix.
`static double` `vectorLength(Matrix input)`
Calculate the length of a vector.
• Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• Method Detail

```public static Matrix add(Matrix a,
Matrix b)```
Parameters:
`a` - The first matrix to add.
`b` - The second matrix to add.
Returns:
A new matrix of the two added.
• copy

```public static void copy(Matrix source,
Matrix target)```
Copy from one matrix to another.
Parameters:
`source` - The source matrix for the copy.
`target` - The target matrix for the copy.
• deleteCol

```public static Matrix deleteCol(Matrix matrix,
int deleted)```
Delete one column from the matrix. Does not actually touch the source matrix, rather a new matrix with the column deleted is returned.
Parameters:
`matrix` - The matrix.
`deleted` - The column to delete.
Returns:
A matrix with the column deleted.
• deleteRow

```public static Matrix deleteRow(Matrix matrix,
int deleted)```
Delete a row from the matrix. Does not actually touch the matrix, rather returns a new matrix.
Parameters:
`matrix` - The matrix.
`deleted` - Which row to delete.
Returns:
A new matrix with the specified row deleted.
• divide

```public static Matrix divide(Matrix a,
double b)```
Return a matrix with each cell divided by the specified value.
Parameters:
`a` - The matrix to divide.
`b` - The value to divide by.
Returns:
A new matrix with the division performed.
• dotProduct

```public static double dotProduct(Matrix a,
Matrix b)```
Compute the dot product for the two matrixes. To compute the dot product, both
Parameters:
`a` - The first matrix.
`b` - The second matrix.
Returns:
The dot product.
• identity

`public static Matrix identity(int size)`
Return an identity matrix of the specified size.
Parameters:
`size` - The number of rows and columns to create. An identity matrix is always square.
Returns:
An identity matrix.
• multiply

```public static Matrix multiply(Matrix a,
double b)```
Return the result of multiplying every cell in the matrix by the specified value.
Parameters:
`a` - The first matrix.
`b` - The second matrix.
Returns:
The result of the multiplication.
• multiply

```public static Matrix multiply(Matrix a,
Matrix b)```
Return the product of the first and second matrix.
Parameters:
`a` - The first matrix.
`b` - The second matrix.
Returns:
The result of the multiplication.
• subtract

```public static Matrix subtract(Matrix a,
Matrix b)```
Return the results of subtracting one matrix from another.
Parameters:
`a` - The first matrix.
`b` - The second matrix.
Returns:
The results of the subtraction.
• transpose

`public static Matrix transpose(Matrix input)`
Return the transposition of a matrix.
Parameters:
`input` - The matrix to transpose.
Returns:
The matrix transposed.
• vectorLength

`public static double vectorLength(Matrix input)`
Calculate the length of a vector.
Parameters:
`input` - The matrix to calculate the length of.
Returns:
Vector length.
• determinant

`public static double determinant(Matrix m)`
• multiply

```public static double[] multiply(Matrix a,
double[] d)```