|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object marf.math.Matrix marf.math.ComplexMatrix
public class ComplexMatrix
Similarly to Matrix, this class implements nearly identical API but for operations on matrices with complex numbers.
$Id: ComplexMatrix.java,v 1.12 2007/12/18 03:45:42 mokhov Exp $
Matrix
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class marf.math.Matrix |
---|
Matrix.Direction |
Field Summary | |
---|---|
protected double[] |
adImaginaryMatrix
The corresponding imaginary data to the real data array. |
Fields inherited from class marf.math.Matrix |
---|
adMatrix, DEFAULT_COLS, DEFAULT_ERROR_DELTA, DEFAULT_ROWS, iCols, iRows |
Constructor Summary | |
---|---|
ComplexMatrix()
|
|
ComplexMatrix(ComplexMatrix poMatrix)
|
|
ComplexMatrix(ComplexNumber[] pao1DMatrix)
|
|
ComplexMatrix(ComplexNumber[][] paoo2DMatrix)
|
|
ComplexMatrix(ComplexNumber[] pao1DMatrix,
boolean pbTransposed)
|
|
ComplexMatrix(double[] pad1DMatrix)
Constructs a complex vector with zero imaginary part. |
|
ComplexMatrix(double[][] padd2DMatrix)
|
|
ComplexMatrix(double[] pad1DMatrix,
boolean pbTransposed)
|
|
ComplexMatrix(double[] padRealMatrix,
double[] padImaginaryMatrix)
Constructs a complex vector. |
|
ComplexMatrix(int piRows,
int piCols)
|
|
ComplexMatrix(int piRows,
int piCols,
ComplexNumber poFillValue)
|
|
ComplexMatrix(int piRows,
int piCols,
double pdFillValue)
|
|
ComplexMatrix(Matrix poMatrix)
|
Method Summary | |
---|---|
static ComplexMatrix |
add(ComplexMatrix poLHSMatrix,
ComplexMatrix poRHSMatrix)
A convenience wrapper of Matrix.add() . |
static ComplexMatrix |
add(ComplexMatrix poLHSMatrix,
ComplexNumber pdNum)
|
static ComplexMatrix |
add(ComplexMatrix poLHSMatrix,
double pdNum)
|
static ComplexMatrix |
add(ComplexMatrix poLHSMatrix,
Matrix poRHSMatrix)
|
ComplexMatrix |
add(ComplexNumber poNum)
Adds a complex scalar to the matrix: this = this + Z. |
static ComplexMatrix |
add(Matrix poLHSMatrix,
ComplexMatrix poRHSMatrix)
|
protected Matrix |
applyAdd(Matrix poLHSMatrix,
Matrix poRHSMatrix,
int i,
int j)
Overrides the parent to apply complex number addition. |
protected Matrix |
applyMinus(Matrix poLHSMatrix,
Matrix poRHSMatrix,
int i,
int j)
Overrides the parent to apply complex number addition. |
protected Matrix |
applyMultiply(Matrix poLHSMatrix,
Matrix poRHSMatrix)
|
protected Matrix |
applyMultiply(Matrix poLHSMatrix,
Matrix poRHSMatrix,
int i,
int j)
|
java.lang.Object |
clone()
Implements Clonable interface. |
boolean |
crop(int piLeft,
int piTop,
int piRight,
int piBottom)
A general routine that allows arbitrary cropping of a matrix. |
static ComplexMatrix |
divide(ComplexMatrix poLHSMatrix,
ComplexMatrix poRHSMatrix)
|
static ComplexMatrix |
divide(ComplexMatrix poLHSMatrix,
Matrix poRHSMatrix)
|
ComplexMatrix |
divide(ComplexNumber poNum)
Divides the matrix by a complex scalar: this = this / Z. |
Matrix |
divide(double pdNum)
this = this / d. |
static ComplexMatrix |
divide(Matrix poLHSMatrix,
ComplexMatrix poRHSMatrix)
|
boolean |
equals(Matrix poMatrix)
this == M. |
void |
exhaustMatrix()
"Destroys" the internal array matrix by setting it to null . |
boolean |
extend(Matrix poExtensionMatrix,
Matrix.Direction poDirection)
Extends this matrix by another (by gluing two matrices together) given the extension direction. |
ComplexVector |
getComplexColumn(int piColNum)
|
ComplexNumber |
getComplexDeterminant()
Calculates complex determinant of this matrix using Laplace's formula. |
ComplexNumber |
getComplexElement(int piRow,
int piCol)
Retrieves complex matrix element's value given row and column. |
static ComplexMatrix |
getComplexMatrix(Matrix poMatrix)
Converts a real matrix into complex by making a copy. |
protected ComplexNumber |
getComplexNumber(int iRawOffset)
|
ComplexVector |
getComplexRow(int piRowNum)
|
double[] |
getImaginaryMatrixArray()
Allows getting internal array represeting the imaginary matrix data. |
double[][] |
getMatrix2D()
Returns internal matrix representation as 2-dimensional array of doubles. |
protected Matrix |
getNewMatrix()
|
protected Matrix |
getNewMatrix(int piRows,
int piCols)
|
double[] |
getRealMatrixArray()
Allows getting internal array represeting the real matrix data. |
boolean |
inverse()
Matrix inversion. |
boolean |
isReduced()
Allows examine if this matrix was row-reduced already. |
void |
loadColumn(int piColNum,
ComplexVector poVector)
|
void |
loadRow(int piRowNum,
ComplexVector poVector)
|
boolean |
makeIdentity()
Makes current matrix an identity one. |
static ComplexMatrix |
minus(ComplexMatrix poLHSMatrix,
ComplexMatrix poRHSMatrix)
|
static ComplexMatrix |
minus(ComplexMatrix poLHSMatrix,
Matrix poRHSMatrix)
|
ComplexMatrix |
minus(ComplexNumber poNum)
Subtracts a complex scalar from the matrix: this = this - Z. |
Matrix |
minus(double pdNum)
Subtracts a scalar from the matrix's each element: this = this - N. |
Matrix |
minus(Matrix poMatrix)
this = this - M. |
static ComplexMatrix |
minus(Matrix poLHSMatrix,
ComplexMatrix poRHSMatrix)
|
ComplexMatrix |
multiply(ComplexMatrix poMatrix)
|
static ComplexMatrix |
multiply(ComplexMatrix poLHSMatrix,
ComplexMatrix poRHSMatrix)
|
static ComplexMatrix |
multiply(ComplexMatrix poMatrix,
double pdNum)
|
static ComplexMatrix |
multiply(ComplexMatrix poLHSMatrix,
Matrix poRHSMatrix)
|
ComplexMatrix |
multiply(ComplexNumber poNum)
Multiplies the matrix by a complex scalar: this = this * Z. |
static ComplexMatrix |
multiply(double pdNum,
ComplexMatrix poMatrix)
|
static ComplexMatrix |
multiply(Matrix poLHSMatrix,
ComplexMatrix poRHSMatrix)
|
Vector |
multiply(Vector poVector)
V1 = this * V. |
static ComplexMatrix |
pow(ComplexMatrix poMatrix,
int piPow)
|
ComplexMatrix |
powComplex(int piPow)
|
Vector |
rotate(Vector poPointToRotate,
double[] padRotateFactors)
Rotates a vector according to the given axis' factor and angle's degree. |
Vector |
rotate(Vector poPointToRotate,
double pdRotateX,
double pdRotateY,
double pdRotateZ,
double pdRotateAngle)
Rotates a vector according to the given axis' factor and angle's degree. |
Vector |
rotate(Vector poPointToRotate,
Vector poRotateFactors)
Rotates a vector according to the given axis' factor and angle's degree. |
boolean |
rowOperation(ComplexNumber pdA,
int piRc,
char pcOp,
ComplexNumber pdB,
int piRp)
Performs a specified linear row operation given the parameters. |
boolean |
rowReduce()
Applies row-reduce operation in this matrix. |
Vector |
scale(Vector poPointToScale,
double[] padScaleFactors)
Returns a scaled vector. |
Vector |
scale(Vector poPointToScale,
double pdScaleX,
double pdScaleY,
double pdScaleZ)
Returns a scaled vector. |
Vector |
scale(Vector poPointToScale,
Vector poScaleFactors)
Returns a scaled vector. |
void |
setAll()
Sets all elements of the matrix to a default of 0.0. |
void |
setAll(ComplexNumber poFillValue)
|
void |
setAllRandom()
Sets all elements of the matrix at pseudo-random order. |
void |
setComplexElement(int piRow,
int piCol,
ComplexNumber poValue)
|
protected void |
setComplexNumber(int iRawOffset,
ComplexNumber poNumber)
|
void |
setImaginaryMatrixArray(double[] padNewMatrix)
|
void |
setMatrix2D(ComplexNumber[][] paoo2DMatrix)
|
void |
setRealMatrixArray(double[] padNewMatrix)
|
Vector |
shear(Vector poPointToShear,
double[] padShearFactors)
Returns a sheared vector. |
Vector |
shear(Vector poPointToShear,
double pdShearX,
double pdShearY,
double pdShearZ)
Returns a sheared vector. |
Vector |
shear(Vector poPointToShear,
Vector poShearFactors)
Returns a sheared vector. |
java.lang.String |
toString()
Textual representation of the matrix. |
Vector |
translate(Vector poPointToTranslate,
double[] padTranslateVals)
Translates a vector according to the given size. |
Vector |
translate(Vector poPointToTranslate,
double pdTranslateX,
double pdTranslateY,
double pdTranslateZ)
Translates a vector according to the given size. |
Vector |
translate(Vector poPointToTranslate,
Vector poTranslateVals)
Translates a vector according to the given size. |
boolean |
transpose()
Matrix transpose. |
Methods inherited from class marf.math.Matrix |
---|
add, add, add, crop, cutColumn, cutFirstColumn, cutFirstRow, cutLastColumn, cutLastRow, cutRow, display, divide, divide, equals, equals, extend, extend, getCols, getColumn, getDeterminant, getElement, getElements, getMARFSourceCodeRevision, getMatrixArray, getRow, getRows, isIdentity, isNearlyIdentity, isNearlyIdentity, loadColumn, loadRow, minus, minus, minusUnary, multiply, multiply, multiply, multiply, multiply, multiply, pow, pow, rowOperation, rowOperation, setAll, setCols, setElement, setMatrix2D, setMatrixArray, setRows, size |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected double[] adImaginaryMatrix
Constructor Detail |
---|
public ComplexMatrix()
public ComplexMatrix(int piRows, int piCols)
piRows
- piCols
- public ComplexMatrix(int piRows, int piCols, double pdFillValue)
piRows
- piCols
- pdFillValue
- public ComplexMatrix(int piRows, int piCols, ComplexNumber poFillValue)
piRows
- piCols
- poFillValue
- public ComplexMatrix(Matrix poMatrix)
poMatrix
- public ComplexMatrix(ComplexMatrix poMatrix)
poMatrix
- public ComplexMatrix(double[] pad1DMatrix)
pad1DMatrix
- public ComplexMatrix(double[] padRealMatrix, double[] padImaginaryMatrix)
padRealMatrix
- padImaginaryMatrix
- public ComplexMatrix(ComplexNumber[] pao1DMatrix)
public ComplexMatrix(double[] pad1DMatrix, boolean pbTransposed)
pad1DMatrix
- pbTransposed
- public ComplexMatrix(ComplexNumber[] pao1DMatrix, boolean pbTransposed)
pao1DMatrix
- pbTransposed
- public ComplexMatrix(double[][] padd2DMatrix)
padd2DMatrix
- public ComplexMatrix(ComplexNumber[][] paoo2DMatrix)
paoo2DMatrix
- Method Detail |
---|
public ComplexMatrix add(ComplexNumber poNum)
poNum
- the scalar Z
protected Matrix applyAdd(Matrix poLHSMatrix, Matrix poRHSMatrix, int i, int j)
applyAdd
in class Matrix
Matrix.applyAdd(marf.math.Matrix, marf.math.Matrix, int, int)
public static ComplexMatrix add(ComplexMatrix poLHSMatrix, ComplexMatrix poRHSMatrix)
Matrix.add()
.
poLHSMatrix
- poRHSMatrix
-
Matrix.add(Matrix, Matrix)
public static ComplexMatrix add(Matrix poLHSMatrix, ComplexMatrix poRHSMatrix)
poLHSMatrix
- poRHSMatrix
-
public static ComplexMatrix add(ComplexMatrix poLHSMatrix, Matrix poRHSMatrix)
poLHSMatrix
- poRHSMatrix
-
public static ComplexMatrix minus(ComplexMatrix poLHSMatrix, ComplexMatrix poRHSMatrix)
poLHSMatrix
- poRHSMatrix
-
public static ComplexMatrix minus(Matrix poLHSMatrix, ComplexMatrix poRHSMatrix)
poLHSMatrix
- poRHSMatrix
-
public static ComplexMatrix minus(ComplexMatrix poLHSMatrix, Matrix poRHSMatrix)
poLHSMatrix
- poRHSMatrix
-
public static ComplexMatrix multiply(ComplexMatrix poLHSMatrix, ComplexMatrix poRHSMatrix)
poLHSMatrix
- poRHSMatrix
-
public static ComplexMatrix multiply(Matrix poLHSMatrix, ComplexMatrix poRHSMatrix)
poLHSMatrix
- poRHSMatrix
-
public static ComplexMatrix multiply(ComplexMatrix poLHSMatrix, Matrix poRHSMatrix)
poLHSMatrix
- poRHSMatrix
-
public static ComplexMatrix divide(ComplexMatrix poLHSMatrix, ComplexMatrix poRHSMatrix)
poLHSMatrix
- poRHSMatrix
-
public static ComplexMatrix divide(Matrix poLHSMatrix, ComplexMatrix poRHSMatrix)
poLHSMatrix
- poRHSMatrix
-
public static ComplexMatrix divide(ComplexMatrix poLHSMatrix, Matrix poRHSMatrix)
poLHSMatrix
- poRHSMatrix
-
public static ComplexMatrix add(ComplexMatrix poLHSMatrix, double pdNum)
poLHSMatrix
- pdNum
-
public static ComplexMatrix add(ComplexMatrix poLHSMatrix, ComplexNumber pdNum)
poLHSMatrix
- pdNum
-
public static ComplexMatrix multiply(ComplexMatrix poMatrix, double pdNum)
poMatrix
- pdNum
-
public static ComplexMatrix multiply(double pdNum, ComplexMatrix poMatrix)
pdNum
- poMatrix
-
public static ComplexMatrix pow(ComplexMatrix poMatrix, int piPow)
poMatrix
- piPow
-
public ComplexMatrix powComplex(int piPow)
piPow
-
protected Matrix applyMinus(Matrix poLHSMatrix, Matrix poRHSMatrix, int i, int j)
applyMinus
in class Matrix
Matrix.applyAdd(marf.math.Matrix, marf.math.Matrix, int, int)
protected Matrix applyMultiply(Matrix poLHSMatrix, Matrix poRHSMatrix, int i, int j)
applyMultiply
in class Matrix
protected Matrix applyMultiply(Matrix poLHSMatrix, Matrix poRHSMatrix)
applyMultiply
in class Matrix
public static ComplexMatrix getComplexMatrix(Matrix poMatrix)
poMatrix
-
public ComplexMatrix minus(ComplexNumber poNum)
poNum
- the scalar Z
public ComplexMatrix multiply(ComplexNumber poNum)
poNum
- the scalar Z
public ComplexMatrix divide(ComplexNumber poNum)
poNum
- the scalar Z
protected ComplexNumber getComplexNumber(int iRawOffset)
iRawOffset
-
protected void setComplexNumber(int iRawOffset, ComplexNumber poNumber)
iRawOffset
- poNumber
- public java.lang.Object clone()
Matrix
clone
in class Matrix
Matrix.clone()
public boolean crop(int piLeft, int piTop, int piRight, int piBottom)
Matrix
crop
in class Matrix
piLeft
- left index border to crop afterpiTop
- top index border to crop afterpiRight
- right index border to crop afterpiBottom
- bottom index border to crop after
true
if the cropping was successfulMatrix.crop(int, int, int, int)
protected Matrix getNewMatrix()
getNewMatrix
in class Matrix
protected Matrix getNewMatrix(int piRows, int piCols)
getNewMatrix
in class Matrix
public Matrix divide(double pdNum)
Matrix
divide
in class Matrix
pdNum
- dpublic boolean equals(Matrix poMatrix)
Matrix
equals
in class Matrix
poMatrix
- M
true
if this and parameter matrices are equalMatrix.equals(marf.math.Matrix)
public void exhaustMatrix()
Matrix
null
.
Also, the garbage collector is hinted to collect as soon as it can with
System.gc()
. If called very often, may actually slowdown
the system during the garbage collection runs.
The cardinality of the matrix is not affected and a new instance of it
is not created; use setMatrixArray()
to set the new matrix
data.
exhaustMatrix
in class Matrix
Matrix.exhaustMatrix()
public boolean extend(Matrix poExtensionMatrix, Matrix.Direction poDirection)
Matrix
extend
in class Matrix
poExtensionMatrix
- the matrix to extend the current bypoDirection
- in which direction the extension should happen
true
if the operation was successfulMatrix.extend(marf.math.Matrix, marf.math.Matrix.Direction)
public double[][] getMatrix2D()
Matrix
getMatrix2D
in class Matrix
public final double[] getRealMatrixArray()
Matrix.getMatrixArray()
public final double[] getImaginaryMatrixArray()
public final ComplexNumber getComplexElement(int piRow, int piCol)
piRow
- row index of the elementpiCol
- column index of the element
java.lang.ArrayIndexOutOfBoundsException
- if at least one of the indices is out of rangepublic final ComplexNumber getComplexDeterminant()
public boolean inverse()
Matrix
inverse
in class Matrix
true
if matrix was possible to invert, false
otherwisepublic boolean isReduced()
Matrix
isReduced
in class Matrix
true
if the matrix if row-reducedMatrix.isReduced()
public void loadColumn(int piColNum, ComplexVector poVector)
Matrix.loadColumn(int, marf.math.Vector)
public ComplexVector getComplexColumn(int piColNum)
piColNum
-
public void loadRow(int piRowNum, ComplexVector poVector)
Matrix.loadRow(int, marf.math.Vector)
public ComplexVector getComplexRow(int piRowNum)
piRowNum
-
public boolean makeIdentity()
Matrix
makeIdentity
in class Matrix
true
if the operation completed successfullyMatrix.makeIdentity()
public Matrix minus(double pdNum)
Matrix
minus
in class Matrix
pdNum
- the scalarpublic Matrix minus(Matrix poMatrix)
Matrix
minus
in class Matrix
poMatrix
- M
public ComplexMatrix multiply(ComplexMatrix poMatrix)
poMatrix
-
Matrix.multiply(marf.math.Matrix)
public Vector multiply(Vector poVector)
Matrix
multiply
in class Matrix
poVector
- V
public Vector rotate(Vector poPointToRotate, double pdRotateX, double pdRotateY, double pdRotateZ, double pdRotateAngle)
Matrix
rotate
in class Matrix
poPointToRotate
- the vector of objects to be rotated.pdRotateX
- the X axis rotated factor of doublepdRotateY
- the Y axis rotated factor of doublepdRotateZ
- the Z axis rotated factor of doublepdRotateAngle
- the rotate angle of degree around one axis
public Vector rotate(Vector poPointToRotate, double[] padRotateFactors)
Matrix
rotate
in class Matrix
poPointToRotate
- the vector of objects to be rotated.padRotateFactors
- the Array of doubles that contains the vector's rotating values
public Vector rotate(Vector poPointToRotate, Vector poRotateFactors)
Matrix
rotate
in class Matrix
poPointToRotate
- the vector of objects to be rotatedpoRotateFactors
- the vector of objects that contains the vector's rotating factors
public boolean rowOperation(ComplexNumber pdA, int piRc, char pcOp, ComplexNumber pdB, int piRp)
pdA
- ApiRc
- RcpcOp
- operation ('+' or '-')pdB
- BpiRp
- Rb
true
if the operation was successfulpublic boolean rowReduce()
Matrix
rowReduce
in class Matrix
true
if the operation was successfulMatrix.rowReduce()
public Vector scale(Vector poPointToScale, double pdScaleX, double pdScaleY, double pdScaleZ)
Matrix
scale
in class Matrix
poPointToScale
- the vector of objects to be scaled.pdScaleX
- the X axis scaled factor of doublepdScaleY
- the Y axis scaled factor of doublepdScaleZ
- the Z axis scaled factor of double
public Vector scale(Vector poPointToScale, double[] padScaleFactors)
Matrix
scale
in class Matrix
poPointToScale
- the vector of objects to be scaled.padScaleFactors
- the array of doubles containing the vector's scaling factors
public Vector scale(Vector poPointToScale, Vector poScaleFactors)
Matrix
scale
in class Matrix
poPointToScale
- the vector of objects to be scaled.poScaleFactors
- the vector of objects containing the vector's scaling factors
public void setAll()
Matrix
setAll
in class Matrix
Matrix.setAll()
public void setAll(ComplexNumber poFillValue)
Matrix.setAll(double)
public void setAllRandom()
Matrix
setAllRandom
in class Matrix
Matrix.setAllRandom()
public void setComplexElement(int piRow, int piCol, ComplexNumber poValue)
Matrix.setElement(int, int, double)
public void setMatrix2D(ComplexNumber[][] paoo2DMatrix)
paoo2DMatrix
- public void setRealMatrixArray(double[] padNewMatrix)
padNewMatrix
- Matrix.setMatrixArray(double[])
public void setImaginaryMatrixArray(double[] padNewMatrix)
padNewMatrix
- public Vector shear(Vector poPointToShear, double pdShearX, double pdShearY, double pdShearZ)
Matrix
shear
in class Matrix
poPointToShear
- the vector of objects to be shearedpdShearX
- the X axis sheared factor of doublepdShearY
- the Y axis sheared factor of doublepdShearZ
- the Z axis sheared factor of double
public Vector shear(Vector poPointToShear, double[] padShearFactors)
Matrix
shear
in class Matrix
poPointToShear
- the vector of objects to be shearedpadShearFactors
- the array of doubles containing the vector's shearing factors
public Vector shear(Vector poPointToShear, Vector poShearFactors)
Matrix
shear
in class Matrix
poPointToShear
- the vector of objects to be sheared.poShearFactors
- the vector of objects containing the vector's shearing factors
public java.lang.String toString()
Matrix
toString
in class Matrix
public Vector translate(Vector poPointToTranslate, double pdTranslateX, double pdTranslateY, double pdTranslateZ)
Matrix
translate
in class Matrix
poPointToTranslate
- the vector of objects to be translated.pdTranslateX
- the X axis translated factor of doublepdTranslateY
- the Y axis translated factor of doublepdTranslateZ
- the Z axis translated factor of double
public Vector translate(Vector poPointToTranslate, double[] padTranslateVals)
Matrix
translate
in class Matrix
poPointToTranslate
- the vector of objects to be translated.padTranslateVals
- the Array of doubles that contains the vector's translating values
public Vector translate(Vector poPointToTranslate, Vector poTranslateVals)
Matrix
translate
in class Matrix
poPointToTranslate
- the vector of objects to be translated.poTranslateVals
- the vector of objects that contains the vector's translating values
public boolean transpose()
Matrix
transpose
in class Matrix
true
if matrix was transposed, false
otherwise
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |