|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.ttools.plot.Matrices
public class Matrices
Utility class for linear algebra in 3-dimensional space. The array arguments to the methods here are either 3-element arrays representing 3-d vectors
( v[0], v[1], v[2] )or 9-element arrays representing 3-d matrices:
( m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8] )
Constructor Summary | |
---|---|
Matrices()
|
Method Summary | |
---|---|
static double[] |
adj(double[] m)
Calculates the adjoint of a matrix. |
static double[] |
cross(double[] a,
double[] b)
Calculates the vector (cross) product of two vectors. |
static double |
det(double[] m)
Calculates the determinant of a matrix. |
static double |
dot(double[] a,
double[] b)
Calclulates the scalar (dot) product of two vectors. |
static double[] |
fromPal(double[][] m)
Converts a 3-d matrix from Pal-friendly form (3x3) to the form used elsewhere in this class (flat 9-element array). |
static double[] |
invert(double[] m)
Inverts a matrix. |
static double[] |
mmMult(double[] a,
double[] b)
Multiplies two matrices together. |
static double |
mod(double[] v)
Calculates the modulus of a vector. |
static double[] |
mult(double[] v,
double c)
Multiplies a vector by a constant. |
static double[] |
mvMult(double[] m,
double[] v)
Multiplies a matrix by a vector. |
static double[] |
normalise(double[] v)
Normalises a vector. |
static double[][] |
toPal(double[] m)
Converts a 3-d matrix from the form used in this class (flat 9-element array) to Pal-friendly form (3x3). |
static String |
toString(double[] a)
Returns a string giving the contents of an arbitrary length vector. |
static double[] |
transpose(double[] a)
Returns the transpose of a 3x3 matrix. |
static double[] |
unit(int iaxis)
Returns a unit vector along an indicated axis. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Matrices()
Method Detail |
---|
public static double[] adj(double[] m)
m
- input matrix as 9-element array
public static double det(double[] m)
m
- input matrix as 9-element array
public static double[] invert(double[] m)
m
- input matrix as 9-element array
public static double dot(double[] a, double[] b)
a
- vector 1b
- vector 2
public static double[] cross(double[] a, double[] b)
a
- vector 1b
- vector 2
public static double[] transpose(double[] a)
a
- input matrix
public static double[] unit(int iaxis)
iaxis
- index of axis (0, 1 or 2)
iaxis
public static double mod(double[] v)
v
- input vector
|v|
public static double[] normalise(double[] v)
v
- input vector
|v|
public static double[] mult(double[] v, double c)
v
- vector of arbitrary lengthc
- constant factor
public static double[] mvMult(double[] m, double[] v)
m
- input matrix as 9-element arrayv
- input vector as 3-element array
public static double[] mmMult(double[] a, double[] b)
a
- input matrix 1 as 9-element arrayb
- input matrix 2 as 9-element array
public static String toString(double[] a)
a
- array
a
public static double[] fromPal(double[][] m)
m
- flat matrix
public static double[][] toPal(double[] m)
m
- flat matrix
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |