Documentation of 'jhplot.math.LinearAlgebra' Java class.
LinearAlgebra
jhplot.math

## Class LinearAlgebra

• ```public class LinearAlgebra
extends DoubleArray```
A collection of static methods for performing math operations on matrices and arrays. Advanced Linear Algebra methods (decompositions, norm, ...) are just call for JAMA routines.
• ### Constructor Summary

Constructors
Constructor and Description
`LinearAlgebra()`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static CholeskyDecomposition` `cholesky(double[][] v)`
`static double` `cond(double[][] v)`
`static double` `det(double[][] v)`
`static double[][]` ```divide(double[][] v1, double v)```
Divide each element of a matrix by a scalar
`static double[][]` ```divide(double[][] v1, double[]... v2)```
`static double[]` ```divide(double[] v1, double v)```
Divide each element of an array by a scalar.
`static double[]` ```divide(double[] v1, double[] v2)```
Element-wise ratio of two arrays.
`static double[][]` ```divideLU(double[][] v1, double[]... v2)```
`static double[][]` ```divideQR(double[][] v1, double[]... v2)```
`static EigenvalueDecomposition` `eigen(double[][] v)`
`static double[][]` `inverse(double[][] v1)`
`static double[][]` `inverseLU(double[][] v1)`
`static double[][]` `inverseQR(double[][] v1)`
`static LUDecomposition` `LU(double[][] v)`
`static double[][]` ```minus(double[][] v1, double v2)```
Subtract a scalar from each element of a matrix.
`static double[][]` ```minus(double[][] v1, double[][] v2)```
Element-wise subtraction of two matrices.
`static double[]` ```minus(double[] v1, double v)```
Subtracts a scalar value from each element of an array
`static double[]` ```minus(double[] v1, double[] v2)```
Element-wise subtraction of two arrays.
`static double[]` ```minus(double v, double[] v1)```
Subtracts each element of an array from a scalar value.
`static double[][]` ```minus(double v2, double[][] v1)```
Subtract each element of a matrix from a scalar.
`static double` `norm1(double[][] v)`
`static double` `norm2(double[][] v)`
`static double` `normF(double[][] v)`
`static double` `normInf(double[][] v)`
`static double[]` `plus(double[]... v)`
Element-wise sum of any number of arrays.
`static double[][]` ```plus(double[][] v1, double v2)```
Add a scalar to each element of a matrix.
`static double[][]` ```plus(double[][] v1, double[][] v2)```
Element-wise sum of two matrices
`static double[]` ```plus(double[] v1, double v)```
Add a scalar value to each element of an array.
`static QRDecomposition` `QR(double[][] v)`
`static double[][]` ```raise(double[][] v, double n)```
Raise each element of a matrix to a scalar power
`static double[]` ```raise(double[] v1, double n)```
Raise each element of an array to a scalar power.
`static int` `rank(double[][] v)`
`static SingularValueDecomposition` `singular(double[][] v)`
`static double[][]` ```solve(double[][] A, double[][] B)```
`static double[][]` ```solveTranspose(double[][] A, double[][] B)```
`static double[]` `times(double[]... v)`
Element-wise product of any number of arrays.
`static double[][]` ```times(double[][] v1, double v)```
Multiply each element in a matrix by a scalar
`static double[]` ```times(double[][] v1, double[] v2)```
Product of a matrix and a vector (array) according to the rules of linear algebra.
`static double[][]` ```times(double[][] v1, double[][] v2)```
Matrix multiplication according to the rules of linear algebra.
`static double[]` ```times(double[] v1, double v)```
Multiply each element of an array by a scalar.
`static double` `trace(double[][] v)`
• ### Methods inherited from class jhplot.math.DoubleArray

`add, add, buildXY, buildXY, checkColumnDimension, checkLength, checkRowDimension, columnVector, copy, copy, cumProduct, cumProduct, cumSum, cumSum, delete, deleteColumns, deleteColumnsRange, deleteRange, deleteRows, deleteRowsRange, diagonal, diagonal, f, f, fill, fill, findex, getColumnCopy, getColumnCopy, getColumnDimension, getColumnsCopy, getColumnsRangeCopy, getCopy, getDiagonal, getRangeCopy, getRowCopy, getRowsCopy, getRowsRangeCopy, getSubMatrixRangeCopy, identity, increment, increment, increment, increment, insert, insertColumns, insertRows, isColumnDimension, isLength, isRowDimension, main, max, max, maxIndex, maxIndex, merge, mergeColumns, mergeRows, min, min, minIndex, minIndex, one, one, one, one, product, product, random, random, random, random, random, resize, rowVector, sort, sort, sum, sum, throwError, toString, toString, transpose`
• ### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### LinearAlgebra

`public LinearAlgebra()`
• ### Method Detail

• #### minus

```public static double[] minus(double[] v1,
double[] v2)```
Element-wise subtraction of two arrays. Arrays must be same size.
Parameters:
`v1` - Minuend.
`v2` - Subtrahend
Returns:
Array v1 - v2
• #### minus

```public static double[] minus(double[] v1,
double v)```
Subtracts a scalar value from each element of an array
Parameters:
`v1` - Minuend Array.
`v` - Subtrahend scalar
Returns:
Array v1 - v
• #### minus

```public static double[] minus(double v,
double[] v1)```
Subtracts each element of an array from a scalar value.
Parameters:
`v` - Scalar Minuend
`v1` - Subtrahend array
Returns:
Array v - v1
• #### minus

```public static double[][] minus(double[][] v1,
double[][] v2)```
Element-wise subtraction of two matrices. Matrices must be same size.
Parameters:
`v1` - Minuend matrix
`v2` - Subtrahend matrix
Returns:
Matrix v1 - v2
• #### minus

```public static double[][] minus(double[][] v1,
double v2)```
Subtract a scalar from each element of a matrix.
Parameters:
`v1` - Minuend matrix
`v2` - Scalar subtrahend
Returns:
Matrix v1 - v2
• #### minus

```public static double[][] minus(double v2,
double[][] v1)```
Subtract each element of a matrix from a scalar.
Parameters:
`v2` - Scalar minuend
`v1` - Matrix subtrahend
Returns:
Matrix v2 - v1
• #### plus

`public static double[] plus(double[]... v)`
Element-wise sum of any number of arrays. Each array must be of same length.
Parameters:
`v` - Any number of arrays
Returns:
Element-wise sum of input arrays.
• #### plus

```public static double[] plus(double[] v1,
double v)```
Add a scalar value to each element of an array.
Parameters:
`v1` - Array
`v` - Scalar
Returns:
v1 + v
• #### plus

```public static double[][] plus(double[][] v1,
double[][] v2)```
Element-wise sum of two matrices
Parameters:
`v1` - Matrix
`v2` - Matrix
Returns:
Matrix v1 + v2
• #### plus

```public static double[][] plus(double[][] v1,
double v2)```
Add a scalar to each element of a matrix.
Parameters:
`v1` - Matrix
`v2` - Scalar
Returns:
Matrix v1 + v2
• #### times

`public static double[] times(double[]... v)`
Element-wise product of any number of arrays. Each array must be same size.
Parameters:
`v` - Any number of arrays.
Returns:
Array. i'th element = v1(i)*v2(i)*v3(i)...
• #### divide

```public static double[] divide(double[] v1,
double[] v2)```
Element-wise ratio of two arrays.
Parameters:
`v1` - Numerators
`v2` - Denominators
Returns:
Array. i'th element = v1(i)/v2(i)
• #### times

```public static double[] times(double[] v1,
double v)```
Multiply each element of an array by a scalar.
Parameters:
`v1` - Array
`v` - Scalar
Returns:
v1 * v
• #### times

```public static double[][] times(double[][] v1,
double v)```
Multiply each element in a matrix by a scalar
Parameters:
`v1` - Matrix
`v` - Scalar
Returns:
v1 * v
• #### divide

```public static double[] divide(double[] v1,
double v)```
Divide each element of an array by a scalar.
Parameters:
`v1` - Numerator Array
`v` - Scalar denominator
Returns:
Array. i'th element is v1(i)/v
• #### divide

```public static double[][] divide(double[][] v1,
double v)```
Divide each element of a matrix by a scalar
Parameters:
`v1` - Matrix numerator
`v` - Scalar denominator
Returns:
Matrix v1 / v
• #### raise

```public static double[] raise(double[] v1,
double n)```
Raise each element of an array to a scalar power.
Parameters:
`v1` - Array
`n` - Scalar exponent
Returns:
Array. i'th element is v(i)^n
• #### raise

```public static double[][] raise(double[][] v,
double n)```
Raise each element of a matrix to a scalar power
Parameters:
`v` - Matrix
`n` - exponent
Returns:
Matrix
• #### times

```public static double[][] times(double[][] v1,
double[][] v2)```
Matrix multiplication according to the rules of linear algebra. Matrices must be same size.
Parameters:
`v1` - Matrix
`v2` - Matrix
Returns:
Matrix v1 * v2
• #### times

```public static double[] times(double[][] v1,
double[] v2)```
Product of a matrix and a vector (array) according to the rules of linear algebra. Number of columns in v1 must equal number of elements in v2.
Parameters:
`v1` - m x n Matrix
`v2` - n element array
Returns:
m element array v1 * v2
`times(double[][], double[][])`
• #### divideLU

```public static double[][] divideLU(double[][] v1,
double[]... v2)```
• #### divideQR

```public static double[][] divideQR(double[][] v1,
double[]... v2)```
• #### divide

```public static double[][] divide(double[][] v1,
double[]... v2)```
• #### inverseLU

`public static double[][] inverseLU(double[][] v1)`
• #### inverseQR

`public static double[][] inverseQR(double[][] v1)`
• #### inverse

`public static double[][] inverse(double[][] v1)`
• #### solve

```public static double[][] solve(double[][] A,
double[][] B)```
• #### solveTranspose

```public static double[][] solveTranspose(double[][] A,
double[][] B)```
• #### eigen

`public static EigenvalueDecomposition eigen(double[][] v)`
• #### QR

`public static QRDecomposition QR(double[][] v)`
• #### LU

`public static LUDecomposition LU(double[][] v)`
• #### cholesky

`public static CholeskyDecomposition cholesky(double[][] v)`
• #### singular

`public static SingularValueDecomposition singular(double[][] v)`
• #### cond

`public static double cond(double[][] v)`
• #### det

`public static double det(double[][] v)`
• #### rank

`public static int rank(double[][] v)`
• #### trace

`public static double trace(double[][] v)`
• #### norm1

`public static double norm1(double[][] v)`
• #### norm2

`public static double norm2(double[][] v)`
• #### normF

`public static double normF(double[][] v)`
• #### normInf

`public static double normInf(double[][] v)`

DMelt 3.0 © DataMelt by jWork.ORG