public abstract class Matrix3dBase extends DenseMatrixBase implements java.io.Serializable, Clonable
Matrix.Partition, Matrix.WriteFormat
Modifier and Type | Field and Description |
---|---|
double |
m00
Matrix element (0,0)
|
double |
m01
Matrix element (0,1)
|
double |
m02
Matrix element (0,2)
|
double |
m10
Matrix element (1,0)
|
double |
m11
Matrix element (1,1)
|
double |
m12
Matrix element (1,2)
|
double |
m20
Matrix element (2,0)
|
double |
m21
Matrix element (2,1)
|
double |
m22
Matrix element (2,2)
|
INDEFINITE, POSITIVE_DEFINITE, SPD, SYMMETRIC
Constructor and Description |
---|
Matrix3dBase() |
Modifier and Type | Method and Description |
---|---|
Matrix3dBase |
clone() |
int |
colSize()
Returns the number of columns in this matrix (which is always 3).
|
double |
determinant()
Returns the determinant of this matrix
|
boolean |
epsilonEquals(Matrix3dBase M1,
double eps)
Returns true if the elements of this matrix equal those of matrix
M1 within a prescribed tolerance epsilon . |
boolean |
equals(Matrix3dBase M1)
Returns true if the elements of this matrix exactly equal those of matrix
M1 . |
void |
factorQR(Matrix3dBase Q,
Matrix3dBase R)
Computes the QR decompostion for this matrix, for which
|
double |
frobeniusNorm()
Returns the Frobenius norm of this matrix.
|
void |
get(double[] values)
Copies the elements of this matrix into an array of doubles.
|
double |
get(int i,
int j)
Gets a single element of this matrix.
|
void |
getColumn(int j,
double[] values)
Copies a column of this matrix into an array of doubles.
|
void |
getColumn(int j,
double[] values,
int off)
Copies a column of this matrix into an array of doubles, starting at a
specified offset.
|
void |
getColumn(int j,
Vector3d col)
Copies a column of this matrix into a 3-vector.
|
void |
getRow(int i,
double[] values)
Copies a row of this matrix into an array of doubles.
|
void |
getRow(int i,
double[] values,
int off)
Copies a row of this matrix into an array of doubles, starting at a
specified offset.
|
void |
getRow(int i,
Vector3d row)
Copies a row of this matrix into a 3-vector.
|
double |
infinityNorm()
Returns the infinity norm of this matrix.
|
void |
inverseTransform(RotationMatrix3d R,
Matrix3dBase M1)
Applies an inverse rotational transformation R to a matrix M1 and place
the result in this matrix.
|
boolean |
invert()
Inverts this matrix in place, returning false if the matrix is detected to
be singular.
|
boolean |
isIdentity()
Returns true if this matrix equals the identity.
|
boolean |
isSymmetric(double tol)
Returns true if this matrix is symmetric within a given absolute
tolerance.
|
static void |
main(java.lang.String[] args) |
void |
mul(Matrix3dBase M1,
Matrix3dBase M2)
Multiplies matrix M1 by M2 and places the result in this matrix.
|
void |
mul(Vector3d vr)
Multiplies this matrix by the column vector vr and places the result back
into vr.
|
void |
mul(Vector3d vr,
Vector3d v1)
Multiplies this matrix by the column vector v1 and places the result in
the vector vr.
|
void |
mul(VectorNd vr,
VectorNd v1)
Multiplies this matrix by the column vector v1 and places the result in
the vector vr.
|
void |
mulAdd(Matrix M1,
Matrix M2)
Multiplies M1 by M2 and places the result in this matrix.
|
void |
mulAdd(Vector3d vr,
Vector3d v1,
Vector3d v2)
Multiplies this matrix by the column vector v1, adds the vector v2, and
places the result in the vector vr.
|
boolean |
mulInverse(Vector3d vr)
Multiplies the column vector vr by the inverse of this matrix and places
the result back in vr.
|
boolean |
mulInverse(Vector3d vr,
Vector3d v1)
Multiplies the column vector v1 by the inverse of this matrix and places
the result in vr.
|
boolean |
mulInverseTranspose(Vector3d vr)
Multiplies the column vector vr by the inverse transpose of this matrix
and places the result back in vr.
|
boolean |
mulInverseTranspose(Vector3d vr,
Vector3d v1)
Multiplies the column vector v1 by the inverse transpose of this matrix
and places the result in vr.
|
void |
mulTranspose(Vector3d vr)
Multiplies the transpose of this matrix by the vector vr and places the
result back in vr.
|
void |
mulTranspose(Vector3d vr,
Vector3d v1)
Multiplies the transpose of this matrix by the vector v1 and places the
result in vr.
|
void |
mulTransposeAdd(Vector3d vr,
Vector3d v1,
Vector3d v2)
Multiplies the transpose of this matrix by the vector v1, adds the vector
v2, and places the result in vr.
|
void |
mulTransposeLeftAdd(Matrix M1,
Matrix M2)
Multiplies M1^T by M2 and places the result in this matrix.
|
void |
mulTransposeRightAdd(Matrix M1,
Matrix M2)
Multiplies M1 by M2^T and places the result in this matrix.
|
void |
negate()
Negates this matrix in place.
|
void |
negateColumn(int colIdx)
Negates a column of this matrix.
|
void |
negateRow(int rowIdx)
Negates a row of this matrix.
|
double |
oneNorm()
Returns the 1 norm of this matrix.
|
double |
orthogonalDeterminant()
Returns the determinant of this matrix, assuming that it is orthogonal.
|
int |
rowSize()
Returns the number of rows in this matrix (which is always 3).
|
void |
scaleColumn(int j,
double s)
Scale a column
|
void |
scaleRow(int i,
double s)
Scale a row by a particular value
|
void |
set(double[] vals)
Sets the elements of this matrix from an array of doubles.
|
void |
set(int i,
int j,
double value)
Sets a single element of this matrix.
|
void |
set(Matrix M)
Sets the values of this matrix to those of matrix M.
|
void |
set(Matrix3dBase M)
Sets the values of this matrix to those of matrix M.
|
void |
setColumn(int j,
double[] values)
Sets a column of this matrix from an array of doubles.
|
void |
setColumn(int j,
Vector3d col)
Sets a column of this matrix to the specified 3-vector.
|
void |
setIdentity()
Sets this matrix to the identity.
|
void |
setRow(int i,
double[] values)
Set a row of this matrix from an array of doubles.
|
void |
setRow(int i,
Vector3d row)
Sets a row of this matrix to the specified 3-vector.
|
boolean |
solve(Vector3d x,
Vector3d b)
Solves this matrix for
x given a right hand side
b , returning false if the matrix is detected
to be singular. |
boolean |
solveTranspose(Vector3d x,
Vector3d b)
Solves the transpose of this matrix for
x given a right hand
side b , returning false if the matrix is
detected to be singular. |
double |
trace()
Returns the trace of this matrix.
|
void |
transpose()
Transposes this matrix in place.
|
add, checkConsistency, set, set, set, setCCSValues, setColumn, setCRSValues, setRandom, setRow, setSubMatrix
containsNaN, epsilonEquals, equals, frobeniusNormSquared, get, getCCSIndices, getCCSIndices, getCCSIndices, getCCSValues, getCCSValues, getCCSValues, getColumn, getCRSIndices, getCRSIndices, getCRSIndices, getCRSValues, getCRSValues, getCRSValues, getDefaultFormat, getRow, getSize, getSubMatrix, hasNaN, idString, isFixedSize, isWritable, maxNorm, mul, mul, mulAdd, mulAdd, mulAdd, mulTranspose, mulTranspose, mulTranspose, mulTransposeAdd, mulTransposeAdd, mulTransposeAdd, numNonZeroVals, numNonZeroVals, scan, scan, setCRSValues, setDefaultFormat, setSize, toString, toString, toString, write, write, write, write, write, write, write, writeToFile
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
epsilonEquals, equals, frobeniusNormSquared, getCCSIndices, getCCSIndices, getCCSIndices, getCCSValues, getCCSValues, getCCSValues, getColumn, getCRSIndices, getCRSIndices, getCRSIndices, getCRSValues, getCRSValues, getCRSValues, getRow, getSize, getSubMatrix, isFixedSize, maxNorm, mul, mul, mulAdd, mulAdd, mulAdd, mulTranspose, mulTranspose, mulTranspose, mulTransposeAdd, mulTransposeAdd, mulTransposeAdd, numNonZeroVals, numNonZeroVals, scan, setSize, toString, toString, write, write, write
public double m00
public double m01
public double m02
public double m10
public double m11
public double m12
public double m20
public double m21
public double m22
public final int rowSize()
rowSize
in interface LinearTransformNd
rowSize
in interface Matrix
rowSize
in class MatrixBase
public final int colSize()
colSize
in interface LinearTransformNd
colSize
in interface Matrix
colSize
in class MatrixBase
public double get(int i, int j)
get
in interface Matrix
get
in class MatrixBase
i
- element row indexj
- element column indexpublic void get(double[] values)
(i,j)
is
stored at location i*colSize()+j
.get
in interface Matrix
get
in class MatrixBase
values
- array into which values are copiedpublic void getColumn(int j, double[] values)
getColumn
in interface Matrix
getColumn
in class MatrixBase
j
- column indexvalues
- array into which the column is copiedpublic void getColumn(int j, double[] values, int off)
getColumn
in interface Matrix
getColumn
in class MatrixBase
j
- column indexvalues
- array into which the column is copiedoff
- offset in values where copying should beginpublic void getColumn(int j, Vector3d col)
j
- column indexcol
- 3-vector into which the column is copiedpublic void scaleColumn(int j, double s)
public void getRow(int i, double[] values)
getRow
in interface Matrix
getRow
in class MatrixBase
i
- row indexvalues
- array into which the row is copiedpublic void getRow(int i, double[] values, int off)
getRow
in interface Matrix
getRow
in class MatrixBase
i
- row indexvalues
- array into which the row is copiedoff
- offset in values where copying should beginpublic void scaleRow(int i, double s)
public void getRow(int i, Vector3d row)
i
- row indexrow
- 3-vector into which the row is copiedpublic void set(int i, int j, double value)
set
in interface DenseMatrix
set
in class DenseMatrixBase
i
- element row indexj
- element column indexvalue
- element valuepublic void set(double[] vals)
(i,j)
is stored at location i*colSize()+j
.set
in interface DenseMatrix
set
in class DenseMatrixBase
vals
- array from which values are copiedpublic void setColumn(int j, double[] values)
setColumn
in interface DenseMatrix
setColumn
in class DenseMatrixBase
j
- column indexvalues
- array from which column values are copiedpublic void setColumn(int j, Vector3d col)
j
- column indexcol
- 3-vector from which the column is copiedpublic void setRow(int i, double[] values)
setRow
in interface DenseMatrix
setRow
in class DenseMatrixBase
i
- row indexvalues
- array from which the row is copiedpublic void setRow(int i, Vector3d row)
i
- row indexrow
- 3-vector from which the row is copiedpublic void set(Matrix M)
set
in interface Matrix
set
in class DenseMatrixBase
M
- matrix whose values are to be copiedpublic void set(Matrix3dBase M)
M
- matrix whose values are to be copiedpublic void mul(Matrix3dBase M1, Matrix3dBase M2)
M1
- left-hand matrixM2
- right-hand matrixpublic void inverseTransform(RotationMatrix3d R, Matrix3dBase M1)
R^T M1 R
R
- rotational transformation matrixM1
- matrix to transformpublic void mulAdd(Matrix M1, Matrix M2)
M1
- left matrix termM2
- right matrix termpublic void mulTransposeRightAdd(Matrix M1, Matrix M2)
M1
- left matrix termM2
- right matrix termpublic void mulTransposeLeftAdd(Matrix M1, Matrix M2)
M1
- left matrix termM2
- right matrix termpublic void mul(Vector3d vr, Vector3d v1)
vr = M v1
vr
- result vectorv1
- vector to multiply bypublic void mul(VectorNd vr, VectorNd v1)
vr = M v1
mul
in interface LinearTransformNd
mul
in interface Matrix
mul
in class MatrixBase
vr
- result vectorv1
- vector to multiply bypublic void mulAdd(Vector3d vr, Vector3d v1, Vector3d v2)
vr = M v1 + v2
vr
- result vectorv1
- vector to multiply byv2
- vector to addpublic void mul(Vector3d vr)
vr = M vr
vr
- vector to multiply (in place)public void mulTranspose(Vector3d vr, Vector3d v1)
vr = v1 M
vr
- result vectorv1
- vector to multiply bypublic void mulTransposeAdd(Vector3d vr, Vector3d v1, Vector3d v2)
vr = v1 M + v2
vr
- result vectorv1
- vector to multiply byv2
- vector to addpublic void mulTranspose(Vector3d vr)
vr = vr M
vr
- vector to multiply by (in place)public boolean mulInverse(Vector3d vr, Vector3d v1)
solve(vr,v1)
.vr
- result vectorv1
- vector to multiply bypublic boolean mulInverse(Vector3d vr)
vr
- vector to multiply by (in place)public boolean mulInverseTranspose(Vector3d vr, Vector3d v1)
solveTranspose(vr,v1)
.vr
- result vectorv1
- vector to multiply bypublic boolean mulInverseTranspose(Vector3d vr)
vr
- vector to multiply by (in place)public void negate()
public void transpose()
public void setIdentity()
public boolean epsilonEquals(Matrix3dBase M1, double eps)
M1
within a prescribed tolerance epsilon
.M1
- matrix to compare witheps
- comparison tolerancepublic boolean equals(Matrix3dBase M1)
M1
.M1
- matrix to compare withpublic double infinityNorm()
infinityNorm
in interface Matrix
infinityNorm
in class MatrixBase
public double oneNorm()
oneNorm
in interface Matrix
oneNorm
in class MatrixBase
public double frobeniusNorm()
frobeniusNorm
in interface Matrix
frobeniusNorm
in class MatrixBase
public boolean invert()
public boolean solve(Vector3d x, Vector3d b)
x
given a right hand side
b
, returning false
if the matrix is detected
to be singular. The solution is computed using partial pivoting.x
- resultb
- right hand sidepublic boolean solveTranspose(Vector3d x, Vector3d b)
x
given a right hand
side b
, returning false
if the matrix is
detected to be singular. The solution is computed using partial pivoting.x
- resultb
- right hand sidepublic double determinant() throws ImproperSizeException
determinant
in interface Matrix
determinant
in class MatrixBase
ImproperSizeException
- if the matrix is not squarepublic boolean isIdentity()
public double orthogonalDeterminant()
public void factorQR(Matrix3dBase Q, Matrix3dBase R)
M = Q Rwhere Q is orthogonal and R is upper triangular.
Q
- if non-null, returns QR
- if non-null, returns R
The computation is the same as that performed by the QRDecomposition
class, except significantly faster.public Matrix3dBase clone()
public double trace()
trace
in interface Matrix
trace
in class MatrixBase
public boolean isSymmetric(double tol)
isSymmetric
in interface Matrix
isSymmetric
in class MatrixBase
tol
- absolute tolerance for checking equality of off-diagonal elementspublic void negateColumn(int colIdx)
colIdx
- index of the column to negatepublic void negateRow(int rowIdx)
rowIdx
- index of the row to negatepublic static void main(java.lang.String[] args)