org.ojalgo.matrix

## Class ComplexMatrix

• ### Method Detail

• #### copy

Returns:
A fully mutable matrix builder with the elements initially set to a copy of this matrix.
• #### getArgument

public PrimitiveMatrix getArgument()
Returns:
A primitive double valued matrix containg this matrix' element arguments
• #### getImaginary

public PrimitiveMatrix getImaginary()
Returns:
A primitive double valued matrix containg this matrix' element imaginary parts
• #### getModulus

public PrimitiveMatrix getModulus()
Returns:
A primitive double valued matrix containg this matrix' element modulus
• #### getReal

public PrimitiveMatrix getReal()
Returns:
A primitive double valued matrix containg this matrix' element real parts
• #### calculateFrobeniusNorm

public static <M extends org.ojalgo.matrix.BasicMatrix<?,M>> double calculateFrobeniusNorm(M matrix)
The Frobenius norm is the square root of the sum of the squares of each element, or the square root of the sum of the square of the singular values.
Returns:
The matrix' Frobenius norm
• #### calculateInfinityNorm

public static <M extends org.ojalgo.matrix.BasicMatrix<?,M>> double calculateInfinityNorm(M matrix)
Returns:
The inf-norm or maximum row sum
• #### calculateOneNorm

public static <M extends org.ojalgo.matrix.BasicMatrix<?,M>> double calculateOneNorm(M matrix)
Returns:
The 1-norm or maximum column sum

Specified by:
Returns:

Specified by:
Parameters:
Returns:

Specified by:
Returns:
• #### conjugate

public M conjugate()
Description copied from interface: VectorSpace

This method will (most likely) be moved to some other interface in the future! Just have to figure out where it fits...

The conjugate transpose of a matrix and/or the conjugate of a scalar/field like ComplexNumber or Quaternion.

The conjugate transpose of a real matrix is simply its transpose.

Specified by:
conjugate in interface VectorSpace<M extends org.ojalgo.matrix.BasicMatrix<N,M>,N extends Number>
• #### count

public long count()
Description copied from interface: Structure2D
count() == countRows() * countColumns()
Specified by:
count in interface Structure1D
Specified by:
count in interface Structure2D
Returns:
The total number of elements in this structure.
• #### countColumns

public long countColumns()
Specified by:
countColumns in interface Structure2D
Returns:
The number of columns
• #### countRows

public long countRows()
Specified by:
countRows in interface Structure2D
Returns:
The number of rows
• #### divide

public M divide(double scalarDivisor)
Specified by:
divide in interface ScalarOperation.Division<M extends org.ojalgo.matrix.BasicMatrix<N,M>,N extends Number>
Returns:
this / scalarDivisor.
• #### divide

public M divide(Number scalarDivisor)
Specified by:
divide in interface ScalarOperation.Division<M extends org.ojalgo.matrix.BasicMatrix<N,M>,N extends Number>
Returns:
this / scalarDivisor.
• #### doubleValue

public double doubleValue(long i,
long j)
Description copied from interface: Access2D
Extracts one element of this matrix as a double.
Specified by:
doubleValue in interface Access2D<N extends Number>
Parameters:
i - A row index.
j - A column index.
Returns:
One matrix element
• #### equals

public boolean equals(Access2D<?> another,
NumberContext precision)
Returns:
true if the frobenius norm of the difference between [this] and [another] is zero within the limits of [precision].
• #### equals

public boolean equals(Object other)
Overrides:
equals in class Object
• #### flushCache

public void flushCache()
BasicMatrix instances are intended to be immutable. If they are it is possible to cache (partial) calculation results. Calling this method should flush any cached calculation results.
• #### get

public N get(long index)
Specified by:
get in interface Access1D<N extends Number>
Specified by:
get in interface Access2D<N extends Number>
• #### get

public N get(long aRow,
long aColumn)
Specified by:
get in interface Access2D<N extends Number>
• #### getCondition

public Scalar<N> getCondition()
Matrix condition (2-norm)
Returns:
ratio of largest to smallest singular value.
• #### getDeterminant

public Scalar<N> getDeterminant()
Returns:
The matrix' determinant.
• #### getRank

public int getRank()
The rank of a matrix is the (maximum) number of linearly independent rows or columns it contains. It is also equal to the number of nonzero singular values of the matrix.
Returns:
The matrix' rank.
MatrixDecomposition.RankRevealing
• #### getTrace

public Scalar<N> getTrace()
The sum of the diagonal elements.
Returns:
The matrix' trace.
• #### hashCode

public int hashCode()
Overrides:
hashCode in class Object
• #### invert

public M invert()

• "right inverse": [this][right inverse]=[I]. You may calculate it using solve(Access2D).
• "left inverse": [left inverse][this]=[I]. You may calculate it using solve(Access2D) and transposing.
• "generalised inverse": [this][generalised inverse][this]=[this]. Note that if [this] is singular or non-square, then [generalised inverse] is not unique.
• "pseudoinverse": The generalised inverse (there are typically/possibly many) with the smallest frobenius norm is called the pseudoinverse. You may calculate it using the QR or SingularValue decompositions.
• "inverse":
• If [left inverse]=[right inverse] then it is also [inverse].
• If [this] is square and has full rank then the [generalised inverse] is unique, with the [pseudoinverse] given, and equal to [inverse].
Returns:
The "best possible" inverse....
• #### isHermitian

public boolean isHermitian()
• #### isSmall

public boolean isSmall(double comparedTo)
Specified by:
isSmall in interface NormedVectorSpace<M extends org.ojalgo.matrix.BasicMatrix<N,M>,N extends Number>
Parameters:
comparedTo - What to compare with
Returns:
true if this is small compared to the magnitude of the input reference value.
• #### isSymmetric

public boolean isSymmetric()
• #### multiply

public M multiply(double scalarMultiplicand)
Specified by:
multiply in interface ScalarOperation.Multiplication<M extends org.ojalgo.matrix.BasicMatrix<N,M>,N extends Number>
Returns:
this * scalarMultiplicand.
• #### multiply

public M multiply(M multiplicand)
Specified by:
multiply in interface Operation.Multiplication<M extends org.ojalgo.matrix.BasicMatrix<N,M>>
Parameters:
multiplicand - The multiplicand
Returns:
this * multiplicand.
• #### negate

public M negate()
Specified by:
negate in interface Group.Additive<M extends org.ojalgo.matrix.BasicMatrix<N,M>>
Returns:
-this.
• #### norm

public double norm()
The Frobenius norm is the square root of the sum of the squares of each element, or the square root of the sum of the square of the singular values. This definition fits the requirements of NormedVectorSpace.norm().
Specified by:
norm in interface NormedVectorSpace<M extends org.ojalgo.matrix.BasicMatrix<N,M>,N extends Number>
Returns:
The matrix' Frobenius norm
• #### signum

public M signum()
Description copied from interface: NormedVectorSpace
this == this.signum().multiply(this.norm())
Specified by:
signum in interface NormedVectorSpace<M extends org.ojalgo.matrix.BasicMatrix<N,M>,N extends Number>
Returns:
A unit "vector"
• #### solve

public M solve(Access2D<?> rhs)

This method solves a system of linear equations: [this][X]=[rhs]. A combination of columns in [this] should produce a column(s) in [rhs]. It is ok for [rhs] to have more than 1 column.

• If the problem is over-qualified an approximate solution is returned.
• If the problem is under-qualified one possible solution is returned.

Remember that: [X][this]=[rhs] is equivalent to [this]T[X]T=[rhs]T

Parameters:
rhs - The right hand side of the equation.
Returns:
The solution, [X].
• #### subtract

public M subtract(double scalarSubtrahend)
Specified by:
subtract in interface ScalarOperation.Subtraction<M extends org.ojalgo.matrix.BasicMatrix<N,M>,N extends Number>
Returns:
this - scalarSubtrahend.
• #### subtract

public M subtract(M subtrahend)
Specified by:
subtract in interface Operation.Subtraction<M extends org.ojalgo.matrix.BasicMatrix<N,M>>
Parameters:
subtrahend - The subtrahend
Returns:
this - subtrahend.
• #### subtract

public M subtract(Number scalarSubtrahend)
Specified by:
subtract in interface ScalarOperation.Subtraction<M extends org.ojalgo.matrix.BasicMatrix<N,M>,N extends Number>
Returns:
this - scalarSubtrahend.
• #### toScalar

public Scalar<N> toScalar(long row,
long col)
Extracts one element of this matrix as a Scalar.
Parameters:
row - A row index.
col - A column index.
Returns:
One matrix element
• #### toString

public final String toString()
Overrides:
toString in class Object
• #### transpose

public M transpose()
Transposes this matrix. For complex matrices conjugate() and transpose() are NOT EQUAL.
Returns:
A matrix that is the transpose of this matrix.