public class LinearAlgebra extends Object
Note that for the purpose of performance the calculation functions do no argument checking.
Constructor and Description |
---|
LinearAlgebra() |
Modifier and Type | Method and Description |
---|---|
static double |
innerProduct(double[][] a,
double[][] b,
int i,
int j)
Calculates the inner product of a row in a matrix and a column in another matrix.
|
static double |
innerProduct(double[] a,
double[] b)
Returns the inner product of two vectors.
|
static double |
innerProduct(double[] a,
double[][] b,
int j)
Calculates the inner product of a vector and a column in a matrix.
|
static boolean |
isMatrix(double[][] array)
Tests if a given
double[][] array is a matrix. |
static boolean |
isMatrix(int rowCount,
int colCount,
double[][] array)
Tests if a given
double[][] array is a matrix with a prescribed number of
rows and columns. |
static double[] |
multiply(double[][] a,
double[] b)
Multiplies a matrix by a vector (from the right).
|
static double[][] |
multiply(double[][] a,
double[][] b)
Multiplies two matrixes.
|
static double[][] |
multiply(double[][] a,
double[][] b,
double[][] c)
Multiplies two matrixes.
|
static double[] |
multiply(double[][] a,
double[] b,
double[] c)
Multiplies a matrix by a vector (from the right).
|
static double[] |
multiply(double[] b,
double c)
Multiplies a vector by a scalar.
|
static double[] |
multiply(double[] b,
double[][] a)
Multiplies a matrix by a vector (from the left).
|
static double[] |
multiply(double[] b,
double[][] a,
double[] c)
Multiplies a matrix by a vector (from the left).
|
static double[] |
multiplyAndSubtract(double[] b,
double[][] a,
double s)
Multiplies a matrix by a vector (from the left) and subtracts a scalar.
|
static double[] |
multiplyAndSubtract(double[] b,
double[][] a,
double s,
double[] c)
Multiplies a matrix by a vector (from the left) and subtracts a scalar.
|
static double[][] |
outerProduct(double[] a,
double[] b)
Returns the outer product of two vectors.
|
static double[][] |
outerProduct(double[] a,
double[] b,
double[][] c)
Returns the outer product of two vectors.
|
static double[][] |
subtract(double[][] a,
double[] b,
double[] c)
Subtracts the outer product of two vectors from a matrix.
|
public static boolean isMatrix(double[][] array)
double[][]
array is a matrix.array
- the array.true
if the given array is a matrix, false
otherwise.public static boolean isMatrix(int rowCount, int colCount, double[][] array)
double[][]
array is a matrix with a prescribed number of
rows and columns.rowCount
- the prescribed number of rows. If zero or negative, any number of
rows is accepted.colCount
- the prescribed number of columns. If zero or negative, any number
of columns is accepted.array
- the array.true
if the given array is a matrix, false
otherwise.public static double[] multiply(double[] b, double c)
b
- the vector to be multiplied. On return contains the result.c
- the scalar.public static double[] multiply(double[][] a, double[] b)
a
- the matrix.b
- the vector.public static double[] multiply(double[][] a, double[] b, double[] c)
a
- the matrix.b
- the vector.c
- the result vector.public static double[] multiply(double[] b, double[][] a)
b
- the vector.a
- the matrix.public static double[] multiply(double[] b, double[][] a, double[] c)
b
- the vector.a
- the matrix.c
- the result vector.public static double[] multiplyAndSubtract(double[] b, double[][] a, double s)
b
- the vector.a
- the matrix.s
- the scalar.public static double[] multiplyAndSubtract(double[] b, double[][] a, double s, double[] c)
b
- the vector.a
- the matrix.s
- the scalar.c
- the result vector.public static double innerProduct(double[] a, double[] b)
a
- the first vector.b
- the second vector.public static double innerProduct(double[] a, double[][] b, int j)
a
- the vector.b
- the matrix.j
- the index of a column in b
.a
and the ith column in b
.public static double innerProduct(double[][] a, double[][] b, int i, int j)
a
- the first matrix.b
- the second matrix.i
- the index of a row in a
.j
- the index of a column in b
.a
and the jth column in b
.public static double[][] outerProduct(double[] a, double[] b)
a
- the first vector.b
- the second vector.public static double[][] outerProduct(double[] a, double[] b, double[][] c)
a
- the first vector.b
- the second vector.c
- the result vector.public static double[][] multiply(double[][] a, double[][] b)
a
- the first matrix.b
- the second matrix.public static double[][] multiply(double[][] a, double[][] b, double[][] c)
a
- the first matrix.b
- the second matrix.c
- the result matrix.public static double[][] subtract(double[][] a, double[] b, double[] c)
a
- the matrix. On return contains the result matrix.b
- the first vector.c
- the second vector.Copyright © 2014–2015 European Space Agency (ESA). All rights reserved.