org.jblas.la
Class ComplexDoubleMatrix
java.lang.Object
org.jblas.la.ComplexDoubleMatrix
public class ComplexDoubleMatrix
- extends java.lang.Object
Method Summary |
ComplexDoubleMatrix |
add(ComplexDouble v)
|
ComplexDoubleMatrix |
add(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
add(double v)
|
void |
addColumnVector(ComplexDoubleMatrix x)
Add a vector to all columns of the matrix |
ComplexDoubleMatrix |
addi(ComplexDouble v)
|
ComplexDoubleMatrix |
addi(ComplexDouble v,
ComplexDoubleMatrix result)
Add a scalar to a matrix. |
ComplexDoubleMatrix |
addi(ComplexDoubleMatrix other)
Code for operators |
ComplexDoubleMatrix |
addi(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
Add two matrices. |
ComplexDoubleMatrix |
addi(double v)
|
ComplexDoubleMatrix |
addi(double v,
ComplexDoubleMatrix result)
|
void |
addRowVector(ComplexDoubleMatrix x)
Add a row vector to all rows of the matrix |
ComplexDoubleMatrix |
and(ComplexDouble value)
|
ComplexDoubleMatrix |
and(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
and(double value)
|
ComplexDoubleMatrix |
andi(ComplexDouble value)
|
ComplexDoubleMatrix |
andi(ComplexDouble value,
ComplexDoubleMatrix result)
|
ComplexDoubleMatrix |
andi(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
andi(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
|
ComplexDoubleMatrix |
andi(double value)
|
ComplexDoubleMatrix |
andi(double value,
ComplexDoubleMatrix result)
|
void |
assertMultipliesWith(ComplexDoubleMatrix a)
|
void |
assertSameLength(ComplexDoubleMatrix a)
|
void |
assertSameSize(ComplexDoubleMatrix a)
Assert that two matrices have the same size. |
void |
assertSquare()
|
ComplexDoubleMatrix |
columnMeans()
|
ComplexDoubleMatrix |
columnSums()
Return a vector containing the sums of the columns (having number of columns many entries) |
static ComplexDoubleMatrix |
concatHorizontally(ComplexDoubleMatrix A,
ComplexDoubleMatrix B)
|
static ComplexDoubleMatrix |
concatVertically(ComplexDoubleMatrix A,
ComplexDoubleMatrix B)
|
ComplexDoubleMatrix |
conji()
|
ComplexDoubleMatrix |
copy(ComplexDoubleMatrix a)
Copy ComplexDoubleMatrix a to this. |
ComplexDoubleMatrix |
diag()
Get diagonal of the matrix. |
static ComplexDoubleMatrix |
diag(ComplexDoubleMatrix x)
Creates a new matrix where the values of the given vector are the diagonal values of
the matrix. |
ComplexDoubleMatrix |
div(ComplexDouble v)
|
ComplexDoubleMatrix |
div(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
div(double v)
|
ComplexDoubleMatrix |
divi(ComplexDouble v)
|
ComplexDoubleMatrix |
divi(ComplexDouble a,
ComplexDoubleMatrix result)
(Elementwise) division with a scalar |
ComplexDoubleMatrix |
divi(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
divi(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
(Elementwise) division |
ComplexDoubleMatrix |
divi(double v)
|
ComplexDoubleMatrix |
divi(double a,
ComplexDoubleMatrix result)
|
ComplexDouble |
dotc(ComplexDoubleMatrix other)
|
ComplexDouble |
dotu(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
dup()
Returns a duplicate of this matrix. |
ComplexDoubleMatrix |
eq(ComplexDouble value)
|
ComplexDoubleMatrix |
eq(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
eq(double value)
|
ComplexDoubleMatrix |
eqi(ComplexDouble value)
|
ComplexDoubleMatrix |
eqi(ComplexDouble value,
ComplexDoubleMatrix result)
|
ComplexDoubleMatrix |
eqi(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
eqi(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
|
ComplexDoubleMatrix |
eqi(double value)
|
ComplexDoubleMatrix |
eqi(double value,
ComplexDoubleMatrix result)
|
boolean |
equals(java.lang.Object o)
Compare two matrices. |
int[] |
findIndices()
|
ComplexDoubleMatrix |
get(ComplexDoubleMatrix indices)
|
ComplexDoubleMatrix |
get(ComplexDoubleMatrix rindices,
ComplexDoubleMatrix cindices)
|
ComplexDoubleMatrix |
get(ComplexDoubleMatrix indices,
int c)
|
ComplexDouble |
get(int i)
|
ComplexDoubleMatrix |
get(int[] indices)
Working with slices (Man! 30+ methods just to make this a bit flexible...) |
ComplexDoubleMatrix |
get(int[] indices,
int c)
|
ComplexDoubleMatrix |
get(int[] rindices,
int[] cindices)
|
ComplexDouble |
get(int i,
ComplexDouble result)
|
ComplexDoubleMatrix |
get(int r,
ComplexDoubleMatrix indices)
|
ComplexDouble |
get(int rowIndex,
int columnIndex)
Retrieve matrix element |
ComplexDoubleMatrix |
get(int r,
int[] indices)
|
ComplexDoubleMatrix |
getColumn(int c)
|
int |
getColumns()
|
double |
getImag(int i)
|
int |
getLength()
|
DoubleMatrix |
getReal()
|
double |
getReal(int i)
|
ComplexDoubleMatrix |
getRow(int r)
|
int |
getRows()
|
DoubleMatrix |
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. |
ComplexDouble |
mean()
|
ComplexDoubleMatrix |
mmul(ComplexDouble v)
|
ComplexDoubleMatrix |
mmul(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
mmul(double v)
|
ComplexDoubleMatrix |
mmuli(ComplexDouble v)
|
ComplexDoubleMatrix |
mmuli(ComplexDouble v,
ComplexDoubleMatrix result)
Matrix-Matrix Multiplication with a scalar (for symmetry, does the
same as muli(scalar) |
ComplexDoubleMatrix |
mmuli(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
mmuli(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
Matrix-Matrix Multiplication |
ComplexDoubleMatrix |
mmuli(double v)
|
ComplexDoubleMatrix |
mmuli(double v,
ComplexDoubleMatrix result)
|
ComplexDoubleMatrix |
mul(ComplexDouble v)
|
ComplexDoubleMatrix |
mul(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
mul(double v)
|
ComplexDoubleMatrix |
muli(ComplexDouble v)
|
ComplexDoubleMatrix |
muli(ComplexDouble v,
ComplexDoubleMatrix result)
(Elementwise) Multiplication with a scalar |
ComplexDoubleMatrix |
muli(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
muli(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
(Elementwise) Multiplication |
ComplexDoubleMatrix |
muli(double v)
|
ComplexDoubleMatrix |
muli(double v,
ComplexDoubleMatrix result)
|
boolean |
multipliesWith(ComplexDoubleMatrix a)
Check whether this can be multiplied with a. |
ComplexDoubleMatrix |
ne(ComplexDouble value)
|
ComplexDoubleMatrix |
ne(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
ne(double value)
|
ComplexDoubleMatrix |
neg()
|
ComplexDoubleMatrix |
negi()
|
ComplexDoubleMatrix |
nei(ComplexDouble value)
|
ComplexDoubleMatrix |
nei(ComplexDouble value,
ComplexDoubleMatrix result)
|
ComplexDoubleMatrix |
nei(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
nei(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
|
ComplexDoubleMatrix |
nei(double value)
|
ComplexDoubleMatrix |
nei(double value,
ComplexDoubleMatrix result)
|
double |
norm1()
|
double |
norm2()
|
double |
normmax()
|
ComplexDoubleMatrix |
not()
|
ComplexDoubleMatrix |
noti()
|
static ComplexDoubleMatrix |
ones(int length)
|
static ComplexDoubleMatrix |
ones(int rows,
int columns)
Creates a new matrix in which all values are equal 1. |
ComplexDoubleMatrix |
or(ComplexDouble value)
|
ComplexDoubleMatrix |
or(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
or(double value)
|
ComplexDoubleMatrix |
ori(ComplexDouble value)
|
ComplexDoubleMatrix |
ori(ComplexDouble value,
ComplexDoubleMatrix result)
|
ComplexDoubleMatrix |
ori(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
ori(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
|
ComplexDoubleMatrix |
ori(double value)
|
ComplexDoubleMatrix |
ori(double value,
ComplexDoubleMatrix 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. |
ComplexDoubleMatrix |
put(ComplexDoubleMatrix indices,
ComplexDouble v)
|
ComplexDoubleMatrix |
put(ComplexDoubleMatrix indices,
ComplexDoubleMatrix v)
|
ComplexDoubleMatrix |
put(ComplexDoubleMatrix rindices,
ComplexDoubleMatrix cindices,
ComplexDouble v)
|
ComplexDoubleMatrix |
put(ComplexDoubleMatrix rindices,
ComplexDoubleMatrix cindices,
ComplexDoubleMatrix v)
|
ComplexDoubleMatrix |
put(ComplexDoubleMatrix rindices,
ComplexDoubleMatrix cindices,
double v)
|
ComplexDoubleMatrix |
put(ComplexDoubleMatrix indices,
double v)
|
ComplexDoubleMatrix |
put(ComplexDoubleMatrix indices,
int c,
ComplexDouble v)
|
ComplexDoubleMatrix |
put(ComplexDoubleMatrix indices,
int c,
ComplexDoubleMatrix v)
|
ComplexDoubleMatrix |
put(ComplexDoubleMatrix indices,
int c,
double v)
|
ComplexDoubleMatrix |
put(int[] indices,
ComplexDouble v)
|
ComplexDoubleMatrix |
put(int[] indices,
ComplexDoubleMatrix x)
|
ComplexDoubleMatrix |
put(int[] indices,
double v)
|
ComplexDoubleMatrix |
put(int[] rindices,
int[] cindices,
ComplexDouble v)
|
ComplexDoubleMatrix |
put(int[] rindices,
int[] cindices,
ComplexDoubleMatrix x)
|
ComplexDoubleMatrix |
put(int[] rindices,
int[] cindices,
double v)
|
ComplexDoubleMatrix |
put(int[] indices,
int c,
ComplexDouble v)
|
ComplexDoubleMatrix |
put(int[] indices,
int c,
ComplexDoubleMatrix x)
|
ComplexDoubleMatrix |
put(int[] indices,
int c,
double v)
|
ComplexDoubleMatrix |
put(int i,
ComplexDouble v)
|
ComplexDoubleMatrix |
put(int r,
ComplexDoubleMatrix indices,
ComplexDouble v)
|
ComplexDoubleMatrix |
put(int r,
ComplexDoubleMatrix indices,
ComplexDoubleMatrix v)
|
ComplexDoubleMatrix |
put(int r,
ComplexDoubleMatrix indices,
double v)
|
ComplexDoubleMatrix |
put(int i,
double v)
|
ComplexDoubleMatrix |
put(int r,
int[] indices,
ComplexDouble v)
|
ComplexDoubleMatrix |
put(int r,
int[] indices,
ComplexDoubleMatrix x)
|
ComplexDoubleMatrix |
put(int r,
int[] indices,
double v)
|
ComplexDoubleMatrix |
put(int rowIndex,
int columnIndex,
ComplexDouble value)
|
ComplexDoubleMatrix |
put(int rowIndex,
int columnIndex,
double value)
Set matrix element |
void |
putColumn(int c,
ComplexDoubleMatrix v)
|
ComplexDoubleMatrix |
putImag(ComplexDoubleMatrix rindices,
ComplexDoubleMatrix cindices,
double v)
|
ComplexDoubleMatrix |
putImag(ComplexDoubleMatrix indices,
double v)
|
ComplexDoubleMatrix |
putImag(ComplexDoubleMatrix indices,
int c,
double v)
|
ComplexDoubleMatrix |
putImag(int[] indices,
double v)
|
ComplexDoubleMatrix |
putImag(int[] rindices,
int[] cindices,
double v)
|
ComplexDoubleMatrix |
putImag(int[] indices,
int c,
double v)
|
ComplexDoubleMatrix |
putImag(int r,
ComplexDoubleMatrix indices,
double v)
|
ComplexDoubleMatrix |
putImag(int i,
double v)
|
ComplexDoubleMatrix |
putImag(int r,
int[] indices,
double v)
|
ComplexDoubleMatrix |
putImag(int rowIndex,
int columnIndex,
double value)
|
ComplexDoubleMatrix |
putReal(ComplexDoubleMatrix rindices,
ComplexDoubleMatrix cindices,
double v)
|
ComplexDoubleMatrix |
putReal(ComplexDoubleMatrix indices,
double v)
|
ComplexDoubleMatrix |
putReal(ComplexDoubleMatrix indices,
int c,
double v)
|
ComplexDoubleMatrix |
putReal(int[] indices,
double v)
|
ComplexDoubleMatrix |
putReal(int[] rindices,
int[] cindices,
double v)
|
ComplexDoubleMatrix |
putReal(int[] indices,
int c,
double v)
|
ComplexDoubleMatrix |
putReal(int r,
ComplexDoubleMatrix indices,
double v)
|
ComplexDoubleMatrix |
putReal(int i,
double v)
|
ComplexDoubleMatrix |
putReal(int r,
int[] indices,
double v)
|
ComplexDoubleMatrix |
putReal(int rowIndex,
int columnIndex,
double value)
|
void |
putRow(int r,
ComplexDoubleMatrix v)
|
ComplexDoubleMatrix |
rankOneUpdate(ComplexDouble alpha,
ComplexDoubleMatrix x)
Computes a rank-1-update A = A + alpha * x * x'. |
ComplexDoubleMatrix |
rankOneUpdate(ComplexDouble alpha,
ComplexDoubleMatrix x,
ComplexDoubleMatrix y)
Computes a rank-1-update A = A + alpha * x * y'. |
ComplexDoubleMatrix |
rankOneUpdate(ComplexDoubleMatrix x)
Computes a rank-1-update A = A + x * x'. |
ComplexDoubleMatrix |
rankOneUpdate(ComplexDoubleMatrix x,
ComplexDoubleMatrix y)
Computes a rank-1-update A = A + x * y'. |
ComplexDoubleMatrix |
rankOneUpdate(double alpha,
ComplexDoubleMatrix x)
Computes a rank-1-update A = A + alpha * x * x'. |
ComplexDoubleMatrix |
rankOneUpdate(double alpha,
ComplexDoubleMatrix x,
ComplexDoubleMatrix y)
|
ComplexDoubleMatrix |
rdiv(ComplexDouble v)
|
ComplexDoubleMatrix |
rdiv(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
rdiv(double v)
|
ComplexDoubleMatrix |
rdivi(ComplexDouble v)
|
ComplexDoubleMatrix |
rdivi(ComplexDouble a,
ComplexDoubleMatrix result)
(Elementwise) division with a scalar, with operands switched. |
ComplexDoubleMatrix |
rdivi(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
rdivi(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
(Elementwise) division, with operands switched. |
ComplexDoubleMatrix |
rdivi(double v)
|
ComplexDoubleMatrix |
rdivi(double a,
ComplexDoubleMatrix result)
|
DoubleMatrix |
real()
Get real part of the matrix. |
ComplexDoubleMatrix |
reshape(int newRows,
int newColumns)
Reshape the matrix. |
void |
resize(int newRows,
int newColumns)
Resize the matrix. |
ComplexDoubleMatrix |
rowMeans()
|
ComplexDoubleMatrix |
rowSums()
|
ComplexDoubleMatrix |
rsub(ComplexDouble v)
|
ComplexDoubleMatrix |
rsub(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
rsub(double v)
|
ComplexDoubleMatrix |
rsubi(ComplexDouble v)
|
ComplexDoubleMatrix |
rsubi(ComplexDouble a,
ComplexDoubleMatrix result)
Subtract a matrix from a scalar |
ComplexDoubleMatrix |
rsubi(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
rsubi(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
Subtract two matrices, but subtract first from second matrix, that is,
compute result = other - this. |
ComplexDoubleMatrix |
rsubi(double v)
|
ComplexDoubleMatrix |
rsubi(double a,
ComplexDoubleMatrix result)
|
boolean |
sameLength(ComplexDoubleMatrix a)
|
boolean |
sameSize(ComplexDoubleMatrix a)
Checks whether two matrices have the same size. |
void |
save(java.lang.String filename)
Saves this matrix to the specified file. |
ComplexDouble |
scalar()
Return the first element of the matrix |
static ComplexDoubleMatrix |
scalar(double s)
Create a 1 * 1 - matrix. |
ComplexDoubleMatrix |
sub(ComplexDouble v)
|
ComplexDoubleMatrix |
sub(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
sub(double v)
|
void |
subColumnVector(ComplexDoubleMatrix x)
Add a vector to all columns of the matrix |
ComplexDoubleMatrix |
subi(ComplexDouble v)
|
ComplexDoubleMatrix |
subi(ComplexDouble v,
ComplexDoubleMatrix result)
Subtract a scalar from a matrix |
ComplexDoubleMatrix |
subi(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
subi(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
Subtract two matrices. |
ComplexDoubleMatrix |
subi(double v)
|
ComplexDoubleMatrix |
subi(double v,
ComplexDoubleMatrix result)
|
void |
subRowVector(ComplexDoubleMatrix x)
Add a row vector to all rows of the matrix |
ComplexDouble |
sum()
Logical operations |
ComplexDoubleMatrix |
swapColumns(int i,
int j)
|
ComplexDoubleMatrix |
swapRows(int i,
int j)
|
ComplexDouble[] |
toArray()
|
ComplexDouble[][] |
toArray2()
|
boolean[] |
toBooleanArray()
|
boolean[][] |
toBooleanArray2()
|
double[] |
toDoubleArray()
|
java.lang.String |
toString()
Generate string representation of this matrix
(multi-line). |
ComplexDoubleMatrix |
transpose()
Return transposed copy of this matrix |
ComplexDoubleMatrix |
truth()
|
ComplexDoubleMatrix |
truthi()
|
ComplexDoubleMatrix |
xor(ComplexDouble value)
|
ComplexDoubleMatrix |
xor(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
xor(double value)
|
ComplexDoubleMatrix |
xori(ComplexDouble value)
|
ComplexDoubleMatrix |
xori(ComplexDouble value,
ComplexDoubleMatrix result)
|
ComplexDoubleMatrix |
xori(ComplexDoubleMatrix other)
|
ComplexDoubleMatrix |
xori(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
|
ComplexDoubleMatrix |
xori(double value)
|
ComplexDoubleMatrix |
xori(double value,
ComplexDoubleMatrix result)
|
static ComplexDoubleMatrix |
zeros(int length)
|
static ComplexDoubleMatrix |
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 |
rows
public int rows
columns
public int columns
length
public int length
data
public double[] data
ComplexDoubleMatrix
public ComplexDoubleMatrix(int newRows,
int newColumns,
double... newData)
- Create a new matrix with newRows rows, newColumns columns
using newData> as the data. The length of the data is not checked!
ComplexDoubleMatrix
public ComplexDoubleMatrix(int newRows,
int newColumns)
- Creates a new n times m ComplexDoubleMatrix.
- Parameters:
newRows
- the number of rows (n) of the new matrix.newColumns
- the number of columns (m) of the new matrix.
ComplexDoubleMatrix
public ComplexDoubleMatrix()
- Creates a new ComplexDoubleMatrix of size 0 times 0.
ComplexDoubleMatrix
public ComplexDoubleMatrix(int len)
- Create a Matrix of length len. By default, this creates a row vector.
- Parameters:
len
-
ComplexDoubleMatrix
public ComplexDoubleMatrix(double[] newData)
ComplexDoubleMatrix
public ComplexDoubleMatrix(ComplexDouble[] newData)
ComplexDoubleMatrix
public ComplexDoubleMatrix(DoubleMatrix m)
- Construct a complex matrix from a real matrix.
ComplexDoubleMatrix
public ComplexDoubleMatrix(DoubleMatrix real,
DoubleMatrix 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.
ComplexDoubleMatrix
public ComplexDoubleMatrix(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
ComplexDoubleMatrix
public ComplexDoubleMatrix(double[][] data)
- Creates a new n times m ComplexDoubleMatrix 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 ComplexDoubleMatrix(new double[][]{{1d, 2d, 3d}, {4d, 5d, 6d}, {7d, 8d, 9d}}).print();
will constructs the following matrix:
1.0 2.0 3.0
4.0 5.0 6.0
7.0 8.0 9.0
.
- Parameters:
data
- n times m data array
zeros
public static ComplexDoubleMatrix zeros(int rows,
int columns)
- Creates a new matrix in which all values are equal 0.
- Parameters:
rows
- number of rowscolumns
- number of columns
- Returns:
- new matrix
zeros
public static ComplexDoubleMatrix zeros(int length)
ones
public static ComplexDoubleMatrix ones(int rows,
int columns)
- Creates a new matrix in which all values are equal 1.
- Parameters:
rows
- number of rowscolumns
- number of columns
- Returns:
- new matrix
ones
public static ComplexDoubleMatrix ones(int length)
diag
public static ComplexDoubleMatrix diag(ComplexDoubleMatrix 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 ComplexDoubleMatrix scalar(double s)
- Create a 1 * 1 - matrix. For many operations, this matrix functions like a
normal double
- Parameters:
s
- value of the matrix
- Returns:
- the constructed ComplexDoubleMatrix
isScalar
public boolean isScalar()
- Test whether a matrix is scalar
scalar
public ComplexDouble scalar()
- Return the first element of the matrix
concatHorizontally
public static ComplexDoubleMatrix concatHorizontally(ComplexDoubleMatrix A,
ComplexDoubleMatrix B)
concatVertically
public static ComplexDoubleMatrix concatVertically(ComplexDoubleMatrix A,
ComplexDoubleMatrix B)
get
public ComplexDoubleMatrix get(int[] indices)
- Working with slices (Man! 30+ methods just to make this a bit flexible...)
get
public ComplexDoubleMatrix get(int r,
int[] indices)
get
public ComplexDoubleMatrix get(int[] indices,
int c)
get
public ComplexDoubleMatrix get(int[] rindices,
int[] cindices)
get
public ComplexDoubleMatrix get(ComplexDoubleMatrix indices)
get
public ComplexDoubleMatrix get(int r,
ComplexDoubleMatrix indices)
get
public ComplexDoubleMatrix get(ComplexDoubleMatrix indices,
int c)
get
public ComplexDoubleMatrix get(ComplexDoubleMatrix rindices,
ComplexDoubleMatrix cindices)
put
public ComplexDoubleMatrix put(int[] indices,
ComplexDoubleMatrix x)
put
public ComplexDoubleMatrix put(int r,
int[] indices,
ComplexDoubleMatrix x)
put
public ComplexDoubleMatrix put(int[] indices,
int c,
ComplexDoubleMatrix x)
put
public ComplexDoubleMatrix put(int[] rindices,
int[] cindices,
ComplexDoubleMatrix x)
put
public ComplexDoubleMatrix put(int[] indices,
double v)
putReal
public ComplexDoubleMatrix putReal(int[] indices,
double v)
putImag
public ComplexDoubleMatrix putImag(int[] indices,
double v)
put
public ComplexDoubleMatrix put(int[] indices,
ComplexDouble v)
put
public ComplexDoubleMatrix put(int r,
int[] indices,
double v)
putReal
public ComplexDoubleMatrix putReal(int r,
int[] indices,
double v)
putImag
public ComplexDoubleMatrix putImag(int r,
int[] indices,
double v)
put
public ComplexDoubleMatrix put(int r,
int[] indices,
ComplexDouble v)
put
public ComplexDoubleMatrix put(int[] indices,
int c,
double v)
putReal
public ComplexDoubleMatrix putReal(int[] indices,
int c,
double v)
putImag
public ComplexDoubleMatrix putImag(int[] indices,
int c,
double v)
put
public ComplexDoubleMatrix put(int[] indices,
int c,
ComplexDouble v)
put
public ComplexDoubleMatrix put(int[] rindices,
int[] cindices,
double v)
putReal
public ComplexDoubleMatrix putReal(int[] rindices,
int[] cindices,
double v)
putImag
public ComplexDoubleMatrix putImag(int[] rindices,
int[] cindices,
double v)
put
public ComplexDoubleMatrix put(int[] rindices,
int[] cindices,
ComplexDouble v)
put
public ComplexDoubleMatrix put(ComplexDoubleMatrix indices,
ComplexDoubleMatrix v)
put
public ComplexDoubleMatrix put(int r,
ComplexDoubleMatrix indices,
ComplexDoubleMatrix v)
put
public ComplexDoubleMatrix put(ComplexDoubleMatrix indices,
int c,
ComplexDoubleMatrix v)
put
public ComplexDoubleMatrix put(ComplexDoubleMatrix rindices,
ComplexDoubleMatrix cindices,
ComplexDoubleMatrix v)
put
public ComplexDoubleMatrix put(ComplexDoubleMatrix indices,
double v)
putReal
public ComplexDoubleMatrix putReal(ComplexDoubleMatrix indices,
double v)
putImag
public ComplexDoubleMatrix putImag(ComplexDoubleMatrix indices,
double v)
put
public ComplexDoubleMatrix put(ComplexDoubleMatrix indices,
ComplexDouble v)
put
public ComplexDoubleMatrix put(int r,
ComplexDoubleMatrix indices,
double v)
putReal
public ComplexDoubleMatrix putReal(int r,
ComplexDoubleMatrix indices,
double v)
putImag
public ComplexDoubleMatrix putImag(int r,
ComplexDoubleMatrix indices,
double v)
put
public ComplexDoubleMatrix put(int r,
ComplexDoubleMatrix indices,
ComplexDouble v)
put
public ComplexDoubleMatrix put(ComplexDoubleMatrix indices,
int c,
double v)
putReal
public ComplexDoubleMatrix putReal(ComplexDoubleMatrix indices,
int c,
double v)
putImag
public ComplexDoubleMatrix putImag(ComplexDoubleMatrix indices,
int c,
double v)
put
public ComplexDoubleMatrix put(ComplexDoubleMatrix indices,
int c,
ComplexDouble v)
put
public ComplexDoubleMatrix put(ComplexDoubleMatrix rindices,
ComplexDoubleMatrix cindices,
double v)
putReal
public ComplexDoubleMatrix putReal(ComplexDoubleMatrix rindices,
ComplexDoubleMatrix cindices,
double v)
putImag
public ComplexDoubleMatrix putImag(ComplexDoubleMatrix rindices,
ComplexDoubleMatrix cindices,
double v)
put
public ComplexDoubleMatrix put(ComplexDoubleMatrix rindices,
ComplexDoubleMatrix cindices,
ComplexDouble v)
findIndices
public int[] findIndices()
transpose
public ComplexDoubleMatrix 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 ComplexDoubleMatrix 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 ComplexDoubleMatrix reshape(int newRows,
int newColumns)
- Reshape the matrix. Number of elements must not change.
sameSize
public boolean sameSize(ComplexDoubleMatrix a)
- Checks whether two matrices have the same size.
assertSameSize
public void assertSameSize(ComplexDoubleMatrix 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(ComplexDoubleMatrix 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(ComplexDoubleMatrix a)
sameLength
public boolean sameLength(ComplexDoubleMatrix a)
assertSameLength
public void assertSameLength(ComplexDoubleMatrix a)
copy
public ComplexDoubleMatrix copy(ComplexDoubleMatrix a)
- Copy ComplexDoubleMatrix a to this. this a is resized if necessary.
dup
public ComplexDoubleMatrix dup()
- Returns a duplicate of this matrix. Geometry is the same (including offsets, transpose, etc.),
but the buffer is not shared.
swapColumns
public ComplexDoubleMatrix swapColumns(int i,
int j)
swapRows
public ComplexDoubleMatrix swapRows(int i,
int j)
put
public ComplexDoubleMatrix put(int rowIndex,
int columnIndex,
double value)
- Set matrix element
put
public ComplexDoubleMatrix put(int rowIndex,
int columnIndex,
ComplexDouble value)
putReal
public ComplexDoubleMatrix putReal(int rowIndex,
int columnIndex,
double value)
putImag
public ComplexDoubleMatrix putImag(int rowIndex,
int columnIndex,
double value)
get
public ComplexDouble get(int rowIndex,
int columnIndex)
- Retrieve matrix element
getReal
public DoubleMatrix getReal()
index
public int index(int rowIndex,
int columnIndex)
- Get index of an element
get
public ComplexDouble get(int i)
get
public ComplexDouble get(int i,
ComplexDouble result)
getReal
public double getReal(int i)
getImag
public double getImag(int i)
put
public ComplexDoubleMatrix put(int i,
double v)
put
public ComplexDoubleMatrix put(int i,
ComplexDouble v)
putReal
public ComplexDoubleMatrix putReal(int i,
double v)
putImag
public ComplexDoubleMatrix putImag(int i,
double 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 ComplexDoubleMatrix diag()
- Get diagonal of the matrix.
real
public DoubleMatrix real()
- Get real part of the matrix.
imag
public DoubleMatrix 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 double[] toDoubleArray()
toArray
public ComplexDouble[] toArray()
toArray2
public ComplexDouble[][] toArray2()
toBooleanArray
public boolean[] toBooleanArray()
toBooleanArray2
public boolean[][] toBooleanArray2()
addi
public ComplexDoubleMatrix addi(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
- Add two matrices.
addi
public ComplexDoubleMatrix addi(ComplexDouble v,
ComplexDoubleMatrix result)
- Add a scalar to a matrix.
addi
public ComplexDoubleMatrix addi(double v,
ComplexDoubleMatrix result)
subi
public ComplexDoubleMatrix subi(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
- Subtract two matrices.
subi
public ComplexDoubleMatrix subi(ComplexDouble v,
ComplexDoubleMatrix result)
- Subtract a scalar from a matrix
subi
public ComplexDoubleMatrix subi(double v,
ComplexDoubleMatrix result)
rsubi
public ComplexDoubleMatrix rsubi(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
- Subtract two matrices, but subtract first from second matrix, that is,
compute result = other - this.
rsubi
public ComplexDoubleMatrix rsubi(ComplexDouble a,
ComplexDoubleMatrix result)
- Subtract a matrix from a scalar
rsubi
public ComplexDoubleMatrix rsubi(double a,
ComplexDoubleMatrix result)
muli
public ComplexDoubleMatrix muli(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
- (Elementwise) Multiplication
muli
public ComplexDoubleMatrix muli(ComplexDouble v,
ComplexDoubleMatrix result)
- (Elementwise) Multiplication with a scalar
muli
public ComplexDoubleMatrix muli(double v,
ComplexDoubleMatrix result)
mmuli
public ComplexDoubleMatrix mmuli(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
- Matrix-Matrix Multiplication
mmuli
public ComplexDoubleMatrix mmuli(ComplexDouble v,
ComplexDoubleMatrix result)
- Matrix-Matrix Multiplication with a scalar (for symmetry, does the
same as muli(scalar)
mmuli
public ComplexDoubleMatrix mmuli(double v,
ComplexDoubleMatrix result)
divi
public ComplexDoubleMatrix divi(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
- (Elementwise) division
divi
public ComplexDoubleMatrix divi(ComplexDouble a,
ComplexDoubleMatrix result)
- (Elementwise) division with a scalar
divi
public ComplexDoubleMatrix divi(double a,
ComplexDoubleMatrix result)
rdivi
public ComplexDoubleMatrix rdivi(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
- (Elementwise) division, with operands switched. Computes
result = other / this.
rdivi
public ComplexDoubleMatrix rdivi(ComplexDouble a,
ComplexDoubleMatrix result)
- (Elementwise) division with a scalar, with operands switched. Computes
result = a / this.
rdivi
public ComplexDoubleMatrix rdivi(double a,
ComplexDoubleMatrix result)
negi
public ComplexDoubleMatrix negi()
neg
public ComplexDoubleMatrix neg()
noti
public ComplexDoubleMatrix noti()
not
public ComplexDoubleMatrix not()
truthi
public ComplexDoubleMatrix truthi()
truth
public ComplexDoubleMatrix truth()
conji
public ComplexDoubleMatrix conji()
rankOneUpdate
public ComplexDoubleMatrix rankOneUpdate(ComplexDouble alpha,
ComplexDoubleMatrix x,
ComplexDoubleMatrix y)
- Computes a rank-1-update A = A + alpha * x * y'.
rankOneUpdate
public ComplexDoubleMatrix rankOneUpdate(double alpha,
ComplexDoubleMatrix x,
ComplexDoubleMatrix y)
rankOneUpdate
public ComplexDoubleMatrix rankOneUpdate(double alpha,
ComplexDoubleMatrix x)
- Computes a rank-1-update A = A + alpha * x * x'.
rankOneUpdate
public ComplexDoubleMatrix rankOneUpdate(ComplexDouble alpha,
ComplexDoubleMatrix x)
- Computes a rank-1-update A = A + alpha * x * x'.
rankOneUpdate
public ComplexDoubleMatrix rankOneUpdate(ComplexDoubleMatrix x)
- Computes a rank-1-update A = A + x * x'.
rankOneUpdate
public ComplexDoubleMatrix rankOneUpdate(ComplexDoubleMatrix x,
ComplexDoubleMatrix y)
- Computes a rank-1-update A = A + x * y'.
sum
public ComplexDouble sum()
- Logical operations
mean
public ComplexDouble mean()
dotc
public ComplexDouble dotc(ComplexDoubleMatrix other)
dotu
public ComplexDouble dotu(ComplexDoubleMatrix other)
norm2
public double norm2()
normmax
public double normmax()
norm1
public double norm1()
columnSums
public ComplexDoubleMatrix columnSums()
- Return a vector containing the sums of the columns (having number of columns many entries)
columnMeans
public ComplexDoubleMatrix columnMeans()
rowSums
public ComplexDoubleMatrix rowSums()
rowMeans
public ComplexDoubleMatrix rowMeans()
getColumn
public ComplexDoubleMatrix getColumn(int c)
putColumn
public void putColumn(int c,
ComplexDoubleMatrix v)
getRow
public ComplexDoubleMatrix getRow(int r)
putRow
public void putRow(int r,
ComplexDoubleMatrix v)
addRowVector
public void addRowVector(ComplexDoubleMatrix x)
- Add a row vector to all rows of the matrix
addColumnVector
public void addColumnVector(ComplexDoubleMatrix x)
- Add a vector to all columns of the matrix
subRowVector
public void subRowVector(ComplexDoubleMatrix x)
- Add a row vector to all rows of the matrix
subColumnVector
public void subColumnVector(ComplexDoubleMatrix 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 ComplexDoubleMatrix addi(ComplexDoubleMatrix other)
- Code for operators
add
public ComplexDoubleMatrix add(ComplexDoubleMatrix other)
addi
public ComplexDoubleMatrix addi(ComplexDouble v)
addi
public ComplexDoubleMatrix addi(double v)
add
public ComplexDoubleMatrix add(ComplexDouble v)
add
public ComplexDoubleMatrix add(double v)
subi
public ComplexDoubleMatrix subi(ComplexDoubleMatrix other)
sub
public ComplexDoubleMatrix sub(ComplexDoubleMatrix other)
subi
public ComplexDoubleMatrix subi(ComplexDouble v)
subi
public ComplexDoubleMatrix subi(double v)
sub
public ComplexDoubleMatrix sub(ComplexDouble v)
sub
public ComplexDoubleMatrix sub(double v)
rsubi
public ComplexDoubleMatrix rsubi(ComplexDoubleMatrix other)
rsub
public ComplexDoubleMatrix rsub(ComplexDoubleMatrix other)
rsubi
public ComplexDoubleMatrix rsubi(ComplexDouble v)
rsubi
public ComplexDoubleMatrix rsubi(double v)
rsub
public ComplexDoubleMatrix rsub(ComplexDouble v)
rsub
public ComplexDoubleMatrix rsub(double v)
divi
public ComplexDoubleMatrix divi(ComplexDoubleMatrix other)
div
public ComplexDoubleMatrix div(ComplexDoubleMatrix other)
divi
public ComplexDoubleMatrix divi(ComplexDouble v)
divi
public ComplexDoubleMatrix divi(double v)
div
public ComplexDoubleMatrix div(ComplexDouble v)
div
public ComplexDoubleMatrix div(double v)
rdivi
public ComplexDoubleMatrix rdivi(ComplexDoubleMatrix other)
rdiv
public ComplexDoubleMatrix rdiv(ComplexDoubleMatrix other)
rdivi
public ComplexDoubleMatrix rdivi(ComplexDouble v)
rdivi
public ComplexDoubleMatrix rdivi(double v)
rdiv
public ComplexDoubleMatrix rdiv(ComplexDouble v)
rdiv
public ComplexDoubleMatrix rdiv(double v)
muli
public ComplexDoubleMatrix muli(ComplexDoubleMatrix other)
mul
public ComplexDoubleMatrix mul(ComplexDoubleMatrix other)
muli
public ComplexDoubleMatrix muli(ComplexDouble v)
muli
public ComplexDoubleMatrix muli(double v)
mul
public ComplexDoubleMatrix mul(ComplexDouble v)
mul
public ComplexDoubleMatrix mul(double v)
mmuli
public ComplexDoubleMatrix mmuli(ComplexDoubleMatrix other)
mmul
public ComplexDoubleMatrix mmul(ComplexDoubleMatrix other)
mmuli
public ComplexDoubleMatrix mmuli(ComplexDouble v)
mmuli
public ComplexDoubleMatrix mmuli(double v)
mmul
public ComplexDoubleMatrix mmul(ComplexDouble v)
mmul
public ComplexDoubleMatrix mmul(double v)
eqi
public ComplexDoubleMatrix eqi(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
eqi
public ComplexDoubleMatrix eqi(ComplexDoubleMatrix other)
eq
public ComplexDoubleMatrix eq(ComplexDoubleMatrix other)
eqi
public ComplexDoubleMatrix eqi(ComplexDouble value,
ComplexDoubleMatrix result)
eqi
public ComplexDoubleMatrix eqi(double value,
ComplexDoubleMatrix result)
eqi
public ComplexDoubleMatrix eqi(ComplexDouble value)
eqi
public ComplexDoubleMatrix eqi(double value)
eq
public ComplexDoubleMatrix eq(ComplexDouble value)
eq
public ComplexDoubleMatrix eq(double value)
nei
public ComplexDoubleMatrix nei(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
nei
public ComplexDoubleMatrix nei(ComplexDoubleMatrix other)
ne
public ComplexDoubleMatrix ne(ComplexDoubleMatrix other)
nei
public ComplexDoubleMatrix nei(ComplexDouble value,
ComplexDoubleMatrix result)
nei
public ComplexDoubleMatrix nei(double value,
ComplexDoubleMatrix result)
nei
public ComplexDoubleMatrix nei(ComplexDouble value)
nei
public ComplexDoubleMatrix nei(double value)
ne
public ComplexDoubleMatrix ne(ComplexDouble value)
ne
public ComplexDoubleMatrix ne(double value)
andi
public ComplexDoubleMatrix andi(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
andi
public ComplexDoubleMatrix andi(ComplexDoubleMatrix other)
and
public ComplexDoubleMatrix and(ComplexDoubleMatrix other)
andi
public ComplexDoubleMatrix andi(ComplexDouble value,
ComplexDoubleMatrix result)
andi
public ComplexDoubleMatrix andi(double value,
ComplexDoubleMatrix result)
andi
public ComplexDoubleMatrix andi(ComplexDouble value)
andi
public ComplexDoubleMatrix andi(double value)
and
public ComplexDoubleMatrix and(ComplexDouble value)
and
public ComplexDoubleMatrix and(double value)
ori
public ComplexDoubleMatrix ori(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
ori
public ComplexDoubleMatrix ori(ComplexDoubleMatrix other)
or
public ComplexDoubleMatrix or(ComplexDoubleMatrix other)
ori
public ComplexDoubleMatrix ori(ComplexDouble value,
ComplexDoubleMatrix result)
ori
public ComplexDoubleMatrix ori(double value,
ComplexDoubleMatrix result)
ori
public ComplexDoubleMatrix ori(ComplexDouble value)
ori
public ComplexDoubleMatrix ori(double value)
or
public ComplexDoubleMatrix or(ComplexDouble value)
or
public ComplexDoubleMatrix or(double value)
xori
public ComplexDoubleMatrix xori(ComplexDoubleMatrix other,
ComplexDoubleMatrix result)
xori
public ComplexDoubleMatrix xori(ComplexDoubleMatrix other)
xor
public ComplexDoubleMatrix xor(ComplexDoubleMatrix other)
xori
public ComplexDoubleMatrix xori(ComplexDouble value,
ComplexDoubleMatrix result)
xori
public ComplexDoubleMatrix xori(double value,
ComplexDoubleMatrix result)
xori
public ComplexDoubleMatrix xori(ComplexDouble value)
xori
public ComplexDoubleMatrix xori(double value)
xor
public ComplexDoubleMatrix xor(ComplexDouble value)
xor
public ComplexDoubleMatrix xor(double value)
written by Mikio L. Braun and Johannes Schaback