public class ComplexMatrix extends DefinitionalObject
Complex
values.Modifier | Constructor and Description |
---|---|
|
ComplexMatrix(Complex[][] array)
Initializes a new instance from a two-dimensional array of values.
|
|
ComplexMatrix(Complex[][] array,
int rowDimension,
int columnDimension)
Construct a matrix without copying the given array.
|
|
ComplexMatrix(Complex[] elements,
int rowDimension)
Initializes a new instance from a one-dimensional packed array.
|
|
ComplexMatrix(ComplexMatrix matrix)
Initializes a new
ComplexMatrix from an existing ComplexMatrix . |
protected |
ComplexMatrix(ComplexMatrix existingInstance,
CopyContext context)
Initializes a new instance as a copy of an existing instance.
|
|
ComplexMatrix(int rowDimension,
int columnDimension)
Initializes a new instance with the specified row and column dimensions.
|
|
ComplexMatrix(int rowDimension,
int columnDimension,
Complex elementValue)
Initializes a new instance with the specified row and column dimensions.
|
Modifier and Type | Method and Description |
---|---|
ComplexMatrix |
add(ComplexMatrix addend)
Creates a
ComplexMatrix which is the sum of this matrix and the given matrix. |
static ComplexMatrix |
add(ComplexMatrix leftAddend,
ComplexMatrix rightAddend)
Creates a
ComplexMatrix which is the sum of the two given matrices. |
static void |
addAssign(ComplexMatrix leftAddend,
ComplexMatrix rightAddend,
ComplexMatrix sum)
Assigns the elements of
sum to the element-wise addition
of leftAddend and rightAddend . |
protected boolean |
checkForSameDefinition(ComplexMatrix other)
Checks to determine if another instance has the same definition as this instance and
returns
true if it does. |
protected boolean |
checkForSameDefinition(DefinitionalObject other)
Checks to determine if another instance has the same definition as this instance and
returns
true if it does. |
void |
clear()
Sets the value of every value in the matrix to zero.
|
Object |
clone(CopyContext context)
Clones this object using the specified context.
|
protected int |
computeCurrentDefinitionHashCode()
Computes a hash code based on the current properties of this object.
|
static ComplexMatrix |
elementDivide(ComplexMatrix dividend,
ComplexMatrix divisor)
Creates a new
ComplexMatrix which is the element-by-element division of the two given matrices. |
static void |
elementDivideAssign(ComplexMatrix dividend,
ComplexMatrix divisor,
ComplexMatrix quotient)
Assigns the elements of
quotient to the element-wise division
of dividend divided by divisor . |
ComplexMatrix |
elementMultiply(ComplexMatrix matrix)
Creates a
ComplexMatrix which is the element-by-element multiplication of
this matrix times the given matrix. |
static ComplexMatrix |
elementMultiply(ComplexMatrix multiplicand,
ComplexMatrix multiplier)
Creates a new
ComplexMatrix which is the element-by-element multiplication of the two given matrices. |
static void |
elementMultiplyAssign(ComplexMatrix multiplicand,
ComplexMatrix multiplier,
ComplexMatrix product)
Sets the product
ComplexMatrix to equal the element-wise multiplication
of the multiplicand times the multiplier . |
boolean |
equals(Object obj)
Indicates whether another object is exactly equal to this instance.
|
Complex |
get(int rowIndex,
int columnIndex)
Gets the value at the specified location in the matrix.
|
int |
getColumnDimension()
Gets the number of columns in this matrix.
|
ComplexMatrix |
getMatrix(int[] rowArray,
int[] columnArray)
Gets a new matrix with the values of the specified subset of this matrix.
|
void |
getMatrix(int[] rowArray,
int[] columnArray,
ComplexMatrix destination)
Assigns the values of a subsection of this matrix into the given matrix.
|
ComplexMatrix |
getMatrix(int[] rowArray,
int firstColumn,
int numberOfColumns)
Gets a new matrix with the values of the specified subset of this matrix.
|
void |
getMatrix(int[] rowArray,
int firstColumn,
int numberOfColumns,
ComplexMatrix destination)
Assigns the values of a subsection of this matrix into the given matrix.
|
ComplexMatrix |
getMatrix(int firstRow,
int numberOfRows,
int[] columnArray)
Gets a new matrix with the values of the specified subset of this matrix.
|
void |
getMatrix(int firstRow,
int numberOfRows,
int[] columnArray,
ComplexMatrix destination)
Places the values of a subsection of this matrix into the given matrix.
|
ComplexMatrix |
getMatrix(int firstRow,
int numberOfRows,
int firstColumn,
int numberOfColumns)
Gets a new matrix with the values of the specified subset of this matrix.
|
void |
getMatrix(int firstRow,
int numberOfRows,
int firstColumn,
int numberOfColumns,
ComplexMatrix destination)
Assigns the values of a subsection of this matrix into the given matrix.
|
int |
getRowDimension()
Gets the number of rows in this matrix.
|
int |
hashCode()
Returns a hash code for this instance, which is suitable for use in hashing algorithms and data structures like a hash table.
|
ComplexMatrix |
hermitianTranspose()
Creates a new
ComplexMatrix which is the Hermitian or conjugate transpose of the current matrix. |
static ComplexMatrix |
identity(int rowDimension,
int columnDimension)
Generates an identity matrix.
|
ComplexMatrix |
inverse()
ComplexMatrix inverse. |
Complex[] |
multiply(Complex[] vector)
Returns the result of the multiplication of this matrix and a vector.
|
static Complex[] |
multiply(ComplexMatrix matrix,
Complex[] vector)
Returns the result of the multiplication of this matrix and a vector.
|
static ComplexMatrix |
multiply(ComplexMatrix multiplicand,
ComplexMatrix multiplier)
Creates a
ComplexMatrix which is the linear algebra multiplication of the two given matrices. |
static void |
multiplyAssign(ComplexMatrix multiplicand,
ComplexMatrix multiplier,
ComplexMatrix product)
Sets the product
ComplexMatrix to equal the linear algebra multiplication of multiplicand times multiplier . |
ComplexMatrix |
postMultiply(ComplexMatrix multiplier)
Creates a
ComplexMatrix which is the linear algebra multiplication of this matrix times the given matrix. |
ComplexMatrix |
preMultiply(ComplexMatrix multiplicand)
Creates a
ComplexMatrix which is the linear algebra multiplication of the given matrix times this matrix. |
void |
set(int rowIndex,
int columnIndex,
Complex value)
Sets the value at the specified location in the matrix.
|
static ComplexMatrix |
subtract(ComplexMatrix minuend,
ComplexMatrix subtrahend)
Creates a
ComplexMatrix whose elements have the values of the elements of the minuend matrix
subtracted by the elements of the subtrahend matrix. |
static void |
subtractAssign(ComplexMatrix minuend,
ComplexMatrix subtrahend,
ComplexMatrix difference)
Assigns the elements of
difference to the element-wise subtraction
of minuend by subtrahend . |
ComplexMatrix |
subtractFrom(ComplexMatrix minuend)
Creates a
ComplexMatrix whose elements have the values of the elements of this matrix
subtracted by the elements of the given matrix. |
ComplexMatrix |
transpose()
Creates a new
ComplexMatrix which is the transpose of the current matrix. |
areSameDefinition, areSameDefinition, areSameDefinition, areSameDefinition, areSameDefinition, collectionItemsAreSameDefinition, collectionItemsAreSameDefinition, collectionItemsAreSameDefinition, dictionaryItemsAreSameDefinition, enumerateDependencies, freeze, freezeAggregatedObjects, getCollectionHashCode, getCollectionHashCode, getCollectionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDictionaryHashCode, getIsFrozen, isSameDefinition, throwIfFrozen
public ComplexMatrix(int rowDimension, int columnDimension)
rowDimension
- The number of rows in the matrix.columnDimension
- The number of columns in the matrix.ArgumentOutOfRangeException
- Thrown when rowDimension
or columnDimension
are less than zero.public ComplexMatrix(int rowDimension, int columnDimension, @Nonnull Complex elementValue)
rowDimension
- The number of rows in the matrix.columnDimension
- The number of columns in the matrix.elementValue
- The value that all elements in the matrix will be set to.ArgumentOutOfRangeException
- Thrown when rowDimension
or columnDimension
are less than zero.public ComplexMatrix(@Nonnull Complex[][] array)
array
- A two-dimensional array of Complex
values.IllegalStateException
- Thrown when all rows are not the same length.ArgumentNullException
- Thrown when array
is null
.public ComplexMatrix(@Nonnull Complex[][] array, int rowDimension, int columnDimension)
array
- Rectangular two-dimensional array of Complex numbers.rowDimension
- Number of rows, this must match the first dimension of the given array.columnDimension
- Number of columns, this must match the second dimensions of the given array.ArgumentNullException
- Thrown when array
is null
.ArgumentOutOfRangeException
- Thrown when rowDimension
or columnDimension
are less than zero.public ComplexMatrix(@Nonnull Complex[] elements, int rowDimension)
elements
- A one-dimensional array containing the values of all of the elements.rowDimension
- The number of rows in the matrix.ArgumentOutOfRangeException
- Thrown when rowDimension
is less than zero.ArgumentException
- Thrown when the length of elements
is not a multiple of the column dimension.ArgumentNullException
- Thrown when elements
is null
.public ComplexMatrix(@Nonnull ComplexMatrix matrix)
ComplexMatrix
from an existing ComplexMatrix
.matrix
- The existing ComplexMatrix
to copy.ArgumentNullException
- Thrown when matrix
is null
.protected ComplexMatrix(@Nonnull ComplexMatrix existingInstance, @Nonnull CopyContext context)
See ICloneWithContext.clone(CopyContext)
for more information about how to implement this constructor
in a derived class.
existingInstance
- The existing instance to copy.context
- A CopyContext
that controls the depth of the copy.ArgumentNullException
- Thrown when existingInstance
or context
is null
.public Object clone(CopyContext context)
This method should be implemented to call a copy constructor on the class of the
object being cloned. The copy constructor should take the CopyContext
as a parameter
in addition to the existing instance to copy. The copy constructor should first call
CopyContext.addObjectMapping(T, T)
to identify the newly constructed instance
as a copy of the existing instance. It should then copy all fields, using
CopyContext.updateReference(T)
to copy any reference fields.
A typical implementation of ICloneWithContext
:
public static class MyClass implements ICloneWithContext {
public MyClass(MyClass existingInstance, CopyContext context) {
context.addObjectMapping(existingInstance, this);
someReference = context.updateReference(existingInstance.someReference);
}
@Override
public final Object clone(CopyContext context) {
return new MyClass(this, context);
}
private Object someReference;
}
In general, all fields that are reference types should be copied with a call to
CopyContext.updateReference(T)
. There are a couple of exceptions:
If one of these exceptions applies, the CopyContext
should be given an opportunity
to update the reference before the reference is copied explicitly. Use
CopyContext.updateReference(T)
to update the reference. If CopyContext.updateReference(T)
returns
the original object, indicating that the context does not have a replacement registered,
then copy the object manually by invoking a Clone method, a copy constructor, or by manually
constructing a new instance and copying the values.
alwaysCopy = context.updateReference(existingInstance.alwaysCopy);
if (existingInstance.alwaysCopy != null && alwaysCopy == existingInstance.alwaysCopy) {
alwaysCopy = (AlwaysCopy) existingInstance.alwaysCopy.clone(context);
}
If you are implementing an evaluator (a class that implements IEvaluator
), the
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
method shares some responsibilities with the
copy context constructor. Code duplication can be avoided by doing the following:
CopyContext.updateReference(T)
. You should still call CopyContext.updateReference(T)
on any references to
non-evaluators.
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
as the last line in the constructor and pass it the
same CopyContext
passed to the constructor.
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
as normal. See the reference documentation for
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
for more information on implementing that method.
public MyClass(MyClass existingInstance, CopyContext context) {
super(existingInstance, context);
someReference = context.updateReference(existingInstance.someReference);
evaluatorReference = existingInstance.evaluatorReference;
updateEvaluatorReferences(context);
}
@Override
public void updateEvaluatorReferences(CopyContext context) {
evaluatorReference = context.updateReference(evaluatorReference);
}
@Override
public Object clone(CopyContext context) {
return new MyClass(this, context);
}
private Object someReference;
private IEvaluator evaluatorReference;
clone
in interface ICloneWithContext
clone
in class DefinitionalObject
context
- The context to use to perform the copy.protected final boolean checkForSameDefinition(DefinitionalObject other)
true
if it does. Derived classes MUST override this method and check
all new fields introduced by the derived class for definitional equivalence. It is NOT necessary
to check base class fields because the base class will already have done that. When overriding this method,
you should NOT call the base implementation because it will return false
for all derived-class instances.
Derived classes should check the type of other
to preserve the symmetric nature of IEquatableDefinition.isSameDefinition(java.lang.Object)
.checkForSameDefinition
in class DefinitionalObject
other
- The other instance to compare to this one.true
if the two objects are defined equivalently; otherwise false
.protected boolean checkForSameDefinition(ComplexMatrix other)
true
if it does. Derived classes MUST override this method and check
all new fields introduced by the derived class for definitional equivalence. It is NOT necessary
to check base class fields because the base class will already have done that. When overriding this method,
you should NOT call the base implementation because it will return false
for all derived-class instances.
Derived classes should check the type of other
to preserve the symmetric nature of IEquatableDefinition.isSameDefinition(java.lang.Object)
.other
- The other instance to compare to this one.true
if the two objects are defined equivalently; otherwise false
.protected int computeCurrentDefinitionHashCode()
ComplexMatrix.checkForSameDefinition(agi.foundation.infrastructure.DefinitionalObject)
method.computeCurrentDefinitionHashCode
in class DefinitionalObject
public final Complex get(int rowIndex, int columnIndex)
rowIndex
- The row index of the element being queried.columnIndex
- The column index of the element being queried.Complex
value in the matrix.IndexOutOfBoundsException
- Thrown when rowIndex
is greater than RowDimension
(get
),
or when columnIndex
is greater than ColumnDimension
(get
),
or when either are less than zero.public final void set(int rowIndex, int columnIndex, Complex value)
rowIndex
- The row index of the element being queried.columnIndex
- The column index of the element being queried.IndexOutOfBoundsException
- Thrown when rowIndex
is greater than RowDimension
(get
),
or when columnIndex
is greater than ColumnDimension
(get
),
or when either are less than zero.public final int getRowDimension()
public final int getColumnDimension()
public boolean equals(Object obj)
equals
in class Object
obj
- The object to compare to this instance.true
if obj
is an instance of this type and represents the same value as this instance; otherwise false
.Object.hashCode()
,
HashMap
public int hashCode()
hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public final void clear()
public static ComplexMatrix add(ComplexMatrix leftAddend, ComplexMatrix rightAddend)
ComplexMatrix
which is the sum of the two given matrices.leftAddend
- The first ComplexMatrix
to sum.rightAddend
- The second ComplexMatrix
to sum.ComplexMatrix
which is the sum of the two given matrices.IllegalStateException
- Thrown when the dimensions of leftAddend
do not match the dimensions of rightAddend
.public static void addAssign(@Nonnull ComplexMatrix leftAddend, @Nonnull ComplexMatrix rightAddend, @Nonnull ComplexMatrix sum)
sum
to the element-wise addition
of leftAddend
and rightAddend
.leftAddend
- The first ComplexMatrix
to sum.rightAddend
- The second ComplexMatrix
to sum.sum
- The ComplexMatrix
to use to store the result of the operation.ArgumentNullException
- Thrown when leftAddend
, rightAddend
, or sum
is null
.IllegalStateException
- Thrown when the dimensions of sum
do not match the dimensions of leftAddend
or rightAddend
.@Nonnull public final ComplexMatrix add(@Nonnull ComplexMatrix addend)
ComplexMatrix
which is the sum of this matrix and the given matrix.addend
- The ComplexMatrix
to add to this matrix.ComplexMatrix
which is the sum of this matrix and the given matrix.ArgumentNullException
- Thrown when addend
is null
.IllegalStateException
- Thrown when the dimensions of addend
do not match the dimensions of this ComplexMatrix
.public static ComplexMatrix subtract(ComplexMatrix minuend, ComplexMatrix subtrahend)
ComplexMatrix
whose elements have the values of the elements of the minuend matrix
subtracted by the elements of the subtrahend matrix.minuend
- The ComplexMatrix
being subtracted from.subtrahend
- The ComplexMatrix
to subtract.ComplexMatrix
which is the subtraction of the two given matrices.IllegalStateException
- Thrown when the dimensions of minuend
do not match the dimensions of subtrahend
.public static void subtractAssign(@Nonnull ComplexMatrix minuend, @Nonnull ComplexMatrix subtrahend, @Nonnull ComplexMatrix difference)
difference
to the element-wise subtraction
of minuend
by subtrahend
.minuend
- The ComplexMatrix
being subtracted from.subtrahend
- The ComplexMatrix
to subtract.difference
- The ComplexMatrix
to use to store the result of the operation.ArgumentNullException
- Thrown when minuend
, subtrahend
, or difference
is null
.IllegalStateException
- Thrown when the dimensions of difference
do not match the dimensions of minuend
or subtrahend
.@Nonnull public final ComplexMatrix subtractFrom(@Nonnull ComplexMatrix minuend)
ComplexMatrix
whose elements have the values of the elements of this matrix
subtracted by the elements of the given matrix.minuend
- The ComplexMatrix
that will be subtracted by this matrix.ComplexMatrix
which is the subtraction of the given matrix and this matrix.ArgumentNullException
- Thrown when minuend
is null
.IllegalStateException
- Thrown when the dimensions of minuend
do not match the dimensions of this ComplexMatrix
.public static ComplexMatrix multiply(ComplexMatrix multiplicand, ComplexMatrix multiplier)
ComplexMatrix
which is the linear algebra multiplication of the two given matrices.multiplicand
- The first ComplexMatrix
to multiply.multiplier
- The second ComplexMatrix
to multiply.ComplexMatrix
which is the multiplication of this matrix and the given matrix.IllegalStateException
- Thrown when the column dimension of multiplicand
does not match the row dimension of multiplier
.public static void multiplyAssign(@Nonnull ComplexMatrix multiplicand, @Nonnull ComplexMatrix multiplier, @Nonnull ComplexMatrix product)
ComplexMatrix
to equal the linear algebra multiplication of multiplicand
times multiplier
.multiplicand
- The first ComplexMatrix
to multiply.multiplier
- The second ComplexMatrix
to multiply.product
- The ComplexMatrix
to use to store the result of the operation.ArgumentNullException
- Thrown when multiplicand
, multiplier
, or product
is null
.IllegalStateException
- Thrown when the row dimension of multiplier
does not match the column dimension of multiplicand
,
or when the row dimension of product
does not match the row dimension of multiplicand
,
or when the column dimension of product
does not match the column dimension of multiplier
.@Nonnull public static ComplexMatrix elementMultiply(ComplexMatrix multiplicand, ComplexMatrix multiplier)
ComplexMatrix
which is the element-by-element multiplication of the two given matrices.multiplicand
- The first ComplexMatrix
to multiply.multiplier
- The second ComplexMatrix
to multiply.ComplexMatrix
which equals the element multiplication of the two given matrices.IllegalStateException
- Thrown when the dimensions of multiplicand
do not match the dimensions of multiplier
.@Nonnull public final ComplexMatrix elementMultiply(@Nonnull ComplexMatrix matrix)
ComplexMatrix
which is the element-by-element multiplication of
this matrix times the given matrix.matrix
- The ComplexMatrix
to multiply with this matrix.ComplexMatrix
which is the multiplication of this matrix and the given matrix.ArgumentNullException
- Thrown when matrix
is null
.IllegalStateException
- Thrown when the dimensions of matrix
do not match the dimensions of this ComplexMatrix
.public static void elementMultiplyAssign(@Nonnull ComplexMatrix multiplicand, @Nonnull ComplexMatrix multiplier, @Nonnull ComplexMatrix product)
ComplexMatrix
to equal the element-wise multiplication
of the multiplicand
times the multiplier
.multiplicand
- The first ComplexMatrix
to multiply.multiplier
- The second ComplexMatrix
to multiply.product
- The ComplexMatrix
to use to store the result of the operation.ArgumentNullException
- Thrown when multiplicand
, multiplier
, or product
is null
.IllegalStateException
- Thrown when the dimensions of product
do not match the dimensions of multiplicand
or multiplier
.@Nonnull public final ComplexMatrix postMultiply(@Nonnull ComplexMatrix multiplier)
ComplexMatrix
which is the linear algebra multiplication of this matrix times the given matrix.multiplier
- The ComplexMatrix
to multiply this matrix by.ComplexMatrix
which is the multiplication of this matrix by the given matrix.ArgumentNullException
- Thrown when multiplier
is null
.IllegalStateException
- Thrown when the row dimension of multiplier
does not match the column dimension of this ComplexMatrix
.@Nonnull public final ComplexMatrix preMultiply(@Nonnull ComplexMatrix multiplicand)
ComplexMatrix
which is the linear algebra multiplication of the given matrix times this matrix.multiplicand
- The ComplexMatrix
to multiply by this matrix.ComplexMatrix
which is the multiplication of this matrix and the given matrix.ArgumentNullException
- Thrown when multiplicand
is null
.IllegalStateException
- Thrown when the column dimension of multiplicand
does not match the row dimension of this ComplexMatrix
.@Nonnull public final Complex[] multiply(@Nonnull Complex[] vector)
vector
- The vector to be multiplied.ArgumentNullException
- Thrown when vector
is null
.IllegalStateException
- Thrown when the length of vector
does not match the column dimension of this ComplexMatrix
.public static Complex[] multiply(ComplexMatrix matrix, Complex[] vector)
matrix
- The matrix to be multiplies.vector
- The vector to be multiplied.@Nonnull public static ComplexMatrix elementDivide(ComplexMatrix dividend, ComplexMatrix divisor)
ComplexMatrix
which is the element-by-element division of the two given matrices.dividend
- The ComplexMatrix
whose elements will form the numerators.divisor
- The ComplexMatrix
whose elements will form the denominators.ComplexMatrix
which equals the element division of the two given matrices.IllegalStateException
- Thrown when the dimensions of dividend
do not match the dimensions of divisor
.public static void elementDivideAssign(@Nonnull ComplexMatrix dividend, @Nonnull ComplexMatrix divisor, @Nonnull ComplexMatrix quotient)
quotient
to the element-wise division
of dividend
divided by divisor
.dividend
- The ComplexMatrix
whose elements will form the numerators.divisor
- The ComplexMatrix
whose elements will form the denominators.quotient
- The ComplexMatrix
to use to store the result of the operation.ArgumentNullException
- Thrown when dividend
, divisor
, or quotient
is null
.IllegalStateException
- Thrown when the dimensions of quotient
do not match the dimensions of dividend
or divisor
.@Nonnull public final ComplexMatrix getMatrix(int firstRow, int numberOfRows, int firstColumn, int numberOfColumns)
firstRow
- Inclusive initial index of rows to output from this matrix.numberOfRows
- Number of rows to output from this matrix.firstColumn
- Inclusive initial index of columns to output from this matrix.numberOfColumns
- Number of columns to output from this matrix.ArgumentOutOfRangeException
- Thrown when firstRow
, numberOfRows
, firstColumn
, or numberOfColumns
is less than 0.ArgumentException
- Thrown when firstRow
plus numberOfRows
is greater than the row dimension of this matrix,
or when firstColumn
plus numberOfColumns
is greater than the column dimension of this matrix.public final void getMatrix(int firstRow, int numberOfRows, int firstColumn, int numberOfColumns, @Nonnull ComplexMatrix destination)
destination
matrix must match the dimensions of the requested submatrix.firstRow
- Inclusive initial index of rows to output from this matrix.numberOfRows
- Number of rows to output from this matrix.firstColumn
- Inclusive initial index of columns to output from this matrix.numberOfColumns
- Number of columns to output from this matrix.destination
- The matrix to fill with the values of the submatrix.ArgumentNullException
- Thrown when destination
is null
.ArgumentOutOfRangeException
- Thrown when firstRow
, numberOfRows
, firstColumn
, or numberOfColumns
is less than 0.ArgumentException
- Thrown when firstRow
plus numberOfRows
is greater than the row dimension of this matrix,
or when firstColumn
plus numberOfColumns
is greater than the column dimension of this matrix,
or when the row dimension of destination
is not equal to numberOfRows
,
or when the column dimension of destination
is not equal to numberOfColumns
.@Nonnull public final ComplexMatrix getMatrix(@Nonnull int[] rowArray, int firstColumn, int numberOfColumns)
rowArray
- Array of indices of rows to output from this matrix.firstColumn
- Inclusive initial index of columns to output from this matrix.numberOfColumns
- Number of columns to output from this matrix.ArgumentNullException
- Thrown when rowArray
is null
.ArgumentOutOfRangeException
- Thrown when firstColumn
or numberOfColumns
is less than 0.ArgumentException
- Thrown when firstColumn
plus numberOfColumns
is greater than the column dimension of this matrix,
or when rowArray
contains values less than zero or greater than or equal to the row dimension of this matrix.public final void getMatrix(@Nonnull int[] rowArray, int firstColumn, int numberOfColumns, @Nonnull ComplexMatrix destination)
destination
matrix must match the dimensions of the requested submatrix.rowArray
- Array of indices of rows to output from this matrix.firstColumn
- Inclusive initial index of columns to output from this matrix.numberOfColumns
- Number of columns to output from this matrix.destination
- The matrix to fill with the values of the submatrix.ArgumentNullException
- Thrown when rowArray
or destination
is null
.ArgumentOutOfRangeException
- Thrown when firstColumn
or numberOfColumns
is less than 0.ArgumentException
- Thrown when firstColumn
plus numberOfColumns
is greater than the column dimension of this matrix,
or when the row dimension of destination
is not equal to the length of rowArray
,
or when the column dimension of destination
is not equal to numberOfColumns
,
or when rowArray
contains values less than zero or greater than or equal to the row dimension of this matrix.@Nonnull public final ComplexMatrix getMatrix(int firstRow, int numberOfRows, @Nonnull int[] columnArray)
firstRow
- Inclusive initial index of rows to output from this matrix.numberOfRows
- Number of rows to output from this matrix.columnArray
- Array of indices of columns to output from this matrix.ArgumentNullException
- Thrown when columnArray
is null
.ArgumentOutOfRangeException
- Thrown when firstRow
or numberOfRows
is less than 0.ArgumentException
- Thrown when firstRow
plus numberOfRows
is greater than the row dimension of this matrix,
or when columnArray
contains values less than zero or greater than or equal to the column dimension of this matrix.public final void getMatrix(int firstRow, int numberOfRows, @Nonnull int[] columnArray, @Nonnull ComplexMatrix destination)
destination
matrix must match the dimensions of the requested submatrix.firstRow
- Inclusive initial index of rows to output from this matrix.numberOfRows
- Number of rows to output from this matrix.columnArray
- Array of indices of columns to output from this matrix.destination
- The matrix to fill with the values of the submatrix.ArgumentNullException
- Thrown when columnArray
or destination
is null
.ArgumentOutOfRangeException
- Thrown when firstRow
or numberOfRows
is less than 0.ArgumentException
- Thrown when firstRow
plus numberOfRows
is greater than the row dimension of this matrix,
or when the row dimension of destination
is not equal to numberOfRows
,
or when the column dimension of destination
is not equal to the length of columnArray
,
or when columnArray
contains values less than zero or greater than or equal to the column dimension of this matrix.@Nonnull public final ComplexMatrix getMatrix(@Nonnull int[] rowArray, @Nonnull int[] columnArray)
rowArray
- Array of indices of rows to output from this matrix.columnArray
- Array of indices of columns to output from this matrix.ArgumentNullException
- Thrown when rowArray
or columnArray
is null
.ArgumentException
- Thrown when rowArray
contains values less than zero or greater than or equal to the row dimension of this matrix,
or when columnArray
contains values less than zero or greater than or equal to the column dimension of this matrix.public final void getMatrix(@Nonnull int[] rowArray, @Nonnull int[] columnArray, @Nonnull ComplexMatrix destination)
destination
matrix must match the dimensions of the requested submatrix.rowArray
- Array of indices of rows to output from this matrix.columnArray
- Array of indices of columns to output from this matrix.destination
- The matrix to fill with the values of the submatrix.ArgumentNullException
- Thrown when rowArray
, columnArray
, or destination
is null
.ArgumentException
- Thrown when the row dimension of destination
is not equal to the length of rowArray
,
or when the column dimension of destination
is not equal to the length of columnArray
,
or when rowArray
contains values less than zero or greater than or equal to the row dimension of this matrix,
or when columnArray
contains values less than zero or greater than or equal to the column dimension of this matrix.public final ComplexMatrix inverse()
ComplexMatrix
inverse.IllegalStateException
- Thrown when this ComplexMatrix
is not square.
The inverse operation is currently only available for square matrices.IllegalStateException
- Thrown when the ComplexMatrix
is singular.@Nonnull public static ComplexMatrix identity(int rowDimension, int columnDimension)
rowDimension
- Number of rows.columnDimension
- Number of columns.ComplexMatrix
with ones on the diagonal and zeros elsewhere.@Nonnull public final ComplexMatrix transpose()
ComplexMatrix
which is the transpose of the current matrix.@Nonnull public final ComplexMatrix hermitianTranspose()
ComplexMatrix
which is the Hermitian or conjugate transpose of the current matrix.