org.jblas.la
Class ComplexFloatMatrix

java.lang.Object
  extended by org.jblas.la.ComplexFloatMatrix

public class ComplexFloatMatrix
extends java.lang.Object


Field Summary
 int columns
           
 float[] data
           
 int length
           
 int rows
           
 
Constructor Summary
ComplexFloatMatrix()
          Creates a new ComplexFloatMatrix of size 0 times 0.
ComplexFloatMatrix(ComplexFloat[] newData)
           
ComplexFloatMatrix(float[] newData)
           
ComplexFloatMatrix(float[][] data)
          Creates a new n times m ComplexFloatMatrix from the given n times m 2D data array.
ComplexFloatMatrix(FloatMatrix m)
          Construct a complex matrix from a real matrix.
ComplexFloatMatrix(FloatMatrix real, FloatMatrix imag)
          Construct a complex matrix from separate real and imaginary parts.
ComplexFloatMatrix(int len)
          Create a Matrix of length len.
ComplexFloatMatrix(int newRows, int newColumns)
          Creates a new n times m ComplexFloatMatrix.
ComplexFloatMatrix(int newRows, int newColumns, float... newData)
          Create a new matrix with newRows rows, newColumns columns using newData> as the data.
ComplexFloatMatrix(java.lang.String filename)
          Creates a new matrix by reading it from a file.
 
Method Summary
 ComplexFloatMatrix add(ComplexFloat v)
           
 ComplexFloatMatrix add(ComplexFloatMatrix other)
           
 ComplexFloatMatrix add(float v)
           
 void addColumnVector(ComplexFloatMatrix x)
          Add a vector to all columns of the matrix
 ComplexFloatMatrix addi(ComplexFloat v)
           
 ComplexFloatMatrix addi(ComplexFloat v, ComplexFloatMatrix result)
          Add a scalar to a matrix.
 ComplexFloatMatrix addi(ComplexFloatMatrix other)
          Code for operators
 ComplexFloatMatrix addi(ComplexFloatMatrix other, ComplexFloatMatrix result)
          Add two matrices.
 ComplexFloatMatrix addi(float v)
           
 ComplexFloatMatrix addi(float v, ComplexFloatMatrix result)
           
 void addRowVector(ComplexFloatMatrix x)
          Add a row vector to all rows of the matrix
 ComplexFloatMatrix and(ComplexFloat value)
           
 ComplexFloatMatrix and(ComplexFloatMatrix other)
           
 ComplexFloatMatrix and(float value)
           
 ComplexFloatMatrix andi(ComplexFloat value)
           
 ComplexFloatMatrix andi(ComplexFloat value, ComplexFloatMatrix result)
           
 ComplexFloatMatrix andi(ComplexFloatMatrix other)
           
 ComplexFloatMatrix andi(ComplexFloatMatrix other, ComplexFloatMatrix result)
           
 ComplexFloatMatrix andi(float value)
           
 ComplexFloatMatrix andi(float value, ComplexFloatMatrix result)
           
 void assertMultipliesWith(ComplexFloatMatrix a)
           
 void assertSameLength(ComplexFloatMatrix a)
           
 void assertSameSize(ComplexFloatMatrix a)
          Assert that two matrices have the same size.
 void assertSquare()
           
 ComplexFloatMatrix columnMeans()
           
 ComplexFloatMatrix columnSums()
          Return a vector containing the sums of the columns (having number of columns many entries)
static ComplexFloatMatrix concatHorizontally(ComplexFloatMatrix A, ComplexFloatMatrix B)
           
static ComplexFloatMatrix concatVertically(ComplexFloatMatrix A, ComplexFloatMatrix B)
           
 ComplexFloatMatrix conji()
           
 ComplexFloatMatrix copy(ComplexFloatMatrix a)
          Copy ComplexFloatMatrix a to this.
 ComplexFloatMatrix diag()
          Get diagonal of the matrix.
static ComplexFloatMatrix diag(ComplexFloatMatrix x)
          Creates a new matrix where the values of the given vector are the diagonal values of the matrix.
 ComplexFloatMatrix div(ComplexFloat v)
           
 ComplexFloatMatrix div(ComplexFloatMatrix other)
           
 ComplexFloatMatrix div(float v)
           
 ComplexFloatMatrix divi(ComplexFloat v)
           
 ComplexFloatMatrix divi(ComplexFloat a, ComplexFloatMatrix result)
          (Elementwise) division with a scalar
 ComplexFloatMatrix divi(ComplexFloatMatrix other)
           
 ComplexFloatMatrix divi(ComplexFloatMatrix other, ComplexFloatMatrix result)
          (Elementwise) division
 ComplexFloatMatrix divi(float v)
           
 ComplexFloatMatrix divi(float a, ComplexFloatMatrix result)
           
 ComplexFloat dotc(ComplexFloatMatrix other)
           
 ComplexFloat dotu(ComplexFloatMatrix other)
           
 ComplexFloatMatrix dup()
          Returns a duplicate of this matrix.
 ComplexFloatMatrix eq(ComplexFloat value)
           
 ComplexFloatMatrix eq(ComplexFloatMatrix other)
           
 ComplexFloatMatrix eq(float value)
           
 ComplexFloatMatrix eqi(ComplexFloat value)
           
 ComplexFloatMatrix eqi(ComplexFloat value, ComplexFloatMatrix result)
           
 ComplexFloatMatrix eqi(ComplexFloatMatrix other)
           
 ComplexFloatMatrix eqi(ComplexFloatMatrix other, ComplexFloatMatrix result)
           
 ComplexFloatMatrix eqi(float value)
           
 ComplexFloatMatrix eqi(float value, ComplexFloatMatrix result)
           
 boolean equals(java.lang.Object o)
          Compare two matrices.
 int[] findIndices()
           
 ComplexFloatMatrix get(ComplexFloatMatrix indices)
           
 ComplexFloatMatrix get(ComplexFloatMatrix rindices, ComplexFloatMatrix cindices)
           
 ComplexFloatMatrix get(ComplexFloatMatrix indices, int c)
           
 ComplexFloat get(int i)
           
 ComplexFloatMatrix get(int[] indices)
          Working with slices (Man! 30+ methods just to make this a bit flexible...)
 ComplexFloatMatrix get(int[] indices, int c)
           
 ComplexFloatMatrix get(int[] rindices, int[] cindices)
           
 ComplexFloat get(int i, ComplexFloat result)
           
 ComplexFloatMatrix get(int r, ComplexFloatMatrix indices)
           
 ComplexFloat get(int rowIndex, int columnIndex)
          Retrieve matrix element
 ComplexFloatMatrix get(int r, int[] indices)
           
 ComplexFloatMatrix getColumn(int c)
           
 int getColumns()
           
 float getImag(int i)
           
 int getLength()
           
 FloatMatrix getReal()
           
 float getReal(int i)
           
 ComplexFloatMatrix getRow(int r)
           
 int getRows()
           
 FloatMatrix imag()
          Get imaginary part of the matrix.
 void in(java.io.DataInputStream dis)
          Reads in a matrix from the given data stream.
 int index(int rowIndex, int columnIndex)
          Get index of an element
 boolean isColumnVector()
           
 boolean isEmpty()
          Checks whether the matrix is empty.
 boolean isRowVector()
           
 boolean isScalar()
          Test whether a matrix is scalar
 boolean isSquare()
          Checks whether the matrix is square.
 boolean isVector()
          Checks whether the matrix is a vector.
 void load(java.lang.String filename)
          Loads a matrix from a file into this matrix.
 ComplexFloat mean()
           
 ComplexFloatMatrix mmul(ComplexFloat v)
           
 ComplexFloatMatrix mmul(ComplexFloatMatrix other)
           
 ComplexFloatMatrix mmul(float v)
           
 ComplexFloatMatrix mmuli(ComplexFloat v)
           
 ComplexFloatMatrix mmuli(ComplexFloat v, ComplexFloatMatrix result)
          Matrix-Matrix Multiplication with a scalar (for symmetry, does the same as muli(scalar)
 ComplexFloatMatrix mmuli(ComplexFloatMatrix other)
           
 ComplexFloatMatrix mmuli(ComplexFloatMatrix other, ComplexFloatMatrix result)
          Matrix-Matrix Multiplication
 ComplexFloatMatrix mmuli(float v)
           
 ComplexFloatMatrix mmuli(float v, ComplexFloatMatrix result)
           
 ComplexFloatMatrix mul(ComplexFloat v)
           
 ComplexFloatMatrix mul(ComplexFloatMatrix other)
           
 ComplexFloatMatrix mul(float v)
           
 ComplexFloatMatrix muli(ComplexFloat v)
           
 ComplexFloatMatrix muli(ComplexFloat v, ComplexFloatMatrix result)
          (Elementwise) Multiplication with a scalar
 ComplexFloatMatrix muli(ComplexFloatMatrix other)
           
 ComplexFloatMatrix muli(ComplexFloatMatrix other, ComplexFloatMatrix result)
          (Elementwise) Multiplication
 ComplexFloatMatrix muli(float v)
           
 ComplexFloatMatrix muli(float v, ComplexFloatMatrix result)
           
 boolean multipliesWith(ComplexFloatMatrix a)
          Check whether this can be multiplied with a.
 ComplexFloatMatrix ne(ComplexFloat value)
           
 ComplexFloatMatrix ne(ComplexFloatMatrix other)
           
 ComplexFloatMatrix ne(float value)
           
 ComplexFloatMatrix neg()
           
 ComplexFloatMatrix negi()
           
 ComplexFloatMatrix nei(ComplexFloat value)
           
 ComplexFloatMatrix nei(ComplexFloat value, ComplexFloatMatrix result)
           
 ComplexFloatMatrix nei(ComplexFloatMatrix other)
           
 ComplexFloatMatrix nei(ComplexFloatMatrix other, ComplexFloatMatrix result)
           
 ComplexFloatMatrix nei(float value)
           
 ComplexFloatMatrix nei(float value, ComplexFloatMatrix result)
           
 float norm1()
           
 float norm2()
           
 float normmax()
           
 ComplexFloatMatrix not()
           
 ComplexFloatMatrix noti()
           
static ComplexFloatMatrix ones(int length)
           
static ComplexFloatMatrix ones(int rows, int columns)
          Creates a new matrix in which all values are equal 1.
 ComplexFloatMatrix or(ComplexFloat value)
           
 ComplexFloatMatrix or(ComplexFloatMatrix other)
           
 ComplexFloatMatrix or(float value)
           
 ComplexFloatMatrix ori(ComplexFloat value)
           
 ComplexFloatMatrix ori(ComplexFloat value, ComplexFloatMatrix result)
           
 ComplexFloatMatrix ori(ComplexFloatMatrix other)
           
 ComplexFloatMatrix ori(ComplexFloatMatrix other, ComplexFloatMatrix result)
           
 ComplexFloatMatrix ori(float value)
           
 ComplexFloatMatrix ori(float value, ComplexFloatMatrix result)
           
 void out(java.io.DataOutputStream dos)
          Writes out this matrix to the given data stream.
 void print()
          Pretty-print this matrix to System.out.
 ComplexFloatMatrix put(ComplexFloatMatrix indices, ComplexFloat v)
           
 ComplexFloatMatrix put(ComplexFloatMatrix indices, ComplexFloatMatrix v)
           
 ComplexFloatMatrix put(ComplexFloatMatrix rindices, ComplexFloatMatrix cindices, ComplexFloat v)
           
 ComplexFloatMatrix put(ComplexFloatMatrix rindices, ComplexFloatMatrix cindices, ComplexFloatMatrix v)
           
 ComplexFloatMatrix put(ComplexFloatMatrix rindices, ComplexFloatMatrix cindices, float v)
           
 ComplexFloatMatrix put(ComplexFloatMatrix indices, float v)
           
 ComplexFloatMatrix put(ComplexFloatMatrix indices, int c, ComplexFloat v)
           
 ComplexFloatMatrix put(ComplexFloatMatrix indices, int c, ComplexFloatMatrix v)
           
 ComplexFloatMatrix put(ComplexFloatMatrix indices, int c, float v)
           
 ComplexFloatMatrix put(int[] indices, ComplexFloat v)
           
 ComplexFloatMatrix put(int[] indices, ComplexFloatMatrix x)
           
 ComplexFloatMatrix put(int[] indices, float v)
           
 ComplexFloatMatrix put(int[] rindices, int[] cindices, ComplexFloat v)
           
 ComplexFloatMatrix put(int[] rindices, int[] cindices, ComplexFloatMatrix x)
           
 ComplexFloatMatrix put(int[] rindices, int[] cindices, float v)
           
 ComplexFloatMatrix put(int[] indices, int c, ComplexFloat v)
           
 ComplexFloatMatrix put(int[] indices, int c, ComplexFloatMatrix x)
           
 ComplexFloatMatrix put(int[] indices, int c, float v)
           
 ComplexFloatMatrix put(int i, ComplexFloat v)
           
 ComplexFloatMatrix put(int r, ComplexFloatMatrix indices, ComplexFloat v)
           
 ComplexFloatMatrix put(int r, ComplexFloatMatrix indices, ComplexFloatMatrix v)
           
 ComplexFloatMatrix put(int r, ComplexFloatMatrix indices, float v)
           
 ComplexFloatMatrix put(int i, float v)
           
 ComplexFloatMatrix put(int r, int[] indices, ComplexFloat v)
           
 ComplexFloatMatrix put(int r, int[] indices, ComplexFloatMatrix x)
           
 ComplexFloatMatrix put(int r, int[] indices, float v)
           
 ComplexFloatMatrix put(int rowIndex, int columnIndex, ComplexFloat value)
           
 ComplexFloatMatrix put(int rowIndex, int columnIndex, float value)
          Set matrix element
 void putColumn(int c, ComplexFloatMatrix v)
           
 ComplexFloatMatrix putImag(ComplexFloatMatrix rindices, ComplexFloatMatrix cindices, float v)
           
 ComplexFloatMatrix putImag(ComplexFloatMatrix indices, float v)
           
 ComplexFloatMatrix putImag(ComplexFloatMatrix indices, int c, float v)
           
 ComplexFloatMatrix putImag(int[] indices, float v)
           
 ComplexFloatMatrix putImag(int[] rindices, int[] cindices, float v)
           
 ComplexFloatMatrix putImag(int[] indices, int c, float v)
           
 ComplexFloatMatrix putImag(int r, ComplexFloatMatrix indices, float v)
           
 ComplexFloatMatrix putImag(int i, float v)
           
 ComplexFloatMatrix putImag(int r, int[] indices, float v)
           
 ComplexFloatMatrix putImag(int rowIndex, int columnIndex, float value)
           
 ComplexFloatMatrix putReal(ComplexFloatMatrix rindices, ComplexFloatMatrix cindices, float v)
           
 ComplexFloatMatrix putReal(ComplexFloatMatrix indices, float v)
           
 ComplexFloatMatrix putReal(ComplexFloatMatrix indices, int c, float v)
           
 ComplexFloatMatrix putReal(int[] indices, float v)
           
 ComplexFloatMatrix putReal(int[] rindices, int[] cindices, float v)
           
 ComplexFloatMatrix putReal(int[] indices, int c, float v)
           
 ComplexFloatMatrix putReal(int r, ComplexFloatMatrix indices, float v)
           
 ComplexFloatMatrix putReal(int i, float v)
           
 ComplexFloatMatrix putReal(int r, int[] indices, float v)
           
 ComplexFloatMatrix putReal(int rowIndex, int columnIndex, float value)
           
 void putRow(int r, ComplexFloatMatrix v)
           
 ComplexFloatMatrix rankOneUpdate(ComplexFloat alpha, ComplexFloatMatrix x)
          Computes a rank-1-update A = A + alpha * x * x'.
 ComplexFloatMatrix rankOneUpdate(ComplexFloat alpha, ComplexFloatMatrix x, ComplexFloatMatrix y)
          Computes a rank-1-update A = A + alpha * x * y'.
 ComplexFloatMatrix rankOneUpdate(ComplexFloatMatrix x)
          Computes a rank-1-update A = A + x * x'.
 ComplexFloatMatrix rankOneUpdate(ComplexFloatMatrix x, ComplexFloatMatrix y)
          Computes a rank-1-update A = A + x * y'.
 ComplexFloatMatrix rankOneUpdate(float alpha, ComplexFloatMatrix x)
          Computes a rank-1-update A = A + alpha * x * x'.
 ComplexFloatMatrix rankOneUpdate(float alpha, ComplexFloatMatrix x, ComplexFloatMatrix y)
           
 ComplexFloatMatrix rdiv(ComplexFloat v)
           
 ComplexFloatMatrix rdiv(ComplexFloatMatrix other)
           
 ComplexFloatMatrix rdiv(float v)
           
 ComplexFloatMatrix rdivi(ComplexFloat v)
           
 ComplexFloatMatrix rdivi(ComplexFloat a, ComplexFloatMatrix result)
          (Elementwise) division with a scalar, with operands switched.
 ComplexFloatMatrix rdivi(ComplexFloatMatrix other)
           
 ComplexFloatMatrix rdivi(ComplexFloatMatrix other, ComplexFloatMatrix result)
          (Elementwise) division, with operands switched.
 ComplexFloatMatrix rdivi(float v)
           
 ComplexFloatMatrix rdivi(float a, ComplexFloatMatrix result)
           
 FloatMatrix real()
          Get real part of the matrix.
 ComplexFloatMatrix reshape(int newRows, int newColumns)
          Reshape the matrix.
 void resize(int newRows, int newColumns)
          Resize the matrix.
 ComplexFloatMatrix rowMeans()
           
 ComplexFloatMatrix rowSums()
           
 ComplexFloatMatrix rsub(ComplexFloat v)
           
 ComplexFloatMatrix rsub(ComplexFloatMatrix other)
           
 ComplexFloatMatrix rsub(float v)
           
 ComplexFloatMatrix rsubi(ComplexFloat v)
           
 ComplexFloatMatrix rsubi(ComplexFloat a, ComplexFloatMatrix result)
          Subtract a matrix from a scalar
 ComplexFloatMatrix rsubi(ComplexFloatMatrix other)
           
 ComplexFloatMatrix rsubi(ComplexFloatMatrix other, ComplexFloatMatrix result)
          Subtract two matrices, but subtract first from second matrix, that is, compute result = other - this.
 ComplexFloatMatrix rsubi(float v)
           
 ComplexFloatMatrix rsubi(float a, ComplexFloatMatrix result)
           
 boolean sameLength(ComplexFloatMatrix a)
           
 boolean sameSize(ComplexFloatMatrix a)
          Checks whether two matrices have the same size.
 void save(java.lang.String filename)
          Saves this matrix to the specified file.
 ComplexFloat scalar()
          Return the first element of the matrix
static ComplexFloatMatrix scalar(float s)
          Create a 1 * 1 - matrix.
 ComplexFloatMatrix sub(ComplexFloat v)
           
 ComplexFloatMatrix sub(ComplexFloatMatrix other)
           
 ComplexFloatMatrix sub(float v)
           
 void subColumnVector(ComplexFloatMatrix x)
          Add a vector to all columns of the matrix
 ComplexFloatMatrix subi(ComplexFloat v)
           
 ComplexFloatMatrix subi(ComplexFloat v, ComplexFloatMatrix result)
          Subtract a scalar from a matrix
 ComplexFloatMatrix subi(ComplexFloatMatrix other)
           
 ComplexFloatMatrix subi(ComplexFloatMatrix other, ComplexFloatMatrix result)
          Subtract two matrices.
 ComplexFloatMatrix subi(float v)
           
 ComplexFloatMatrix subi(float v, ComplexFloatMatrix result)
           
 void subRowVector(ComplexFloatMatrix x)
          Add a row vector to all rows of the matrix
 ComplexFloat sum()
          Logical operations
 ComplexFloatMatrix swapColumns(int i, int j)
           
 ComplexFloatMatrix swapRows(int i, int j)
           
 ComplexFloat[] toArray()
           
 ComplexFloat[][] toArray2()
           
 boolean[] toBooleanArray()
           
 boolean[][] toBooleanArray2()
           
 float[] toDoubleArray()
           
 java.lang.String toString()
          Generate string representation of this matrix (multi-line).
 ComplexFloatMatrix transpose()
          Return transposed copy of this matrix
 ComplexFloatMatrix truth()
           
 ComplexFloatMatrix truthi()
           
 ComplexFloatMatrix xor(ComplexFloat value)
           
 ComplexFloatMatrix xor(ComplexFloatMatrix other)
           
 ComplexFloatMatrix xor(float value)
           
 ComplexFloatMatrix xori(ComplexFloat value)
           
 ComplexFloatMatrix xori(ComplexFloat value, ComplexFloatMatrix result)
           
 ComplexFloatMatrix xori(ComplexFloatMatrix other)
           
 ComplexFloatMatrix xori(ComplexFloatMatrix other, ComplexFloatMatrix result)
           
 ComplexFloatMatrix xori(float value)
           
 ComplexFloatMatrix xori(float value, ComplexFloatMatrix result)
           
static ComplexFloatMatrix zeros(int length)
           
static ComplexFloatMatrix zeros(int rows, int columns)
          Creates a new matrix in which all values are equal 0.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rows

public int rows

columns

public int columns

length

public int length

data

public float[] data
Constructor Detail

ComplexFloatMatrix

public ComplexFloatMatrix(int newRows,
                          int newColumns,
                          float... newData)
Create a new matrix with newRows rows, newColumns columns using newData> as the data. The length of the data is not checked!


ComplexFloatMatrix

public ComplexFloatMatrix(int newRows,
                          int newColumns)
Creates a new n times m ComplexFloatMatrix.

Parameters:
newRows - the number of rows (n) of the new matrix.
newColumns - the number of columns (m) of the new matrix.

ComplexFloatMatrix

public ComplexFloatMatrix()
Creates a new ComplexFloatMatrix of size 0 times 0.


ComplexFloatMatrix

public ComplexFloatMatrix(int len)
Create a Matrix of length len. By default, this creates a row vector.

Parameters:
len -

ComplexFloatMatrix

public ComplexFloatMatrix(float[] newData)

ComplexFloatMatrix

public ComplexFloatMatrix(ComplexFloat[] newData)

ComplexFloatMatrix

public ComplexFloatMatrix(FloatMatrix m)
Construct a complex matrix from a real matrix.


ComplexFloatMatrix

public ComplexFloatMatrix(FloatMatrix real,
                          FloatMatrix imag)
Construct a complex matrix from separate real and imaginary parts. Either part can be set to null in which case it will be ignored.


ComplexFloatMatrix

public ComplexFloatMatrix(java.lang.String filename)
                   throws java.io.IOException
Creates a new matrix by reading it from a file.

Parameters:
filename - the path and name of the file to read the matrix from
Throws:
java.io.IOException

ComplexFloatMatrix

public ComplexFloatMatrix(float[][] data)
Creates a new n times m ComplexFloatMatrix from the given n times m 2D data array. The first dimension of the array makes the rows (n) and the second dimension the columns (m). For example, the given code

new ComplexFloatMatrix(new float[][]{{1d, 2d, 3d}, {4d, 5d, 6d}, {7d, 8d, 9d}}).print();

will constructs the following matrix:
 1.0f   2.0f    3.0f
 4.0f   5.0f    6.0f
 7.0f   8.0f    9.0f
 
.

Parameters:
data - n times m data array
Method Detail

zeros

public static ComplexFloatMatrix zeros(int rows,
                                       int columns)
Creates a new matrix in which all values are equal 0.

Parameters:
rows - number of rows
columns - number of columns
Returns:
new matrix

zeros

public static ComplexFloatMatrix zeros(int length)

ones

public static ComplexFloatMatrix ones(int rows,
                                      int columns)
Creates a new matrix in which all values are equal 1.

Parameters:
rows - number of rows
columns - number of columns
Returns:
new matrix

ones

public static ComplexFloatMatrix ones(int length)

diag

public static ComplexFloatMatrix diag(ComplexFloatMatrix x)
Creates a new matrix where the values of the given vector are the diagonal values of the matrix.

Parameters:
x - the diagonal values
Returns:
new matrix

scalar

public static ComplexFloatMatrix scalar(float s)
Create a 1 * 1 - matrix. For many operations, this matrix functions like a normal float

Parameters:
s - value of the matrix
Returns:
the constructed ComplexFloatMatrix

isScalar

public boolean isScalar()
Test whether a matrix is scalar


scalar

public ComplexFloat scalar()
Return the first element of the matrix


concatHorizontally

public static ComplexFloatMatrix concatHorizontally(ComplexFloatMatrix A,
                                                    ComplexFloatMatrix B)

concatVertically

public static ComplexFloatMatrix concatVertically(ComplexFloatMatrix A,
                                                  ComplexFloatMatrix B)

get

public ComplexFloatMatrix get(int[] indices)
Working with slices (Man! 30+ methods just to make this a bit flexible...)


get

public ComplexFloatMatrix get(int r,
                              int[] indices)

get

public ComplexFloatMatrix get(int[] indices,
                              int c)

get

public ComplexFloatMatrix get(int[] rindices,
                              int[] cindices)

get

public ComplexFloatMatrix get(ComplexFloatMatrix indices)

get

public ComplexFloatMatrix get(int r,
                              ComplexFloatMatrix indices)

get

public ComplexFloatMatrix get(ComplexFloatMatrix indices,
                              int c)

get

public ComplexFloatMatrix get(ComplexFloatMatrix rindices,
                              ComplexFloatMatrix cindices)

put

public ComplexFloatMatrix put(int[] indices,
                              ComplexFloatMatrix x)

put

public ComplexFloatMatrix put(int r,
                              int[] indices,
                              ComplexFloatMatrix x)

put

public ComplexFloatMatrix put(int[] indices,
                              int c,
                              ComplexFloatMatrix x)

put

public ComplexFloatMatrix put(int[] rindices,
                              int[] cindices,
                              ComplexFloatMatrix x)

put

public ComplexFloatMatrix put(int[] indices,
                              float v)

putReal

public ComplexFloatMatrix putReal(int[] indices,
                                  float v)

putImag

public ComplexFloatMatrix putImag(int[] indices,
                                  float v)

put

public ComplexFloatMatrix put(int[] indices,
                              ComplexFloat v)

put

public ComplexFloatMatrix put(int r,
                              int[] indices,
                              float v)

putReal

public ComplexFloatMatrix putReal(int r,
                                  int[] indices,
                                  float v)

putImag

public ComplexFloatMatrix putImag(int r,
                                  int[] indices,
                                  float v)

put

public ComplexFloatMatrix put(int r,
                              int[] indices,
                              ComplexFloat v)

put

public ComplexFloatMatrix put(int[] indices,
                              int c,
                              float v)

putReal

public ComplexFloatMatrix putReal(int[] indices,
                                  int c,
                                  float v)

putImag

public ComplexFloatMatrix putImag(int[] indices,
                                  int c,
                                  float v)

put

public ComplexFloatMatrix put(int[] indices,
                              int c,
                              ComplexFloat v)

put

public ComplexFloatMatrix put(int[] rindices,
                              int[] cindices,
                              float v)

putReal

public ComplexFloatMatrix putReal(int[] rindices,
                                  int[] cindices,
                                  float v)

putImag

public ComplexFloatMatrix putImag(int[] rindices,
                                  int[] cindices,
                                  float v)

put

public ComplexFloatMatrix put(int[] rindices,
                              int[] cindices,
                              ComplexFloat v)

put

public ComplexFloatMatrix put(ComplexFloatMatrix indices,
                              ComplexFloatMatrix v)

put

public ComplexFloatMatrix put(int r,
                              ComplexFloatMatrix indices,
                              ComplexFloatMatrix v)

put

public ComplexFloatMatrix put(ComplexFloatMatrix indices,
                              int c,
                              ComplexFloatMatrix v)

put

public ComplexFloatMatrix put(ComplexFloatMatrix rindices,
                              ComplexFloatMatrix cindices,
                              ComplexFloatMatrix v)

put

public ComplexFloatMatrix put(ComplexFloatMatrix indices,
                              float v)

putReal

public ComplexFloatMatrix putReal(ComplexFloatMatrix indices,
                                  float v)

putImag

public ComplexFloatMatrix putImag(ComplexFloatMatrix indices,
                                  float v)

put

public ComplexFloatMatrix put(ComplexFloatMatrix indices,
                              ComplexFloat v)

put

public ComplexFloatMatrix put(int r,
                              ComplexFloatMatrix indices,
                              float v)

putReal

public ComplexFloatMatrix putReal(int r,
                                  ComplexFloatMatrix indices,
                                  float v)

putImag

public ComplexFloatMatrix putImag(int r,
                                  ComplexFloatMatrix indices,
                                  float v)

put

public ComplexFloatMatrix put(int r,
                              ComplexFloatMatrix indices,
                              ComplexFloat v)

put

public ComplexFloatMatrix put(ComplexFloatMatrix indices,
                              int c,
                              float v)

putReal

public ComplexFloatMatrix putReal(ComplexFloatMatrix indices,
                                  int c,
                                  float v)

putImag

public ComplexFloatMatrix putImag(ComplexFloatMatrix indices,
                                  int c,
                                  float v)

put

public ComplexFloatMatrix put(ComplexFloatMatrix indices,
                              int c,
                              ComplexFloat v)

put

public ComplexFloatMatrix put(ComplexFloatMatrix rindices,
                              ComplexFloatMatrix cindices,
                              float v)

putReal

public ComplexFloatMatrix putReal(ComplexFloatMatrix rindices,
                                  ComplexFloatMatrix cindices,
                                  float v)

putImag

public ComplexFloatMatrix putImag(ComplexFloatMatrix rindices,
                                  ComplexFloatMatrix cindices,
                                  float v)

put

public ComplexFloatMatrix put(ComplexFloatMatrix rindices,
                              ComplexFloatMatrix cindices,
                              ComplexFloat v)

findIndices

public int[] findIndices()

transpose

public ComplexFloatMatrix transpose()
Return transposed copy of this matrix


equals

public boolean equals(java.lang.Object o)
Compare two matrices.

Overrides:
equals in class java.lang.Object
Parameters:
o - Object to compare to
Returns:
true if and only if other is also a ComplexFloatMatrix which has the same size and the maximal absolute difference in matrix elements is smaller thatn 1e-6.

resize

public void resize(int newRows,
                   int newColumns)
Resize the matrix. All elements will be set to zero.


reshape

public ComplexFloatMatrix reshape(int newRows,
                                  int newColumns)
Reshape the matrix. Number of elements must not change.


sameSize

public boolean sameSize(ComplexFloatMatrix a)
Checks whether two matrices have the same size.


assertSameSize

public void assertSameSize(ComplexFloatMatrix a)
Assert that two matrices have the same size.

Parameters:
a - the other matrix
Throws:
SizeException - if matrix sizes don't match.

multipliesWith

public boolean multipliesWith(ComplexFloatMatrix a)
Check whether this can be multiplied with a.

Parameters:
a - right-hand-side of the multiplication.
Returns:
true iff this.columns == a.rows

assertMultipliesWith

public void assertMultipliesWith(ComplexFloatMatrix a)

sameLength

public boolean sameLength(ComplexFloatMatrix a)

assertSameLength

public void assertSameLength(ComplexFloatMatrix a)

copy

public ComplexFloatMatrix copy(ComplexFloatMatrix a)
Copy ComplexFloatMatrix a to this. this a is resized if necessary.


dup

public ComplexFloatMatrix dup()
Returns a duplicate of this matrix. Geometry is the same (including offsets, transpose, etc.), but the buffer is not shared.


swapColumns

public ComplexFloatMatrix swapColumns(int i,
                                      int j)

swapRows

public ComplexFloatMatrix swapRows(int i,
                                   int j)

put

public ComplexFloatMatrix put(int rowIndex,
                              int columnIndex,
                              float value)
Set matrix element


put

public ComplexFloatMatrix put(int rowIndex,
                              int columnIndex,
                              ComplexFloat value)

putReal

public ComplexFloatMatrix putReal(int rowIndex,
                                  int columnIndex,
                                  float value)

putImag

public ComplexFloatMatrix putImag(int rowIndex,
                                  int columnIndex,
                                  float value)

get

public ComplexFloat get(int rowIndex,
                        int columnIndex)
Retrieve matrix element


getReal

public FloatMatrix getReal()

index

public int index(int rowIndex,
                 int columnIndex)
Get index of an element


get

public ComplexFloat get(int i)

get

public ComplexFloat get(int i,
                        ComplexFloat result)

getReal

public float getReal(int i)

getImag

public float getImag(int i)

put

public ComplexFloatMatrix put(int i,
                              float v)

put

public ComplexFloatMatrix put(int i,
                              ComplexFloat v)

putReal

public ComplexFloatMatrix putReal(int i,
                                  float v)

putImag

public ComplexFloatMatrix putImag(int i,
                                  float v)

getRows

public int getRows()

getColumns

public int getColumns()

getLength

public int getLength()

isEmpty

public boolean isEmpty()
Checks whether the matrix is empty.


isSquare

public boolean isSquare()
Checks whether the matrix is square.


assertSquare

public void assertSquare()

isVector

public boolean isVector()
Checks whether the matrix is a vector.


isRowVector

public boolean isRowVector()

isColumnVector

public boolean isColumnVector()

diag

public ComplexFloatMatrix diag()
Get diagonal of the matrix.


real

public FloatMatrix real()
Get real part of the matrix.


imag

public FloatMatrix imag()
Get imaginary part of the matrix.


print

public void print()
Pretty-print this matrix to System.out.


toString

public java.lang.String toString()
Generate string representation of this matrix (multi-line).

Overrides:
toString in class java.lang.Object

toDoubleArray

public float[] toDoubleArray()

toArray

public ComplexFloat[] toArray()

toArray2

public ComplexFloat[][] toArray2()

toBooleanArray

public boolean[] toBooleanArray()

toBooleanArray2

public boolean[][] toBooleanArray2()

addi

public ComplexFloatMatrix addi(ComplexFloatMatrix other,
                               ComplexFloatMatrix result)
Add two matrices.


addi

public ComplexFloatMatrix addi(ComplexFloat v,
                               ComplexFloatMatrix result)
Add a scalar to a matrix.


addi

public ComplexFloatMatrix addi(float v,
                               ComplexFloatMatrix result)

subi

public ComplexFloatMatrix subi(ComplexFloatMatrix other,
                               ComplexFloatMatrix result)
Subtract two matrices.


subi

public ComplexFloatMatrix subi(ComplexFloat v,
                               ComplexFloatMatrix result)
Subtract a scalar from a matrix


subi

public ComplexFloatMatrix subi(float v,
                               ComplexFloatMatrix result)

rsubi

public ComplexFloatMatrix rsubi(ComplexFloatMatrix other,
                                ComplexFloatMatrix result)
Subtract two matrices, but subtract first from second matrix, that is, compute result = other - this.


rsubi

public ComplexFloatMatrix rsubi(ComplexFloat a,
                                ComplexFloatMatrix result)
Subtract a matrix from a scalar


rsubi

public ComplexFloatMatrix rsubi(float a,
                                ComplexFloatMatrix result)

muli

public ComplexFloatMatrix muli(ComplexFloatMatrix other,
                               ComplexFloatMatrix result)
(Elementwise) Multiplication


muli

public ComplexFloatMatrix muli(ComplexFloat v,
                               ComplexFloatMatrix result)
(Elementwise) Multiplication with a scalar


muli

public ComplexFloatMatrix muli(float v,
                               ComplexFloatMatrix result)

mmuli

public ComplexFloatMatrix mmuli(ComplexFloatMatrix other,
                                ComplexFloatMatrix result)
Matrix-Matrix Multiplication


mmuli

public ComplexFloatMatrix mmuli(ComplexFloat v,
                                ComplexFloatMatrix result)
Matrix-Matrix Multiplication with a scalar (for symmetry, does the same as muli(scalar)


mmuli

public ComplexFloatMatrix mmuli(float v,
                                ComplexFloatMatrix result)

divi

public ComplexFloatMatrix divi(ComplexFloatMatrix other,
                               ComplexFloatMatrix result)
(Elementwise) division


divi

public ComplexFloatMatrix divi(ComplexFloat a,
                               ComplexFloatMatrix result)
(Elementwise) division with a scalar


divi

public ComplexFloatMatrix divi(float a,
                               ComplexFloatMatrix result)

rdivi

public ComplexFloatMatrix rdivi(ComplexFloatMatrix other,
                                ComplexFloatMatrix result)
(Elementwise) division, with operands switched. Computes result = other / this.


rdivi

public ComplexFloatMatrix rdivi(ComplexFloat a,
                                ComplexFloatMatrix result)
(Elementwise) division with a scalar, with operands switched. Computes result = a / this.


rdivi

public ComplexFloatMatrix rdivi(float a,
                                ComplexFloatMatrix result)

negi

public ComplexFloatMatrix negi()

neg

public ComplexFloatMatrix neg()

noti

public ComplexFloatMatrix noti()

not

public ComplexFloatMatrix not()

truthi

public ComplexFloatMatrix truthi()

truth

public ComplexFloatMatrix truth()

conji

public ComplexFloatMatrix conji()

rankOneUpdate

public ComplexFloatMatrix rankOneUpdate(ComplexFloat alpha,
                                        ComplexFloatMatrix x,
                                        ComplexFloatMatrix y)
Computes a rank-1-update A = A + alpha * x * y'.


rankOneUpdate

public ComplexFloatMatrix rankOneUpdate(float alpha,
                                        ComplexFloatMatrix x,
                                        ComplexFloatMatrix y)

rankOneUpdate

public ComplexFloatMatrix rankOneUpdate(float alpha,
                                        ComplexFloatMatrix x)
Computes a rank-1-update A = A + alpha * x * x'.


rankOneUpdate

public ComplexFloatMatrix rankOneUpdate(ComplexFloat alpha,
                                        ComplexFloatMatrix x)
Computes a rank-1-update A = A + alpha * x * x'.


rankOneUpdate

public ComplexFloatMatrix rankOneUpdate(ComplexFloatMatrix x)
Computes a rank-1-update A = A + x * x'.


rankOneUpdate

public ComplexFloatMatrix rankOneUpdate(ComplexFloatMatrix x,
                                        ComplexFloatMatrix y)
Computes a rank-1-update A = A + x * y'.


sum

public ComplexFloat sum()
Logical operations


mean

public ComplexFloat mean()

dotc

public ComplexFloat dotc(ComplexFloatMatrix other)

dotu

public ComplexFloat dotu(ComplexFloatMatrix other)

norm2

public float norm2()

normmax

public float normmax()

norm1

public float norm1()

columnSums

public ComplexFloatMatrix columnSums()
Return a vector containing the sums of the columns (having number of columns many entries)


columnMeans

public ComplexFloatMatrix columnMeans()

rowSums

public ComplexFloatMatrix rowSums()

rowMeans

public ComplexFloatMatrix rowMeans()

getColumn

public ComplexFloatMatrix getColumn(int c)

putColumn

public void putColumn(int c,
                      ComplexFloatMatrix v)

getRow

public ComplexFloatMatrix getRow(int r)

putRow

public void putRow(int r,
                   ComplexFloatMatrix v)

addRowVector

public void addRowVector(ComplexFloatMatrix x)
Add a row vector to all rows of the matrix


addColumnVector

public void addColumnVector(ComplexFloatMatrix x)
Add a vector to all columns of the matrix


subRowVector

public void subRowVector(ComplexFloatMatrix x)
Add a row vector to all rows of the matrix


subColumnVector

public void subColumnVector(ComplexFloatMatrix x)
Add a vector to all columns of the matrix


out

public void out(java.io.DataOutputStream dos)
         throws java.io.IOException
Writes out this matrix to the given data stream.

Parameters:
dos - the data output stream to write to.
Throws:
java.io.IOException

in

public void in(java.io.DataInputStream dis)
        throws java.io.IOException
Reads in a matrix from the given data stream. Note that the old data of this matrix will be discarded.

Parameters:
dis - the data input stream to read from.
Throws:
java.io.IOException

save

public void save(java.lang.String filename)
          throws java.io.IOException
Saves this matrix to the specified file.

Parameters:
filename - the file to write the matrix in.
Throws:
java.io.IOException - thrown on errors while writing the matrix to the file

load

public void load(java.lang.String filename)
          throws java.io.IOException
Loads a matrix from a file into this matrix. Note that the old data of this matrix will be discarded.

Parameters:
filename - the file to read the matrix from
Throws:
java.io.IOException - thrown on errors while reading the matrix

addi

public ComplexFloatMatrix addi(ComplexFloatMatrix other)
Code for operators


add

public ComplexFloatMatrix add(ComplexFloatMatrix other)

addi

public ComplexFloatMatrix addi(ComplexFloat v)

addi

public ComplexFloatMatrix addi(float v)

add

public ComplexFloatMatrix add(ComplexFloat v)

add

public ComplexFloatMatrix add(float v)

subi

public ComplexFloatMatrix subi(ComplexFloatMatrix other)

sub

public ComplexFloatMatrix sub(ComplexFloatMatrix other)

subi

public ComplexFloatMatrix subi(ComplexFloat v)

subi

public ComplexFloatMatrix subi(float v)

sub

public ComplexFloatMatrix sub(ComplexFloat v)

sub

public ComplexFloatMatrix sub(float v)

rsubi

public ComplexFloatMatrix rsubi(ComplexFloatMatrix other)

rsub

public ComplexFloatMatrix rsub(ComplexFloatMatrix other)

rsubi

public ComplexFloatMatrix rsubi(ComplexFloat v)

rsubi

public ComplexFloatMatrix rsubi(float v)

rsub

public ComplexFloatMatrix rsub(ComplexFloat v)

rsub

public ComplexFloatMatrix rsub(float v)

divi

public ComplexFloatMatrix divi(ComplexFloatMatrix other)

div

public ComplexFloatMatrix div(ComplexFloatMatrix other)

divi

public ComplexFloatMatrix divi(ComplexFloat v)

divi

public ComplexFloatMatrix divi(float v)

div

public ComplexFloatMatrix div(ComplexFloat v)

div

public ComplexFloatMatrix div(float v)

rdivi

public ComplexFloatMatrix rdivi(ComplexFloatMatrix other)

rdiv

public ComplexFloatMatrix rdiv(ComplexFloatMatrix other)

rdivi

public ComplexFloatMatrix rdivi(ComplexFloat v)

rdivi

public ComplexFloatMatrix rdivi(float v)

rdiv

public ComplexFloatMatrix rdiv(ComplexFloat v)

rdiv

public ComplexFloatMatrix rdiv(float v)

muli

public ComplexFloatMatrix muli(ComplexFloatMatrix other)

mul

public ComplexFloatMatrix mul(ComplexFloatMatrix other)

muli

public ComplexFloatMatrix muli(ComplexFloat v)

muli

public ComplexFloatMatrix muli(float v)

mul

public ComplexFloatMatrix mul(ComplexFloat v)

mul

public ComplexFloatMatrix mul(float v)

mmuli

public ComplexFloatMatrix mmuli(ComplexFloatMatrix other)

mmul

public ComplexFloatMatrix mmul(ComplexFloatMatrix other)

mmuli

public ComplexFloatMatrix mmuli(ComplexFloat v)

mmuli

public ComplexFloatMatrix mmuli(float v)

mmul

public ComplexFloatMatrix mmul(ComplexFloat v)

mmul

public ComplexFloatMatrix mmul(float v)

eqi

public ComplexFloatMatrix eqi(ComplexFloatMatrix other,
                              ComplexFloatMatrix result)

eqi

public ComplexFloatMatrix eqi(ComplexFloatMatrix other)

eq

public ComplexFloatMatrix eq(ComplexFloatMatrix other)

eqi

public ComplexFloatMatrix eqi(ComplexFloat value,
                              ComplexFloatMatrix result)

eqi

public ComplexFloatMatrix eqi(float value,
                              ComplexFloatMatrix result)

eqi

public ComplexFloatMatrix eqi(ComplexFloat value)

eqi

public ComplexFloatMatrix eqi(float value)

eq

public ComplexFloatMatrix eq(ComplexFloat value)

eq

public ComplexFloatMatrix eq(float value)

nei

public ComplexFloatMatrix nei(ComplexFloatMatrix other,
                              ComplexFloatMatrix result)

nei

public ComplexFloatMatrix nei(ComplexFloatMatrix other)

ne

public ComplexFloatMatrix ne(ComplexFloatMatrix other)

nei

public ComplexFloatMatrix nei(ComplexFloat value,
                              ComplexFloatMatrix result)

nei

public ComplexFloatMatrix nei(float value,
                              ComplexFloatMatrix result)

nei

public ComplexFloatMatrix nei(ComplexFloat value)

nei

public ComplexFloatMatrix nei(float value)

ne

public ComplexFloatMatrix ne(ComplexFloat value)

ne

public ComplexFloatMatrix ne(float value)

andi

public ComplexFloatMatrix andi(ComplexFloatMatrix other,
                               ComplexFloatMatrix result)

andi

public ComplexFloatMatrix andi(ComplexFloatMatrix other)

and

public ComplexFloatMatrix and(ComplexFloatMatrix other)

andi

public ComplexFloatMatrix andi(ComplexFloat value,
                               ComplexFloatMatrix result)

andi

public ComplexFloatMatrix andi(float value,
                               ComplexFloatMatrix result)

andi

public ComplexFloatMatrix andi(ComplexFloat value)

andi

public ComplexFloatMatrix andi(float value)

and

public ComplexFloatMatrix and(ComplexFloat value)

and

public ComplexFloatMatrix and(float value)

ori

public ComplexFloatMatrix ori(ComplexFloatMatrix other,
                              ComplexFloatMatrix result)

ori

public ComplexFloatMatrix ori(ComplexFloatMatrix other)

or

public ComplexFloatMatrix or(ComplexFloatMatrix other)

ori

public ComplexFloatMatrix ori(ComplexFloat value,
                              ComplexFloatMatrix result)

ori

public ComplexFloatMatrix ori(float value,
                              ComplexFloatMatrix result)

ori

public ComplexFloatMatrix ori(ComplexFloat value)

ori

public ComplexFloatMatrix ori(float value)

or

public ComplexFloatMatrix or(ComplexFloat value)

or

public ComplexFloatMatrix or(float value)

xori

public ComplexFloatMatrix xori(ComplexFloatMatrix other,
                               ComplexFloatMatrix result)

xori

public ComplexFloatMatrix xori(ComplexFloatMatrix other)

xor

public ComplexFloatMatrix xor(ComplexFloatMatrix other)

xori

public ComplexFloatMatrix xori(ComplexFloat value,
                               ComplexFloatMatrix result)

xori

public ComplexFloatMatrix xori(float value,
                               ComplexFloatMatrix result)

xori

public ComplexFloatMatrix xori(ComplexFloat value)

xori

public ComplexFloatMatrix xori(float value)

xor

public ComplexFloatMatrix xor(ComplexFloat value)

xor

public ComplexFloatMatrix xor(float value)


written by Mikio L. Braun and Johannes Schaback