public abstract class Matrix2dBase extends DenseMatrixBase implements Clonable
Matrix.Partition, Matrix.WriteFormat
Modifier and Type | Field and Description |
---|---|
double |
m00
Matrix element (0,0)
|
double |
m01
Matrix element (0,1)
|
double |
m10
Matrix element (1,0)
|
double |
m11
Matrix element (1,1)
|
INDEFINITE, POSITIVE_DEFINITE, SPD, SYMMETRIC
Constructor and Description |
---|
Matrix2dBase() |
Modifier and Type | Method and Description |
---|---|
Matrix2dBase |
clone() |
int |
colSize()
Returns the number of columns in this matrix (which is always 2).
|
double |
determinant()
Returns the determinant of this matrix
|
boolean |
epsilonEquals(Matrix2dBase M1,
double epsilon)
Returns true if the elements of this matrix equal those of matrix
M1 within a prescribed tolerance epsilon . |
boolean |
equals(Matrix2dBase M1)
Returns true if the elements of this matrix exactly equal those of matrix
M1 . |
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,
Vector2d col)
Copies a column of this matrix into a 2-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,
Vector2d row)
Copies a row of this matrix into a 2-vector.
|
double |
infinityNorm()
Returns the infinity norm of this matrix.
|
boolean |
invert()
Inverts this matrix in place, returning false if the matrix is detected to
be singular.
|
void |
mul(Vector2d vr)
Multiplies this matrix by the column vector vr and places the result back
into vr.
|
void |
mul(Vector2d vr,
Vector2d 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(Vector2d vr,
Vector2d v1,
Vector2d v2)
Multiplies this matrix by the column vector v1, adds the vector v2, and
places the result in the vector vr.
|
boolean |
mulInverse(Vector2d vr)
Multiplies the column vector vr by the inverse of this matrix and places
the result back in vr.
|
boolean |
mulInverse(Vector2d vr,
Vector2d v1)
Multiplies the column vector v1 by the inverse of this matrix and places
the result in vr.
|
boolean |
mulInverseTranspose(Vector2d vr)
Multiplies the column vector vr by the inverse transpose of this matrix
and places the result back in vr.
|
boolean |
mulInverseTranspose(Vector2d vr,
Vector2d v1)
Multiplies the column vector v1 by the inverse transpose of this matrix
and places the result in vr.
|
void |
mulTranspose(Vector2d vr)
Multiplies the transpose of this matrix by the vector vr and places the
result back in vr.
|
void |
mulTranspose(Vector2d vr,
Vector2d v1)
Multiplies the transpose of this matrix by the vector v1 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.
|
double |
oneNorm()
Returns the 1 norm of this matrix.
|
int |
rowSize()
Returns the number of rows in this matrix (which is always 2).
|
void |
set(double[] vals)
Sets the elements of this matrix from an array of doubles.
|
void |
set(double m00,
double m01,
double m10,
double m11)
Sets the matrix elements
|
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(Matrix2dBase 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,
Vector2d col)
Sets a column of this matrix to the specified 2-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,
Vector2d row)
Sets a row of this matrix to the specified 2-vector.
|
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, isSymmetric, isWritable, maxNorm, mul, mul, mulAdd, mulAdd, mulAdd, mulTranspose, mulTranspose, mulTranspose, mulTransposeAdd, mulTransposeAdd, mulTransposeAdd, numNonZeroVals, numNonZeroVals, scan, scan, setCRSValues, setDefaultFormat, setSize, toString, toString, toString, trace, 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, isSymmetric, maxNorm, mul, mul, mulAdd, mulAdd, mulAdd, mulTranspose, mulTranspose, mulTranspose, mulTransposeAdd, mulTransposeAdd, mulTransposeAdd, numNonZeroVals, numNonZeroVals, scan, setSize, toString, toString, trace, write, write, write
public double m00
public double m01
public double m10
public double m11
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, Vector2d col)
j
- column indexcol
- 2-vector into which the column is copiedpublic 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 getRow(int i, Vector2d row)
i
- row indexrow
- 2-vector into which the row is copiedpublic final 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 set(double m00, double m01, double m10, double m11)
m00
- top-leftm01
- top-rightm10
- bottom-leftm11
- bottom-rightpublic 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, Vector2d col)
j
- column indexcol
- 2-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, Vector2d row)
i
- row indexrow
- 2-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(Matrix2dBase M)
M
- matrix whose values are to be copiedpublic void mul(Vector2d vr, Vector2d 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(Vector2d vr, Vector2d v1, Vector2d v2)
vr = M v1 + v2
vr
- result vectorv1
- vector to multiply byv2
- vector to addpublic void mul(Vector2d vr)
vr = M vr
vr
- vector to multiply (in place)public void mulTranspose(Vector2d vr, Vector2d v1)
vr = v1 M
vr
- result vectorv1
- vector to multiply bypublic void mulTranspose(Vector2d vr)
vr = vr M
vr
- vector to multiply by (in place)public boolean mulInverse(Vector2d vr, Vector2d v1)
vr
- result vectorv1
- vector to multiply bypublic boolean mulInverse(Vector2d vr)
vr
- vector to multiply by (in place)public boolean mulInverseTranspose(Vector2d vr, Vector2d v1)
vr
- result vectorv1
- vector to multiply bypublic boolean mulInverseTranspose(Vector2d vr)
vr
- vector to multiply by (in place)public 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 negate()
public void transpose()
public void setIdentity()
public boolean epsilonEquals(Matrix2dBase M1, double epsilon)
M1
within a prescribed tolerance epsilon
.M1
- matrix to compare withepsilon
- comparison tolerancepublic boolean equals(Matrix2dBase 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 double determinant() throws ImproperSizeException
determinant
in interface Matrix
determinant
in class MatrixBase
ImproperSizeException
- if the matrix is not squarepublic Matrix2dBase clone()