|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectRdcPanda.Matrix
public class Matrix
This class is modified from the Jama numeric package. Written by Lincong Wang (2001-2005).
Constructor Summary | |
---|---|
Matrix(double[][] A)
Construct a matrix from a 2-D array. |
|
Matrix(double[][] A,
int m,
int n)
Construct a matrix quickly without checking arguments. |
|
Matrix(double[] vals,
int m)
Construct a matrix from a one-dimensional packed array. |
|
Matrix(int m,
int n)
Construct an m-by-n matrix of zeros. |
|
Matrix(int m,
int n,
double s)
Construct an m-by-n constant matrix. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Clone the Matrix object. |
Matrix |
copy()
Make a deep copy of a matrix. |
static double |
det(double[][] a)
Generate identity matrix. |
Matrix |
eulerMat(double alpha,
double beta,
double gamma)
A method for generating an euler Matrix from three Euler angles. |
double |
get(int i,
int j)
Get a single element. |
double[][] |
getArray()
Access the internal two-dimensional array. |
double[][] |
getArrayCopy()
Copy the internal two-dimensional array. |
int |
getColumnDimension()
Get column dimension. |
int |
getRowDimension()
Get row dimension. |
static Matrix |
identity(int m,
int n)
Generate identity matrix. |
Matrix |
minus(Matrix B)
C = A - B. |
double |
norm1()
One norm. |
Matrix |
plus(Matrix B)
C = A + B. |
void |
print(int w,
int d)
Print the matrix to stdout. |
void |
print(java.text.NumberFormat format,
int width)
Prints the. |
void |
print(java.io.PrintWriter output,
int w,
int d)
Print the matrix to the output stream. |
void |
print(java.io.PrintWriter output,
java.text.NumberFormat format,
int width)
Print the matrix to the output stream. |
Matrix |
rotationMat(double theta,
java.lang.String axis)
make a 3x3 rotation matrix with a rotation angle theta and along an axis Please note that only axis only take +/-x, y, z A method by Lincong Wang. |
void |
set(int i,
int j,
double s)
Set a single element. |
SingularValueDecomposition |
svd()
Singular Value Decomposition. |
Matrix |
times(double s)
Multiply a matrix by a scalar, C = s*A. |
double[] |
times(double[] B)
Times. |
Matrix |
times(Matrix B)
Linear algebraic matrix multiplication, A * B. |
double |
trace()
Trace. |
Matrix |
transpose()
Matrix transpose. |
Matrix |
uminus()
-a of every elements. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Matrix(int m, int n)
m
- Number of rows.n
- Number of colums.public Matrix(int m, int n, double s)
m
- Number of rows.n
- Number of colums.s
- Fill the matrix with this scalar value.public Matrix(double[][] A)
A
- Two-dimensional array of doubles.
java.lang.IllegalArgumentException
- All rows must have the same lengthpublic Matrix(double[][] A, int m, int n)
A
- Two-dimensional array of doubles.m
- Number of rows.n
- Number of colums.public Matrix(double[] vals, int m)
vals
- One-dimensional array of doubles, packed by columns (ala Fortran).m
- Number of rows.
java.lang.IllegalArgumentException
- Array length must be a multiple of m.Method Detail |
---|
public Matrix copy()
public Matrix rotationMat(double theta, java.lang.String axis)
theta
- the rotation angleaxis
- the axis along which the rotation is made
public Matrix eulerMat(double alpha, double beta, double gamma)
alpha
- the alpha anglebeta
- the beta anglegamma
- the gamma angle
public java.lang.Object clone()
clone
in class java.lang.Object
public double[][] getArray()
public double[][] getArrayCopy()
public int getRowDimension()
public int getColumnDimension()
public double get(int i, int j)
i
- Row index.j
- Column index.
java.lang.ArrayIndexOutOfBoundsException
public void set(int i, int j, double s)
i
- Row index.j
- Column index.s
- A(i,j).
java.lang.ArrayIndexOutOfBoundsException
public Matrix transpose()
public Matrix uminus()
public Matrix plus(Matrix B)
B
- another matrix
public Matrix minus(Matrix B)
B
- another matrix
public Matrix times(double s)
s
- scalar
public Matrix times(Matrix B)
B
- another matrix
java.lang.IllegalArgumentException
- Matrix inner dimensions must agree.public double[] times(double[] B)
B
- the b
public double norm1()
public double trace()
public void print(int w, int d)
w
- Column width.d
- Number of digits after the decimal.public void print(java.io.PrintWriter output, int w, int d)
output
- Output stream.w
- Column width.d
- Number of digits after the decimal.public void print(java.text.NumberFormat format, int width)
format
- the formatwidth
- the widthpublic void print(java.io.PrintWriter output, java.text.NumberFormat format, int width)
output
- the output stream.format
- A formatting object to format the matrix elementswidth
- Column width.DecimalFormat.setDecimalFormatSymbols(java.text.DecimalFormatSymbols)
public SingularValueDecomposition svd()
SingularValueDecomposition
public static Matrix identity(int m, int n)
m
- Number of rows.n
- Number of colums.
public static double det(double[][] a)
a
- the a
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |