Class ComplexMatrix
- java.lang.Object
-
- dev.nm.algebra.linear.matrix.generic.matrixtype.ComplexMatrix
-
- All Implemented Interfaces:
GenericMatrix<ComplexMatrix,Complex>
,GenericMatrixAccess<Complex>
,AbelianGroup<ComplexMatrix>
,Monoid<ComplexMatrix>
,Ring<ComplexMatrix>
,VectorSpace<ComplexMatrix,Complex>
,Table
public class ComplexMatrix extends Object implements GenericMatrix<ComplexMatrix,Complex>
This is aComplex
matrix.
-
-
Constructor Summary
Constructors Constructor Description ComplexMatrix(double[][] data)
Construct aComplex
matrix.ComplexMatrix(int nRows, int nCols)
Construct aComplex
matrix.ComplexMatrix(Complex[][] data)
Construct aComplex
matrix.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ComplexMatrix
add(ComplexMatrix that)
+ : G × G → GDenseMatrix
doubleValue()
Construct aDenseMatrix
equivalent of this Complex matrix (rounded if necessary).boolean
equals(Object obj)
Complex
get(int row, int col)
Get the matrix entry at [i,j].int
hashCode()
ComplexMatrix
minus(ComplexMatrix that)
- : G × G → GComplexMatrix
multiply(ComplexMatrix that)
× : G × G → Gint
nCols()
Gets the number of columns.int
nRows()
Gets the number of rows.ComplexMatrix
ONE()
The multiplicative element 1 in the group such that for any elements a in the group, the equation 1 × a = a × 1 = a holds.ComplexMatrix
opposite()
For each a in G, there exists an element b in G such that a + b = b + a = 0.ComplexMatrix
scaled(Complex scalar)
× : F × V → Vvoid
set(int row, int col, Complex value)
Set the matrix entry at [i,j] to a value.String
toString()
ComplexMatrix
ZERO()
The additive element 0 in the group, such that for all elements a in the group, the equation 0 + a = a + 0 = a holds.
-
-
-
Constructor Detail
-
ComplexMatrix
public ComplexMatrix(int nRows, int nCols)
Construct aComplex
matrix.- Parameters:
nRows
- the number of rowsnCols
- the number of columns
-
ComplexMatrix
public ComplexMatrix(Complex[][] data)
Construct aComplex
matrix.- Parameters:
data
- a matrix data ofComplex
numbers in a 2D array
-
ComplexMatrix
public ComplexMatrix(double[][] data)
Construct aComplex
matrix.- Parameters:
data
- a matrix data ofdouble
s in a 2D array
-
-
Method Detail
-
nRows
public int nRows()
Description copied from interface:Table
Gets the number of rows. Rows count from 1.
-
nCols
public int nCols()
Description copied from interface:Table
Gets the number of columns. Columns count from 1.
-
set
public void set(int row, int col, Complex value)
Description copied from interface:GenericMatrixAccess
Set the matrix entry at [i,j] to a value. This is the only method that may change a matrix.- Specified by:
set
in interfaceGenericMatrixAccess<Complex>
- Parameters:
row
- the row indexcol
- the column indexvalue
- the value to set A[i,j] to
-
get
public Complex get(int row, int col)
Description copied from interface:GenericMatrixAccess
Get the matrix entry at [i,j].- Specified by:
get
in interfaceGenericMatrixAccess<Complex>
- Parameters:
row
- the row indexcol
- the column index- Returns:
- A[i,j]
-
add
public ComplexMatrix add(ComplexMatrix that)
Description copied from interface:AbelianGroup
+ : G × G → G- Specified by:
add
in interfaceAbelianGroup<ComplexMatrix>
- Parameters:
that
- the object to be added- Returns:
- this + that
-
minus
public ComplexMatrix minus(ComplexMatrix that)
Description copied from interface:AbelianGroup
- : G × G → G The operation "-" is not in the definition of of an additive group but can be deduced. This function is provided for convenience purpose. It is equivalent to
.this.add(that.opposite())
- Specified by:
minus
in interfaceAbelianGroup<ComplexMatrix>
- Parameters:
that
- the object to be subtracted (subtrahend)- Returns:
- this - that
-
multiply
public ComplexMatrix multiply(ComplexMatrix that)
Description copied from interface:Monoid
× : G × G → G- Specified by:
multiply
in interfaceMonoid<ComplexMatrix>
- Parameters:
that
- the multiplicand- Returns:
- this × that
-
scaled
public ComplexMatrix scaled(Complex scalar)
Description copied from interface:VectorSpace
× : F × V → V The result of applying this function to a scalar, c, in F and v in V is denoted cv.- Specified by:
scaled
in interfaceVectorSpace<ComplexMatrix,Complex>
- Parameters:
scalar
- a multiplier- Returns:
- c * this
- See Also:
- Wikipedia: Scalar multiplication
-
opposite
public ComplexMatrix opposite()
Description copied from interface:AbelianGroup
For each a in G, there exists an element b in G such that a + b = b + a = 0. That is, it is the object such asthis.add(this.opposite()) == this.ZERO
- Specified by:
opposite
in interfaceAbelianGroup<ComplexMatrix>
- Returns:
- -this, the additive opposite
- See Also:
- Wikipedia: Additive inverse
-
ZERO
public ComplexMatrix ZERO()
Description copied from interface:AbelianGroup
The additive element 0 in the group, such that for all elements a in the group, the equation 0 + a = a + 0 = a holds.- Specified by:
ZERO
in interfaceAbelianGroup<ComplexMatrix>
- Returns:
- 0, the additive identity
-
ONE
public ComplexMatrix ONE()
Description copied from interface:Monoid
The multiplicative element 1 in the group such that for any elements a in the group, the equation 1 × a = a × 1 = a holds.- Specified by:
ONE
in interfaceMonoid<ComplexMatrix>
- Returns:
- 1
-
doubleValue
public DenseMatrix doubleValue()
Construct aDenseMatrix
equivalent of this Complex matrix (rounded if necessary).- Returns:
- a
DenseMatrix
equivalent
-
-