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

Constructor Index

 o CMatrix()
Creates a 1x1 complex matrix with a complex object initialized to a zero value.
 o CMatrix(CMatrix)
Creates a Cmatrix object initialized to the argument.
 o CMatrix(Complex[][])
Creates a CMatrix object initialized to a complex matrix.
 o CMatrix(int)
Creates a square complex matrix with elements initialized to zero values.
 o CMatrix(int, int)
Creates a i x j complex matrix, elements initialized to complex numbers of 0.

Method Index

 o add(CMatrix)
Adds the argument matrix to this one.
 o add(CMatrix, CMatrix)
Returns the addition of two matrices of equal dimensions, null if different dimensions.
 o add(CMatrix, Complex)
Returns addition of a square matrix and a constant times the unity matrix.
 o add(Complex)
Adds a constant to the diagonal elements of this matrix.
 o add(Complex, CMatrix)
Returns addition of a square matrix and a constant times the unity matrix.
 o add(Complex, Complex[][])
Returns addition of a square matrix and a constant times the unity matrix.
 o add(Complex[][])
Adds the argument matrix to this one.
 o add(Complex[][], Complex)
Returns addition of a square matrix and a constant times the unity matrix.
 o add(Complex[][], Complex[][])
Returns addition of two matrices.
 o adj()
Converts this CMatrix object into its own Hermitian conjugate (adjoint, or the conjugate of the transpose).
 o adj(CMatrix)
Returns the Hermitian conjugate matrix of a CMatrix object.
 o adj(Complex[][])
Returns the Hemitian conjugate matrix (transpose conjugate, or adjoint).
 o cof(int, int)
Returns the cofactor of the a[r,c] element of this CMatrix object.
 o cof(int, int, CMatrix)
Returns the complex cofactor of the [r][c] element of a CMatrix object.
 o cof(int, int, Complex[][])
Returns the cofactor of a[r][c] of a complex matrix a.
 o conj()
Converts this complex matrix into its own complex conjugate.
 o conj(CMatrix)
Returns the complex conjugate matrix of a CMatrix object.
 o conj(Complex[][])
Returns the complex conjugate matrix of a complex matrix.
 o det()
Returns the complex determinant of this CMatrix object.
 o det(CMatrix)
Returns the complex determinant of a CMatrix object.
 o det(Complex[][])
Returns the complex determinant of a complex matrix, Complex[][].
 o inverse()
Turns this CMatrix object into its inverse matrix.
 o inverse(CMatrix)
Returns the inverse matrix of this CMatrix object.
 o inverse(Complex[][])
Returns the inverse matrix of a complex square matrix.
 o mul(CMatrix)
Multiplies a CMatrix object to this one from the RHS and replace this by the product.
 o mul(CMatrix, CMatrix)
Multiplies a CMatrix object to another and returns the result.
 o mul(CMatrix, Complex)
Multiplies a constant to every element, returns the result.
 o mul(Complex)
Multiplies a constant to every element of this matrix.
 o mul(Complex, CMatrix)
Multiplies a constant to every element, returns the result.
 o mul(Complex, Complex[][])
Multiplies a constant to every element, returns the result.
 o mul(Complex[][])
Multiplies a 2D Complex array to this one from the RHS and replace this object by the product.
 o mul(Complex[][], Complex)
Multiplies a constant to every element, returns the result.
 o mul(Complex[][], Complex[][])
Returns the multiplication result by multiplying the first 2D Complex array to the second argument.
 o print()
Prints out the matrix to standard out.
 o sub(CMatrix, CMatrix)
Returns subtraction of the second argument from the first.
 o sub(CMatrix, Complex)
Returns subtraction of the second argument from the first, or a null if not a square matrix
 o sub(Complex, CMatrix)
Returns subtraction of the second argument from the first, or a null if not a square matrix
 o sub(Complex, Complex[][])
Returns subtraction of the second argument from the first, or a null if not a square matrix
 o sub(Complex[][], Complex)
Returns subtraction of the second argument from the first, or a null if not a square matrix.
 o sub(Complex[][], Complex[][])
Returns subtraction of the second argument from the first.
 o trans()
Converts this object into its own transpose matrix.
 o trans(CMatrix)
Returns the transpose of a CMatrix.
 o trans(Complex[][])
Returns the transpose of a complex matrix (a 2D unit-offset complex array) As always, the 0th elements are ignored.

Constructors

 o CMatrix
 public CMatrix()
Creates a 1x1 complex matrix with a complex object initialized to a zero value.

 o CMatrix
 public CMatrix(int n)
Creates a square complex matrix with elements initialized to zero values.

Parameters:
n - the dimension of the square matrix.
 o 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
 o CMatrix
 public CMatrix(Complex a[][])
Creates a CMatrix object initialized to a complex matrix.

Parameters:
a[][] - a complex matrix
 o CMatrix
 public CMatrix(CMatrix c)
Creates a Cmatrix object initialized to the argument.

Parameters:
c - a CMatrix object

Methods

 o 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.
 o 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
 o 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
 o 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.
 o 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
 o 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
 o 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..]
 o 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
 o 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
 o 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.
 o 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).
 o 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).
 o 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.
 o 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).
 o 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).
 o 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.
 o 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.
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o mul
 public void mul(Complex k)
Multiplies a constant to every element of this matrix.

Parameters:
k - constant to multiply
 o 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
 o 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.
 o det
 public Complex det()
Returns the complex determinant of this CMatrix object.

Returns:
the complex determinant of this CMatrix.
 o 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
 o 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.
 o inverse
 public void inverse()
Turns this CMatrix object into its inverse matrix. But if its determinant is zero, then nothing happens.

 o 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
 o trans
 public static CMatrix trans(CMatrix c)
Returns the transpose of a CMatrix.

Parameters:
c - a CMatrix object
Returns:
the transpose of the argument
 o trans
 public void trans()
Converts this object into its own transpose matrix.

 o 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]
 o 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.
 o cof
 public Complex cof(int r,
                    int c)
Returns the cofactor of the a[r,c] element of this CMatrix object.

 o 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.
 o 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.
 o adj
 public void adj()
Converts this CMatrix object into its own Hermitian conjugate (adjoint, or the conjugate of the transpose).

 o 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
 o conj
 public void conj()
Converts this complex matrix into its own complex conjugate. Zeroth elements are left alone (they are never used).

 o 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
 o print
 public void print()
Prints out the matrix to standard out. Useful for debugging.


All Packages  Class Hierarchy  This Package  Previous  Next  Index