All Packages Class Hierarchy This Package Previous Next Index
Class crw.math.CMatrix
java.lang.Object
|
+----crw.math.CMatrix
- public class CMatrix
- extends Object
Class for a matrix of complex numbers. It is useful mostly for a
square matrix. Most methods are un-optimized straightforward routines.
- Version:
- 1.0, 1997/6/19
- Author:
- C. R. Wie
-
CMatrix()
- Creates a 1x1 complex matrix with a complex object initialized to
a zero value.
-
CMatrix(CMatrix)
- Creates a Cmatrix object initialized to the argument.
-
CMatrix(Complex[][])
- Creates a CMatrix object initialized to a complex matrix.
-
CMatrix(int)
- Creates a square complex matrix with elements initialized to zero values.
-
CMatrix(int, int)
- Creates a i x j complex matrix, elements initialized to
complex numbers of 0.
-
add(CMatrix)
- Adds the argument matrix to this one.
-
add(CMatrix, CMatrix)
- Returns the addition of two matrices of equal dimensions, null if
different dimensions.
-
add(CMatrix, Complex)
- Returns addition of a square matrix and a constant times the unity matrix.
-
add(Complex)
- Adds a constant to the diagonal elements of this matrix.
-
add(Complex, CMatrix)
- Returns addition of a square matrix and a constant times the unity matrix.
-
add(Complex, Complex[][])
- Returns addition of a square matrix and a constant times the unity matrix.
-
add(Complex[][])
- Adds the argument matrix to this one.
-
add(Complex[][], Complex)
- Returns addition of a square matrix and a constant times the unity matrix.
-
add(Complex[][], Complex[][])
- Returns addition of two matrices.
-
adj()
- Converts this CMatrix object into its own Hermitian conjugate (adjoint,
or the conjugate of the transpose).
-
adj(CMatrix)
- Returns the Hermitian conjugate matrix of a CMatrix object.
-
adj(Complex[][])
- Returns the Hemitian conjugate matrix (transpose conjugate, or adjoint).
-
cof(int, int)
- Returns the cofactor of the a[r,c] element of this CMatrix object.
-
cof(int, int, CMatrix)
- Returns the complex cofactor of the [r][c] element of a
CMatrix object.
-
cof(int, int, Complex[][])
- Returns the cofactor of a[r][c] of a complex matrix a.
-
conj()
- Converts this complex matrix into its own complex conjugate.
-
conj(CMatrix)
- Returns the complex conjugate matrix of a CMatrix object.
-
conj(Complex[][])
- Returns the complex conjugate matrix of a complex matrix.
-
det()
- Returns the complex determinant of this CMatrix object.
-
det(CMatrix)
- Returns the complex determinant of a CMatrix object.
-
det(Complex[][])
- Returns the complex determinant of a complex matrix, Complex[][].
-
inverse()
- Turns this CMatrix object into its inverse matrix.
-
inverse(CMatrix)
- Returns the inverse matrix of this CMatrix object.
-
inverse(Complex[][])
- Returns the inverse matrix of a complex square matrix.
-
mul(CMatrix)
- Multiplies a CMatrix object to this one from the RHS and replace
this by the product.
-
mul(CMatrix, CMatrix)
- Multiplies a CMatrix object to another and returns the result.
-
mul(CMatrix, Complex)
- Multiplies a constant to every element, returns the result.
-
mul(Complex)
- Multiplies a constant to every element of this matrix.
-
mul(Complex, CMatrix)
- Multiplies a constant to every element, returns the result.
-
mul(Complex, Complex[][])
- Multiplies a constant to every element, returns the result.
-
mul(Complex[][])
- Multiplies a 2D Complex array to this one from the RHS and replace
this object by the product.
-
mul(Complex[][], Complex)
- Multiplies a constant to every element, returns the result.
-
mul(Complex[][], Complex[][])
- Returns the multiplication result by multiplying the first 2D
Complex array to the second argument.
-
print()
- Prints out the matrix to standard out.
-
sub(CMatrix, CMatrix)
- Returns subtraction of the second argument from the first.
-
sub(CMatrix, Complex)
- Returns subtraction of the second argument from the first, or a null
if not a square matrix
-
sub(Complex, CMatrix)
- Returns subtraction of the second argument from the first, or a null
if not a square matrix
-
sub(Complex, Complex[][])
- Returns subtraction of the second argument from the first, or a null
if not a square matrix
-
sub(Complex[][], Complex)
- Returns subtraction of the second argument from the first, or a null
if not a square matrix.
-
sub(Complex[][], Complex[][])
- Returns subtraction of the second argument from the first.
-
trans()
- Converts this object into its own transpose matrix.
-
trans(CMatrix)
- Returns the transpose of a CMatrix.
-
trans(Complex[][])
- Returns the transpose of a complex matrix (a 2D unit-offset complex array)
As always, the 0th elements are ignored.
CMatrix
public CMatrix()
- Creates a 1x1 complex matrix with a complex object initialized to
a zero value.
CMatrix
public CMatrix(int n)
- Creates a square complex matrix with elements initialized to zero values.
- Parameters:
- n - the dimension of the square matrix.
CMatrix
public CMatrix(int n,
int m)
- Creates a i x j complex matrix, elements initialized to
complex numbers of 0. The matrix indices are unit-offset.
- Parameters:
- n - number of rows + 1
- m - number of columns + 1
CMatrix
public CMatrix(Complex a[][])
- Creates a CMatrix object initialized to a complex matrix.
- Parameters:
- a[][] - a complex matrix
CMatrix
public CMatrix(CMatrix c)
- Creates a Cmatrix object initialized to the argument.
- Parameters:
- c - a CMatrix object
add
public static Complex[][] add(Complex a[][],
Complex b[][])
- Returns addition of two matrices.
- Parameters:
- a[][] - 2D array of complex numbers
- b[][] - 2D array of complex numbers
- Returns:
- the addition of the argument matrices, or null if not the same dimension.
add
public static Complex[][] add(Complex a[][],
Complex lambda)
- Returns addition of a square matrix and a constant times the unity matrix.
Returns null if not a square matrix.
- Parameters:
- a[][] - 2D array -- square matrix.
- lambda - a constant
- Returns:
- matrix addition of a constant to the diagonal elements
add
public static Complex[][] add(Complex lambda,
Complex a[][])
- Returns addition of a square matrix and a constant times the unity matrix.
Returns null if not a square matrix.
- Parameters:
- a[][] - 2D array -- square matrix.
- lambda - a constant
- Returns:
- matrix addition of a constant to the diagonal elements
add
public static CMatrix add(CMatrix a,
CMatrix b)
- Returns the addition of two matrices of equal dimensions, null if
different dimensions.
- Parameters:
- a - CMatrix object
- b - CMatrix object
- Returns:
- the addition of the two arguments, null if different dimensions.
add
public static CMatrix add(CMatrix f,
Complex lambda)
- Returns addition of a square matrix and a constant times the unity matrix.
Returns null if not a square matrix.
- Parameters:
- f - a square matrix.
- lambda - a constant
- Returns:
- matrix addition of a constant to the diagonal elements
add
public static CMatrix add(Complex lambda,
CMatrix f)
- Returns addition of a square matrix and a constant times the unity matrix.
Returns null if not a square matrix.
- Parameters:
- f - a square matrix.
- lambda - a constant
- Returns:
- matrix addition of a constant to the diagonal elements
add
public void add(Complex a[][])
- Adds the argument matrix to this one. Nothing happens if this matrix
has a different dimension from the argument matrix.
- Parameters:
- a[][] - a 2D array -- matrix a[1..][1..]
add
public void add(CMatrix f)
- Adds the argument matrix to this one. Nothing happens if this matrix
has a different dimension from the argument matrix.
- Parameters:
- f - matrix
add
public void add(Complex lambda)
- Adds a constant to the diagonal elements of this matrix.
If this matrix is not square, nothing happens.
- Parameters:
- lambda - the constant to be added to the diagonal
sub
public static Complex[][] sub(Complex a[][],
Complex b[][])
- Returns subtraction of the second argument from the first.
- Parameters:
- a[][] - 2D array of Complex numbers
- b[][] - 2D array of Complex numbers
- Returns:
- the subtraction of the second argument from the first, or null if not the same dimension.
sub
public static Complex[][] sub(Complex a[][],
Complex lambda)
- Returns subtraction of the second argument from the first, or a null
if not a square matrix.
- Parameters:
- a[][] - 2D array of Complex numbers
- lambda - constant to be subtracted from the diagonal
- Returns:
- the subtraction of a const (2nd arg) from a matrix (1st arg).
sub
public static Complex[][] sub(Complex lambda,
Complex a[][])
- Returns subtraction of the second argument from the first, or a null
if not a square matrix
- Parameters:
- a[][] - 2D array of Complex numbers
- lambda - constant to be subtracted from the diagonal
- Returns:
- the subtraction of a matrix (2nd arg) from a const(1st arg).
sub
public static CMatrix sub(CMatrix a,
CMatrix b)
- Returns subtraction of the second argument from the first.
- Parameters:
- a - a matrix of Complex numbers (32 bit)
- b - a matrix of Complex numbers
- Returns:
- the subtraction of the second argument from the first, or null if not the same dimension.
sub
public static CMatrix sub(CMatrix c,
Complex lambda)
- Returns subtraction of the second argument from the first, or a null
if not a square matrix
- Parameters:
- c - a matrix of Complex numbers
- lambda - constant to be subtracted from the diagonal
- Returns:
- the subtraction of a const (2nd arg) from a matrix (1st arg).
sub
public static CMatrix sub(Complex lambda,
CMatrix c)
- Returns subtraction of the second argument from the first, or a null
if not a square matrix
- Parameters:
- c - a matrix of Complex numbers
- lambda - constant to be subtracted from the diagonal
- Returns:
- the subtraction of a matrix (2nd arg) from a constant(1st arg).
mul
public static Complex[][] mul(Complex a[][],
Complex b[][])
- Returns the multiplication result by multiplying the first 2D
Complex array to the second argument. Returns null if the number of columns
of the first argument is NOT equal to the number of rows of the
second argument.
- Parameters:
- a[][] - a 2D Complex array. Zeroth elements are ignored.
- b[][] - the second 2D Complex array.
- Returns:
- the Complex matrix product of the arguments or null.
mul
public static CMatrix mul(CMatrix a,
CMatrix b)
- Multiplies a CMatrix object to another and returns the result.
Returns null if the number of columns of the first CMatrix
is NOT equal to the number of rows of the second.
- Parameters:
- a - the first CMatrix
- b - the second CMatrix
- Returns:
- the product of the arguments or null.
mul
public void mul(CMatrix c)
- Multiplies a CMatrix object to this one from the RHS and replace
this by the product. Operation changes this object.
- Parameters:
- c - the RHS CMatrix
mul
public void mul(Complex a[][])
- Multiplies a 2D Complex array to this one from the RHS and replace
this object by the product. Operation changes this object.
- Parameters:
- a[][] - the 2D Complex array
mul
public static Complex[][] mul(Complex a[][],
Complex k)
- Multiplies a constant to every element, returns the result.
- Parameters:
- a[][] - a 2D array of complex numbers.
- k - a complex constant to multiply
- Returns:
- the product
mul
public static Complex[][] mul(Complex k,
Complex a[][])
- Multiplies a constant to every element, returns the result.
- Parameters:
- a[][] - a 2D array of complex numbers.
- k - a complex constant to multiply
- Returns:
- the product
mul
public static CMatrix mul(CMatrix c,
Complex k)
- Multiplies a constant to every element, returns the result.
- Parameters:
- c - a complex matrix.
- k - constant to multiply
- Returns:
- the product
mul
public static CMatrix mul(Complex k,
CMatrix c)
- Multiplies a constant to every element, returns the result.
- Parameters:
- c - a complex matrix.
- k - a complex constant to multiply
- Returns:
- the product
mul
public void mul(Complex k)
- Multiplies a constant to every element of this matrix.
- Parameters:
- k - constant to multiply
det
public static Complex det(Complex a[][])
- Returns the complex determinant of a complex matrix, Complex[][].
If it's not a square matrix, it returns a null.
- Parameters:
- a[][] - a complex square matrix
- Returns:
- the complex determinant value
det
public static Complex det(CMatrix c)
- Returns the complex determinant of a CMatrix object. If the CMatrix
object is not a square matrix, it returns a null.
- Parameters:
- c - the CMatrix object
- Returns:
- the complex determinant of the argument if it's a sqaure matrix, a null otherwise.
det
public Complex det()
- Returns the complex determinant of this CMatrix object.
- Returns:
- the complex determinant of this CMatrix.
inverse
public static Complex[][] inverse(Complex a[][])
- Returns the inverse matrix of a complex square matrix.
- Parameters:
- a[][] - a complex square matrix
- Returns:
- the complex inverse matrix
inverse
public static CMatrix inverse(CMatrix c)
- Returns the inverse matrix of this CMatrix object. If its determinant
is zero, then it returns a null object.
- Parameters:
- c - a square CMatrix object
- Returns:
- the inverse matrix or a null object.
inverse
public void inverse()
- Turns this CMatrix object into its inverse matrix. But if its
determinant is zero, then nothing happens.
trans
public static Complex[][] trans(Complex a[][])
- Returns the transpose of a complex matrix (a 2D unit-offset complex array)
As always, the 0th elements are ignored.
- Parameters:
- a[][] - a complex matrix (a unit-offset 2D complex array)
- Returns:
- the transpose of the argument
trans
public static CMatrix trans(CMatrix c)
- Returns the transpose of a CMatrix.
- Parameters:
- c - a CMatrix object
- Returns:
- the transpose of the argument
trans
public void trans()
- Converts this object into its own transpose matrix.
cof
protected static Complex cof(int r,
int c,
Complex a[][])
- Returns the cofactor of a[r][c] of a complex matrix a.
Returns null if the matrix is not a square matrix.
- Parameters:
- r - the row number
- c - the column number
- a[][] - the input matrix.
- Returns:
- the complex cofactor value of a[r][c]
cof
public static Complex cof(int r,
int c,
CMatrix cm)
- Returns the complex cofactor of the [r][c] element of a
CMatrix object. Returns null if it's not a square matrix.
- Parameters:
- r - the row number
- c - the column number
- cm - a CMatrix object
- Returns:
- the complex cofactor value of the [r][c] element.
cof
public Complex cof(int r,
int c)
- Returns the cofactor of the a[r,c] element of this CMatrix object.
adj
public static Complex[][] adj(Complex a[][])
- Returns the Hemitian conjugate matrix (transpose conjugate, or adjoint).
0th elements are ignored.
- Parameters:
- a[][] - a 2D complex array
- Returns:
- the Hermitian conjugate of the argument.
adj
public static CMatrix adj(CMatrix c)
- Returns the Hermitian conjugate matrix of a CMatrix object.
- Parameters:
- c - a CMatrix object
- Returns:
- the Hermitian conjugate (adjoint) CMatrix of the argument.
adj
public void adj()
- Converts this CMatrix object into its own Hermitian conjugate (adjoint,
or the conjugate of the transpose).
conj
public static Complex[][] conj(Complex a[][])
- Returns the complex conjugate matrix of a complex matrix.
Matrix is a unit-offset array. 0th elements are never
utilized.
- Parameters:
- a[][] - the original complex matrix
- Returns:
- the complex conjugate of the argument
conj
public void conj()
- Converts this complex matrix into its own complex conjugate.
Zeroth elements are left alone (they are never used).
conj
public static CMatrix conj(CMatrix c)
- Returns the complex conjugate matrix of a CMatrix object.
- Parameters:
- c - a CMatrix object
- Returns:
- the complex conjugate of the argument
print
public void print()
- Prints out the matrix to standard out. Useful for debugging.
All Packages Class Hierarchy This Package Previous Next Index