public class Matrix2d extends Matrix2dBase implements VectorObject<Matrix2d>
Matrix.Partition, Matrix.WriteFormat
Modifier and Type | Field and Description |
---|---|
static Matrix2d |
IDENTITY
Global identity matrix.
|
static Matrix2d |
ZERO
Global zero matrix.
|
m00, m01, m10, m11
INDEFINITE, POSITIVE_DEFINITE, SPD, SYMMETRIC
Constructor and Description |
---|
Matrix2d()
Creates a matrix and initializes it to zero.
|
Matrix2d(double[] vals)
Creates a matrix and initializes its elements from an array of values.
|
Matrix2d(double m00,
double m01,
double m10,
double m11)
Creates a matrix and initializes to provided values
|
Matrix2d(Matrix M)
Creates a matrix and initializes its elements to those of the matrix M.
|
Matrix2d(Matrix2dBase M)
Creates a matrix and initializes its elements to those of the matrix M.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Matrix2dBase M1)
Adds this matrix to M1 and places the result in this matrix.
|
void |
add(Matrix2dBase M1,
Matrix2dBase M2)
Adds matrix M1 to M2 and places the result in this matrix.
|
void |
addObj(Matrix2d M1)
Adds
v1 to this vector. |
void |
addOuterProduct(double x0,
double y0,
double x1,
double y1)
Adds an outer product to this matrix.
|
void |
addOuterProduct(Vector2d v0,
Vector2d v1)
Adds an outer product to this matrix.
|
void |
addScaledOuterProduct(double s,
Vector2d v0,
Vector2d v1)
Adds a scaled outer product to this matrix.
|
Matrix2d |
clone() |
boolean |
epsilonEquals(Matrix2d M1,
double tol)
Returns true if the components of this vector are equal to those of
v1 , within the tolerance tol . |
boolean |
invert()
Inverts this matrix in place, returning false if the matrix is detected to
be singular.
|
boolean |
invert(Matrix2dBase M)
Inverts the matrix M and places the result in this matrix, return false if
M is detected to be singular.
|
void |
mul(Matrix2dBase M1)
Multiplies this matrix by M1 and places the result in this matrix.
|
void |
mul(Matrix2dBase M1,
Matrix2dBase M2)
Multiplies matrix M1 by M2 and places the result in this matrix.
|
boolean |
mulInverse(Matrix2dBase M1)
Multiplies this matrix by the inverse of M1 and places the result in this
matrix.
|
boolean |
mulInverseBoth(Matrix2dBase M1,
Matrix2dBase M2)
Multiplies the inverse of matrix M1 by the inverse of M2 and places the
result in this matrix.
|
boolean |
mulInverseLeft(Matrix2dBase M1,
Matrix2dBase M2)
Multiplies the inverse of matrix M1 by M2 and places the result in this
matrix.
|
boolean |
mulInverseRight(Matrix2dBase M1,
Matrix2dBase M2)
Multiplies matrix M1 by the inverse of M2 and places the result in this
matrix.
|
void |
mulTranspose(Matrix2dBase M1)
Multiplies this matrix by the transpose of M1 and places the result in
this matrix.
|
void |
mulTransposeBoth(Matrix2dBase M1,
Matrix2dBase M2)
Multiplies the transpose of matrix M1 by the transpose of M2 and places
the result in this matrix.
|
void |
mulTransposeLeft(Matrix2dBase M1,
Matrix2dBase M2)
Multiplies the transpose of matrix M1 by M2 and places the result in this
matrix.
|
void |
mulTransposeRight(Matrix2dBase M1,
Matrix2dBase M2)
Multiplies matrix M1 by the transpose of M2 and places the result in this
matrix.
|
void |
negate(Matrix2dBase M1)
Sets this matrix to the negative of M1.
|
void |
outerProduct(Vector2d v0,
Vector2d v1)
Sets this matrix to the outer product
|
void |
scale(double s)
Scales the elements of this matrix by
s . |
void |
scale(double s,
Matrix2dBase M1)
Scales the elements of matrix M1 by
s and places the
results in this matrix. |
void |
scaledAdd(double s,
Matrix2dBase M1)
Computes s M1 and adds the result to this matrix.
|
void |
scaledAdd(double s,
Matrix2dBase M1,
Matrix2dBase M2)
Computes s M1 + M2 and places the result in this matrix.
|
void |
scaledAddObj(double s,
Matrix2d M1)
Scales
v1 by s and adds it to this vector. |
void |
scaleObj(double s)
Scales this vector by
s . |
void |
set(Matrix2d M1)
Sets this vector to
v1 |
void |
setColumns(Vector2d v0,
Vector2d v1)
Sets the columns of this matrix to the vectors v0 and v1.
|
void |
setDiagonal(double[] vals)
Sets this matrix to a diagonal matrix whose values are specified by the
array vals.
|
void |
setDiagonal(double m00,
double m11)
Sets this matrix to a diagonal matrix whose values are specified.
|
void |
setDiagonal(Vector2d diag)
Sets this matrix to a diagonal matrix whose values are specified by diag.
|
void |
setRandom()
Sets the elements of this matrix to uniformly distributed random values in
the range -0.5 (inclusive) to 0.5 (exclusive).
|
void |
setRandom(double lower,
double upper)
Sets the elements of this matrix to uniformly distributed random values in
a specified range.
|
void |
setRandom(double lower,
double upper,
java.util.Random generator)
Sets the elements of this matrix to uniformly distributed random values in
a specified range, using a supplied random number generator.
|
void |
setRows(Vector2d v0,
Vector2d v1)
Sets the rows of this matrix to the vectors v0 and v1.
|
void |
setZero()
Sets the elements of this matrix to zero.
|
static double |
solve(Matrix2dBase M,
Vector2d b,
Vector2d x) |
void |
sub(Matrix2dBase M1)
Subtracts this matrix from M1 and places the result in this matrix.
|
void |
sub(Matrix2dBase M1,
Matrix2dBase M2)
Subtracts matrix M1 from M2 and places the result in this matrix.
|
void |
transpose(Matrix2dBase M1)
Sets this matrix to the transpose of M
|
colSize, determinant, epsilonEquals, equals, frobeniusNorm, get, get, getColumn, getColumn, getColumn, getRow, getRow, getRow, infinityNorm, mul, mul, mul, mulAdd, mulAdd, mulInverse, mulInverse, mulInverseTranspose, mulInverseTranspose, mulTranspose, mulTranspose, mulTransposeLeftAdd, mulTransposeRightAdd, negate, oneNorm, rowSize, set, set, set, set, set, setColumn, setColumn, setIdentity, setRow, setRow, transpose
add, checkConsistency, set, set, set, setCCSValues, setColumn, setCRSValues, 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
getThreeVectorValue
isWritable, scan, write
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 static final Matrix2d IDENTITY
public static final Matrix2d ZERO
public Matrix2d()
public Matrix2d(double m00, double m01, double m10, double m11)
m00
- top-leftm01
- top-rightm10
- bottom-leftm11
- bottom-rightpublic Matrix2d(double[] vals)
vals
- element values for the matrix, with element (i,j) stored at location
i*2+j
public Matrix2d(Matrix M)
M
- matrix object to be copied.public Matrix2d(Matrix2dBase M)
M
- matrix object to be copied.public void setColumns(Vector2d v0, Vector2d v1)
v0
- values for the first columnv1
- values for the second columnpublic void setRows(Vector2d v0, Vector2d v1)
v0
- values for the first rowv1
- values for the second rowpublic void mul(Matrix2dBase M1)
M1
- right-hand matrixpublic void mul(Matrix2dBase M1, Matrix2dBase M2)
M1
- left-hand matrixM2
- right-hand matrixpublic void mulTranspose(Matrix2dBase M1)
M1
- right-hand matrixpublic void mulTransposeLeft(Matrix2dBase M1, Matrix2dBase M2)
M1
- left-hand matrixM2
- right-hand matrixpublic void mulTransposeRight(Matrix2dBase M1, Matrix2dBase M2)
M1
- left-hand matrixM2
- right-hand matrixpublic void mulTransposeBoth(Matrix2dBase M1, Matrix2dBase M2)
M1
- left-hand matrixM2
- right-hand matrixpublic boolean mulInverse(Matrix2dBase M1)
M1
- right-hand matrixpublic boolean mulInverseRight(Matrix2dBase M1, Matrix2dBase M2)
M1
- left-hand matrixM2
- right-hand matrixpublic boolean mulInverseLeft(Matrix2dBase M1, Matrix2dBase M2)
M1
- left-hand matrixM2
- right-hand matrixpublic boolean mulInverseBoth(Matrix2dBase M1, Matrix2dBase M2)
M1
- left-hand matrixM2
- right-hand matrixpublic void add(Matrix2dBase M1, Matrix2dBase M2)
M1
- left-hand matrixM2
- right-hand matrixpublic void add(Matrix2dBase M1)
M1
- right-hand matrixpublic void sub(Matrix2dBase M1, Matrix2dBase M2)
M1
- left-hand matrixM2
- right-hand matrixpublic void sub(Matrix2dBase M1)
M1
- right-hand matrixpublic void scale(double s)
s
.s
- scaling factorpublic void scale(double s, Matrix2dBase M1)
s
and places the
results in this matrix.s
- scaling factorM1
- matrix to be scaledpublic void scaledAdd(double s, Matrix2dBase M1, Matrix2dBase M2)
s
- scaling factorM1
- matrix to be scaledM2
- matrix to be addedpublic void scaledAdd(double s, Matrix2dBase M1)
s
- scaling factorM1
- matrix to be scaled and addedpublic void negate(Matrix2dBase M1)
M1
- matrix to negatepublic void transpose(Matrix2dBase M1)
M1
- matrix to take the transpose ofpublic void setZero()
setZero
in interface VectorObject<Matrix2d>
public void setRandom()
setRandom
in class DenseMatrixBase
public void setRandom(double lower, double upper)
lower
- lower random value (inclusive)upper
- upper random value (exclusive)public void setRandom(double lower, double upper, java.util.Random generator)
lower
- lower random value (inclusive)upper
- upper random value (exclusive)generator
- random number generatorpublic boolean invert()
invert
in class Matrix2dBase
public boolean invert(Matrix2dBase M)
M
- matrix to invertpublic void setDiagonal(Vector2d diag)
diag
- diagonal valuespublic void setDiagonal(double[] vals)
vals
- diagonal valuespublic void setDiagonal(double m00, double m11)
m00
- first diagonal valuem11
- second diagonal valuepublic void addOuterProduct(double x0, double y0, double x1, double y1)
x0
- first vector x coordinatey0
- first vector y coordinatex1
- second vector x coordinatey1
- second vector y coordinatepublic void addOuterProduct(Vector2d v0, Vector2d v1)
v0
- first vectorv1
- second vectorpublic void addScaledOuterProduct(double s, Vector2d v0, Vector2d v1)
s
- scaling factorv0
- first vectorv1
- second vectorpublic void outerProduct(Vector2d v0, Vector2d v1)
v0 v1^T
v0
- first vectorv1
- second vectorpublic static double solve(Matrix2dBase M, Vector2d b, Vector2d x)
public Matrix2d clone()
clone
in interface Clonable
clone
in class Matrix2dBase
public void scaleObj(double s)
s
.scaleObj
in interface VectorObject<Matrix2d>
public void addObj(Matrix2d M1)
v1
to this vector.addObj
in interface VectorObject<Matrix2d>
public void scaledAddObj(double s, Matrix2d M1)
v1
by s
and adds it to this vector.scaledAddObj
in interface VectorObject<Matrix2d>
public void set(Matrix2d M1)
v1
set
in interface VectorObject<Matrix2d>
public boolean epsilonEquals(Matrix2d M1, double tol)
v1
, within the tolerance tol
. If tol
= 0, then
exact equality is required.epsilonEquals
in interface VectorObject<Matrix2d>