|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.ObjectesraMath.BLA
Provides basic linear algebra routines such as vector additions, multiplications, inner, outer products, basic matrix operations such as transposition, inversion etc.
| Field Summary | |
static double |
TOLERANCE
|
| Constructor Summary | |
BLA()
|
|
| Method Summary | |
static double[][][] |
add(double[][][] t1,
double[][][] t2)
same as the other add's, but for tensors of rank 3. |
static double[][] |
add(double[][] m1,
double[][] m2)
add two matrices. |
static double[] |
add(double[] aa,
double[] bb)
add two vectors. |
static double |
angle(double[] i,
double[] j)
the (minimum) angle between two vectors. |
static int[] |
append(int[] aa,
int bb)
appends an int at the end of an int[]. |
static int[] |
append(int[] aa,
int[] bb)
concatenates two int[] |
static double[][] |
block(double[][] matrix,
int x1,
int y1,
int x2,
int y2)
|
static double[] |
circularPermutation(double[] vector,
int offset)
{x1, x2, -breakiterator , xn} -> {x(n - m), x(n - m + 1), breakiterator , x1, x2, breakiterator , x(n - m - 1)} |
static int[][] |
combinations(int[] aa,
int[] bb)
|
static double[] |
copy(double[] aa)
|
static double[][] |
copy(double[][] matrix)
|
static double |
cosab(double[] a,
double[] b)
the cos(angle) between two vectors. |
static double[] |
cross(double[] r1,
double[] r2)
the cross product of two 3-vectors. |
static double |
det3x3(double[][] a)
|
static double[][] |
diagonal(double[] diag)
generate a diagonal matrix with the elements of diag on its diagonal. |
static void |
diagonalizeSymmetric(double[][] matrix,
double[] eigenvalues)
public Method diagonalizeSymmetric diagonalizes a symmetric matrix by first reducing it to tridiagonal form (private void method: tred2) and then evaluating eigenvalues and eigenvectors using the QL algorithm (private void method tqli). |
static double[][] |
diagonalMatmul(double[] vector,
double[][] matrix)
fuctionally equivalent to matmul(diagonal(vector), matrix) but better performance |
static double |
distance(double[] i,
double[] j)
the distance between two vectors. |
static double |
dot(double[] r1,
double[] r2)
the dot product of two vectors |
static double[] |
flatten(double[][] matrix)
|
static double[][] |
flatten(double[][][] tensor)
|
static void |
floyd(int[][] matrix,
int Nnodes)
public Method floyd calculates the shortest path through an adjacency matrix. |
static void |
heapsort(double[] values,
int n,
int[] key)
|
static double[] |
invert(double[] aa)
{aa1, aa2, -breakiterator} -> { 1 / aa1, 1 / aa2, ...} |
static double[][] |
invert(double[][] matrix)
Naive and slow (but simple) matrix inversion routine ("Complete Gauss-Jordan"). |
static double[] |
matmul(double[][] mm,
double[] vv)
multiplication of an m x n matrix with an n-vector. |
static double[][] |
matmul(double[][] m1,
double[][] m2)
multiplication of an n x m - matrix with a m x k-matrix, resulting in an n x k - matrix. |
static double[] |
multiplyElements(double[] aa,
double[] weights)
element-wise multiplication of two vectors. |
static double |
norm(double[] r)
the euclidean norm of a vector |
static double |
norm2(double[] r)
the squared euclidean norm of a vector |
static double[] |
normalize(double[] r)
normalize a vector by scaling it by its inverse norm. |
static double[][] |
outer(double[] r1,
double[] r2)
Compute the outer product of two vectors r1, r2. |
static int[] |
range(int j)
|
static int[] |
range(int lower,
int upper)
|
static double[] |
same(int ii,
double value)
initialize a vector of length ii with values value |
static int[] |
same(int ii,
int value)
initialize a vector of length ii with values value |
static double[][][] |
scale(double[][][] tt,
double dd)
Scale a 3rd order tensor by some scalar. |
static double[][] |
scale(double[][] mm,
double vv)
|
static double[] |
scale(double[] aa,
double cc)
multiply all elements of a vector by some fixed number. |
static double[][] |
select(double[][] matrix,
int[] selection)
returns a selected number of rows of the matrix |
static double[] |
select(double[] array,
int[] selection)
returns a selected part of the array |
static int[] |
select(int[] array,
int[] selection)
returns a selected part of the array |
static double[][] |
shift(double[][] positions,
double[] change)
Add a N-vector change to each row of the M x N - Matrix positions. |
static void |
sort(double[][] mat,
double[] eigenvalues)
|
static double |
sqrt_sum(double a,
double b)
Return the (a^2 + b^2)^(1/2) without over- or underflow |
static double[][] |
subtract(double[][] m1,
double[][] m2)
subtract two matrices. |
static double[] |
subtract(double[] aa,
double[] bb)
subtract two vectors (bb - aa). |
static double |
sum(double[] r)
|
static void |
swapColumns(double[][] mat,
int i,
int j)
|
static java.lang.String |
toString(double[][] mm)
|
static java.lang.String |
toString(double[][] mm,
java.lang.String format)
|
static void |
tqli(double[][] matrix,
double[] diagonal,
double[] subdiagonal)
QL algorithm with implicit shifts, to determine the eigenvalues and eigenvectors of a real, symmetric, tridiagonal matrix |
static double[][] |
transpose(double[][] m1)
|
static int[][] |
transpose(int[][] m1)
|
private static void |
tred2(double[][] matrix,
double[] diagonal,
double[] offdiagonal)
Householder reduction of a real, symmetric matrix (double mat[][]) |
static int[] |
unique(int[] aa)
return the unique elements of the (sorted) array. |
static double[] |
zeroes(int ii)
|
static double[][] |
zeroes(int ii,
int jj)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final double TOLERANCE
| Constructor Detail |
public BLA()
| Method Detail |
public static int[] range(int lower,
int upper)
throws java.lang.IllegalArgumentException
lower - limit of the range (inclusive)upper - limit of the range (exclusive)
java.lang.IllegalArgumentExceptionpublic static int[] range(int j)
j - the upper limit of the range (exclusive).
public static int[] append(int[] aa,
int[] bb)
aa - the first onebb - the second one
public static int[] append(int[] aa,
int bb)
aa - the arraybb - the int to be appended
public static int[] unique(int[] aa)
aa - the array
public static int[] same(int ii,
int value)
ii - value -
public static double[] same(int ii,
double value)
ii - value -
public static double[] zeroes(int ii)
throws java.lang.IllegalArgumentException
ii - the size of the vector
java.lang.IllegalArgumentException
public static double[] circularPermutation(double[] vector,
int offset)
vector - offset -
public static double[] add(double[] aa,
double[] bb)
aa - bb -
java.lang.IllegalArgumentException
public static double[] subtract(double[] aa,
double[] bb)
throws java.lang.IllegalArgumentException
aa - bb -
java.lang.IllegalArgumentException
public static double[] multiplyElements(double[] aa,
double[] weights)
throws java.lang.IllegalArgumentException
aa - weights -
java.lang.IllegalArgumentException
public static double[] scale(double[] aa,
double cc)
aa - cc -
public static double[] copy(double[] aa)
aa -
public static double[] invert(double[] aa)
aa -
public static double[][] shift(double[][] positions,
double[] change)
positions - change -
public static double cosab(double[] a,
double[] b)
a - b -
public static final double angle(double[] i,
double[] j)
i - j -
public static final double distance(double[] i,
double[] j)
i - j -
public static final double dot(double[] r1,
double[] r2)
throws java.lang.IllegalArgumentException
r1 - r2 -
java.lang.IllegalArgumentExceptionpublic static final double norm2(double[] r)
r -
public static final double norm(double[] r)
r -
public static final double[] normalize(double[] r)
r -
public static final double[][] outer(double[] r1,
double[] r2)
throws java.lang.IllegalArgumentException
r1 - Vectorr2 - Vector
java.lang.IllegalArgumentException
public static final double[] cross(double[] r1,
double[] r2)
r1 - Vector (double[3]) 1 for the cross product calculationr2 - Vector (double[3]) 2 for the cross product calculation
public static final int[][] combinations(int[] aa,
int[] bb)
public static final int[] select(int[] array,
int[] selection)
array - selection -
public static final double[] select(double[] array,
int[] selection)
array - selection -
public static final double sum(double[] r)
r -
public static final double[][] zeroes(int ii,
int jj)
ii - jj -
public static final double[][] diagonal(double[] diag)
diag -
public static final double[] flatten(double[][] matrix)
matrix -
public static final double[][] flatten(double[][][] tensor)
tensor - a rank3 tensor
public static final double[][] add(double[][] m1,
double[][] m2)
m1 - m2 -
public static final double[][][] add(double[][][] t1,
double[][][] t2)
t1 - t2 -
public static final double[][][] scale(double[][][] tt,
double dd)
tt - dd -
public static final double[][] subtract(double[][] m1,
double[][] m2)
m1 - m2 -
public static final int[][] transpose(int[][] m1)
m1 -
public static final double[][] transpose(double[][] m1)
m1 -
public static final double det3x3(double[][] a)
a -
public static final double[][] matmul(double[][] m1,
double[][] m2)
m1 - m2 -
public static final double[][] diagonalMatmul(double[] vector,
double[][] matrix)
vector - matrix -
public static final double[] matmul(double[][] mm,
double[] vv)
mm - vv -
public static final double[][] scale(double[][] mm,
double vv)
mm - vv -
public static final double[][] copy(double[][] matrix)
matrix -
public static final double[][] select(double[][] matrix,
int[] selection)
matrix - selection -
public static final double[][] block(double[][] matrix,
int x1,
int y1,
int x2,
int y2)
matrix - x1 - y1 - x2 - y2 -
public static double[][] invert(double[][] matrix)
matrix -
public static void diagonalizeSymmetric(double[][] matrix,
double[] eigenvalues)
matrix - symmetric matrix double[][]eigenvalues - an array of eigenvalues double[]
private static void tred2(double[][] matrix,
double[] diagonal,
double[] offdiagonal)
matrix - real, symmetric matrix double[][], replaced by its orthogonal
matrix upon returndiagonal - returns the diagonal elements of the tridiagonal matrixoffdiagonal - returns the offdiagonal elements of the tridiagonal matrix
public static void tqli(double[][] matrix,
double[] diagonal,
double[] subdiagonal)
matrix - reduced matrix from householder reduction routine tred2diagonal - diagonal elements of the tridiagonal matrix; replaced the
eigenvalues upon return.subdiagonal - subdiagonal elements of the tridiagonal matrix
public static double sqrt_sum(double a,
double b)
a - b -
public static void sort(double[][] mat,
double[] eigenvalues)
public static void swapColumns(double[][] mat,
int i,
int j)
public static void floyd(int[][] matrix,
int Nnodes)
matrix - A double[Nnodes][Nnodes] adjacency matrix containing some distances.Nnodes - number of nodes in the matrix
public static void heapsort(double[] values,
int n,
int[] key)
public static java.lang.String toString(double[][] mm,
java.lang.String format)
public static java.lang.String toString(double[][] mm)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||