org.openscience.cdk.math

## Class IMatrix

• ```public class IMatrix
extends Object```
This class contains a complex matrix.
Belongs to CDK module:
qm
• ### Field Summary

Fields
Modifier and Type Field and Description
`int` `columns`
the count of columns of the matrix
`double[][]` `imagmatrix`
the imaginary part of the content
`double[][]` `realmatrix`
the real part of the content
`int` `rows`
the count of rows of the matrix
• ### Constructor Summary

Constructors
Constructor and Description
```IMatrix(int rows, int columns)```
Creates a complex matrix
`IMatrix(Matrix m)`
Creates a complex copy of a matrix
• ### Method Summary

All Methods
Modifier and Type Method and Description
`IMatrix` `add(IMatrix b)`
`void` ```add(IMatrix b, IMatrix result)```
`Complex` `contraction()`
Calculates the contraction from a matrix
`IMatrix` `duplicate()`
Copy a matrix
`void` `duplicate(IMatrix result)`
Copy a matrix
`int` `getColumns()`
Returns the count of columns
`int` `getRows()`
Returns the count of rows
`IVector` `getVectorFromColumn(int index)`
Creates a vector with the content of a column from this matrix
`IVector` `getVectorFromDiagonal()`
Creates a vector with the content of the diagonal elements from this matrix
`IVector` `getVectorFromRow(int index)`
Creates a vector with the content of a row from this matrix
`IMatrix` `mul(Complex a)`
Multiplikation from a scalar and a matrix
`void` ```mul(Complex a, IMatrix result)```
Multiplikation from a scalar and a matrix
`IMatrix` `mul(IMatrix b)`
Multiplikation from two matrices
`void` ```mul(IMatrix b, IMatrix result)```
Multiplikation from two matrices
`IVector` `mul(IVector a)`
Multiplikation from a vector and a matrix
`void` ```mul(IVector a, IVector result)```
Multiplikation from a vector and a matrix
`void` ```reshape(int newrows, int newcolumns)```
Resize the matrix
`IMatrix` `similar(IMatrix U)`
Similar transformation Ut * M * U
`void` ```similar(IMatrix U, IMatrix result)```
Similar transformation Ut * M * U
`IMatrix` `sub(IMatrix b)`
Subtraktion from two matrices
`void` ```sub(IMatrix b, IMatrix result)```
Subtraktion from two matrices
`String` `toString()`
Return a matrix as a string
`IMatrix` `transpose()`
Transpose a matrix
`void` `transpose(IMatrix result)`
Transpose a matrix
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`
• ### Field Detail

• #### realmatrix

`public double[][] realmatrix`
the real part of the content
• #### imagmatrix

`public double[][] imagmatrix`
the imaginary part of the content
• #### rows

`public int rows`
the count of rows of the matrix
• #### columns

`public int columns`
the count of columns of the matrix
• ### Constructor Detail

• #### IMatrix

```public IMatrix(int rows,
int columns)```
Creates a complex matrix
• #### IMatrix

`public IMatrix(Matrix m)`
Creates a complex copy of a matrix
• ### Method Detail

• #### getRows

`public int getRows()`
Returns the count of rows
• #### getColumns

`public int getColumns()`
Returns the count of columns
• #### getVectorFromRow

`public IVector getVectorFromRow(int index)`
Creates a vector with the content of a row from this matrix
• #### getVectorFromColumn

`public IVector getVectorFromColumn(int index)`
Creates a vector with the content of a column from this matrix
• #### getVectorFromDiagonal

`public IVector getVectorFromDiagonal()`
Creates a vector with the content of the diagonal elements from this matrix

`public IMatrix add(IMatrix b)`

```public void add(IMatrix b,
IMatrix result)```
• #### sub

`public IMatrix sub(IMatrix b)`
Subtraktion from two matrices
• #### sub

```public void sub(IMatrix b,
IMatrix result)```
Subtraktion from two matrices
• #### mul

`public IMatrix mul(IMatrix b)`
Multiplikation from two matrices
• #### mul

```public void mul(IMatrix b,
IMatrix result)```
Multiplikation from two matrices
• #### mul

`public IVector mul(IVector a)`
Multiplikation from a vector and a matrix
• #### mul

```public void mul(IVector a,
IVector result)```
Multiplikation from a vector and a matrix
• #### mul

`public IMatrix mul(Complex a)`
Multiplikation from a scalar and a matrix
• #### mul

```public void mul(Complex a,
IMatrix result)```
Multiplikation from a scalar and a matrix
• #### duplicate

`public IMatrix duplicate()`
Copy a matrix
• #### duplicate

`public void duplicate(IMatrix result)`
Copy a matrix
• #### transpose

`public IMatrix transpose()`
Transpose a matrix
• #### transpose

`public void transpose(IMatrix result)`
Transpose a matrix
• #### similar

`public IMatrix similar(IMatrix U)`
Similar transformation Ut * M * U
• #### similar

```public void similar(IMatrix U,
IMatrix result)```
Similar transformation Ut * M * U
• #### contraction

`public Complex contraction()`
Calculates the contraction from a matrix
• #### toString

`public String toString()`
Return a matrix as a string
Overrides:
`toString` in class `Object`
• #### reshape

```public void reshape(int newrows,
int newcolumns)```
Resize the matrix