public class DoubleMatrix extends Object implements Serializable
To construct a two-dimensional matrices, you can use the following constructors and static methods.
Method | Description |
---|---|
DoubleMatrix(m,n, [value1, value2, value3...]) | Values are filled in column by column. |
DoubleMatrix(new double[][] {{value1, value2, ...}, ...} | Inner arrays are rows. |
DoubleMatrix.zeros(m,n) | Initial values set to 0.0. |
DoubleMatrix.ones(m,n) | Initial values set to 1.0. |
DoubleMatrix.rand(m,n) | Values drawn at random between 0.0 and 1.0. |
DoubleMatrix.randn(m,n) | Values drawn from normal distribution. |
DoubleMatrix.eye(n) | Unit matrix (values 0.0 except for 1.0 on the diagonal). |
DoubleMatrix.diag(array) | Diagonal matrix with given diagonal elements. |
Alternatively, you can construct (column) vectors, if you just supply the length using the following constructors and static methods.
Method | Description |
---|---|
DoubleMatrix(m) | Constructs a column vector. |
DoubleMatrix(new double[] {value1, value2, ...}) | Constructs a column vector. |
DoubleMatrix.zeros(m) | Initial values set to 0.0. |
DoubleMatrix.ones(m) | Initial values set to 1.0. |
DoubleMatrix.rand(m) | Values drawn at random between 0.0 and 1.0. |
DoubleMatrix.randn(m) | Values drawn from normal distribution. |
DoubleMatrix.linspace(a, b, n) | n linearly spaced values from a to b. |
DoubleMatrix.logspace(a, b, n) | n logarithmically spaced values form 10^a to 10^b. |
You can also construct new matrices by concatenating matrices either horziontally or vertically:
Method | Description |
---|---|
x.concatHorizontally(y) | New matrix will be x next to y. |
x.concatVertically(y) | New matrix will be x atop y. |
To access individual elements, or whole rows and columns, use the following methods:
x.Method | Description |
---|---|
x.get(i,j) | Get element in row i and column j. |
x.put(i, j, v) | Set element in row i and column j to value v |
x.get(i) | Get the ith element of the matrix (traversing rows first). |
x.put(i, v) | Set the ith element of the matrix (traversing rows first). |
x.getColumn(i) | Get a copy of column i. |
x.putColumn(i, c) | Put matrix c into column i. |
x.getRow(i) | Get a copy of row i. |
x.putRow(i, c) | Put matrix c into row i. |
x.swapColumns(i, j) | Swap the contents of columns i and j. |
x.swapRows(i, j) | Swap the contents of rows i and j. |
For get and put, you can also pass integer arrays, DoubleMatrix objects, or Range objects, which then specify the indices used as follows:
When using put with multiple indices, the assigned object must have the correct size or be a scalar.
There exist the following Range objects. The Class RangeUtils also contains the a number of handy helper methods for constructing these ranges.
Class | RangeUtils method | Indices |
---|---|---|
AllRange | all() | All legal indices. |
PointRange | point(i) | A single point. |
IntervalRange | interval(a, b) | All indices from a to b (inclusive) |
IndicesRange | indices(int[]) | The specified indices. |
indices(DoubleMatrix) | The specified indices. | |
find(DoubleMatrix) | The non-zero entries of the matrix. |
The following methods can be used for duplicating and copying matrices.
Method | Description |
---|---|
x.dup() | Get a copy of x. |
x.copy(y) | Copy the contents of y to x (possible resizing x). |
The following methods permit to access the size of a matrix and change its size or shape.
x.Method | Description |
---|---|
x.rows | Number of rows. |
x.columns | Number of columns. |
x.length | Total number of elements. |
x.isEmpty() | Checks whether rows == 0 and columns == 0. |
x.isRowVector() | Checks whether rows == 1. |
x.isColumnVector() | Checks whether columns == 1. |
x.isVector() | Checks whether rows == 1 or columns == 1. |
x.isSquare() | Checks whether rows == columns. |
x.isScalar() | Checks whether length == 1. |
x.resize(r, c) | Resize the matrix to r rows and c columns, discarding the content. |
x.reshape(r, c) | Resize the matrix to r rows and c columns. Number of elements must not change. |
The size is stored in the rows and columns member variables. The total number of elements is stored in length. Do not change these values unless you know what you're doing!
The usual arithmetic operations are implemented. Each operation exists in a in-place version, recognizable by the suffix "i", to which you can supply the result matrix (or this is used, if missing). Using in-place operations can also lead to a smaller memory footprint, as the number of temporary objects is reduced (although the JVM garbage collector is usually pretty good at reusing these temporary object immediately with little overhead.)
Whenever you specify a result vector, the result vector must already have the correct dimensions.
For example, you can add two matrices using the add method. If you want to store the result in of x + y in z, type x.addi(y, z) // computes x = y + z. Even in-place methods return the result, such that you can easily chain in-place methods, for example: x.addi(y).addi(z) // computes x += y; x += z
Methods which operate element-wise only make sure that the length of the matrices is correct. Therefore, you can add a 3 * 3 matrix to a 1 * 9 matrix, for example.
Finally, there exist versions which take doubles instead of DoubleMatrix Objects as arguments. These then compute the operation with the same value as the right-hand-side. The same effect can be achieved by passing a DoubleMatrix with exactly one element.
Operation | Method | Comment |
---|---|---|
x + y | x.add(y) | |
x - y | x.sub(y), y.rsub(x) | rsub subtracts left from right hand side |
x * y | x.mul(y) | element-wise multiplication |
x.mmul(y) | matrix-matrix multiplication | |
x.dot(y) | scalar-product | |
x / y | x.div(y), y.rdiv(x) | rdiv divides right hand side by left hand side. |
- x | x.neg() |
There also exist operations which work on whole columns or rows.
Method | Description |
---|---|
x.addRowVector | adds a vector to each row (addiRowVector works in-place) |
x.addColumnVector | adds a vector to each column |
x.subRowVector | subtracts a vector from each row |
x.subColumnVector | subtracts a vector from each column |
x.mulRowVector | Multiplies each row by a vector (elementwise) |
x.mulColumnVector | Multiplies each column by a vector (elementwise) |
x.divRowVector | Divide each row by a vector (elementwise) |
x.divColumnVector | Divide each column by a vector (elementwise) |
x.mulRow | Multiplies a row by a scalar |
x.mulColumn | Multiplies a column by a scalar |
In principle, you could achieve the same result by first calling getColumn(), adding, and then calling putColumn, but these methods are much faster.
The following comparison operations are available
Operation | Method |
---|---|
x < y | x.lt(y) |
x <= y | x.le(y) |
x > y | x.gt(y) |
x >= y | x.ge(y) |
x == y | x.eq(y) |
x != y | x.ne(y) |
Logical operations are also supported. For these operations, a value different from zero is treated as "true" and zero is treated as "false". All operations are carried out elementwise.
Operation | Method |
---|---|
x & y | x.and(y) |
x | y | x.or(y) |
x ^ y | x.xor(y) |
! x | x.not() |
Finally, there are a few more methods to compute various things:
Method | Description |
---|---|
x.max() | Return maximal element |
x.argmax() | Return index of largest element |
x.min() | Return minimal element |
x.argmin() | Return index of largest element |
x.columnMins() | Return column-wise minima |
x.columnArgmins() | Return column-wise index of minima |
x.columnMaxs() | Return column-wise maxima |
x.columnArgmaxs() | Return column-wise index of maxima |
Modifier and Type | Class and Description |
---|---|
class |
DoubleMatrix.ColumnsAsListView |
class |
DoubleMatrix.ElementsAsListView
A wrapper which allows to view a matrix as a List of Doubles (read-only!).
|
class |
DoubleMatrix.RowsAsListView |
Modifier and Type | Field and Description |
---|---|
int |
columns
Number of columns.
|
double[] |
data
The actual data stored by rows (that is, row 0, row 1...).
|
static DoubleMatrix |
EMPTY |
int |
length
Total number of elements (for convenience).
|
int |
rows
Number of rows.
|
Constructor and Description |
---|
DoubleMatrix()
Creates a new DoubleMatrix of size 0 times 0.
|
DoubleMatrix(double[] newData)
Create a a column vector using newData as the data array.
|
DoubleMatrix(double[][] data)
Creates a new n times m DoubleMatrix from
the given n times m 2D data array.
|
DoubleMatrix(int len)
Create a Matrix of length len.
|
DoubleMatrix(int newRows,
int newColumns)
Creates a new n times m DoubleMatrix.
|
DoubleMatrix(int newRows,
int newColumns,
double... newData)
Create a new matrix with newRows rows, newColumns columns
using newData> as the data.
|
DoubleMatrix(List<Double> data)
Creates a DoubleMatrix column vector from the given List<Double&rt;.
|
DoubleMatrix(String filename)
Creates a new matrix by reading it from a file.
|
Modifier and Type | Method and Description |
---|---|
DoubleMatrix |
add(double v)
Add a scalar.
|
DoubleMatrix |
add(DoubleMatrix other)
Add a matrix.
|
DoubleMatrix |
addColumnVector(DoubleMatrix x)
Add a vector to all columns of the matrix.
|
DoubleMatrix |
addi(double v)
Add a scalar (in place).
|
DoubleMatrix |
addi(double v,
DoubleMatrix result)
Add a scalar to a matrix (in-place).
|
DoubleMatrix |
addi(DoubleMatrix other)
Add a matrix (in place).
|
DoubleMatrix |
addi(DoubleMatrix other,
DoubleMatrix result)
Add two matrices (in-place).
|
DoubleMatrix |
addiColumnVector(DoubleMatrix x)
Add a vector to all columns of the matrix (in-place).
|
DoubleMatrix |
addiRowVector(DoubleMatrix x)
Add a row vector to all rows of the matrix (in place).
|
DoubleMatrix |
addRowVector(DoubleMatrix x)
Add a row to all rows of the matrix.
|
DoubleMatrix |
and(double value)
Compute elementwise logical and against a scalar.
|
DoubleMatrix |
and(DoubleMatrix other)
Compute elementwise logical and.
|
DoubleMatrix |
andi(double value)
Compute elementwise logical and against a scalar (in-place).
|
DoubleMatrix |
andi(double value,
DoubleMatrix result)
Compute elementwise logical and against a scalar (in-place).
|
DoubleMatrix |
andi(DoubleMatrix other)
Compute elementwise logical and (in-place).
|
DoubleMatrix |
andi(DoubleMatrix other,
DoubleMatrix result)
Compute elementwise logical and (in-place).
|
int |
argmax()
Returns the linear index of the maximal element of the matrix.
|
int |
argmin()
Returns the linear index of the minimal element.
|
void |
assertMultipliesWith(DoubleMatrix a)
Throws SizeException unless matrices can be multiplied with one another.
|
void |
assertSameLength(DoubleMatrix a)
Throws SizeException unless matrices have the same length.
|
void |
assertSameSize(DoubleMatrix a)
Throws SizeException unless two matrices have the same size.
|
void |
assertSquare()
Throw SizeException unless matrix is square.
|
void |
checkColumns(int c)
Asserts that the amtrix has a certain number of columns.
|
void |
checkLength(int l)
Assert that the matrix has a certain length.
|
void |
checkRows(int r)
Asserts that the matrix has a certain number of rows.
|
int[] |
columnArgmaxs()
Return index of minimal element per column.
|
int[] |
columnArgmins()
Return index of minimal element per column.
|
DoubleMatrix |
columnMaxs()
Return column-wise maximums.
|
DoubleMatrix |
columnMeans()
Return a vector containing the means of all columns.
|
DoubleMatrix |
columnMins()
Return column-wise minimums.
|
List<DoubleMatrix> |
columnsAsList() |
int[][] |
columnSortingPermutations()
Return matrix of indices which sort all columns.
|
DoubleMatrix |
columnSums()
Return a vector containing the sums of the columns (having number of columns many entries)
|
boolean |
compare(Object o,
double tolerance)
Compare two matrices.
|
static DoubleMatrix |
concatHorizontally(DoubleMatrix A,
DoubleMatrix B)
Concatenates two matrices horizontally.
|
static DoubleMatrix |
concatVertically(DoubleMatrix A,
DoubleMatrix B)
Concatenates two matrices vertically.
|
DoubleMatrix |
copy(DoubleMatrix a)
Copy DoubleMatrix a to this.
|
DoubleMatrix |
cumulativeSum()
Computes the cumulative sum, that is, the sum of all elements
of the matrix up to a given index in linear addressing.
|
DoubleMatrix |
cumulativeSumi()
Computes the cumulative sum, that is, the sum of all elements
of the matrix up to a given index in linear addressing (in-place).
|
DoubleMatrix |
diag()
Returns the diagonal of the matrix.
|
static DoubleMatrix |
diag(DoubleMatrix x)
Creates a new matrix where the values of the given vector are the diagonal values of
the matrix.
|
static DoubleMatrix |
diag(DoubleMatrix x,
int rows,
int columns)
Construct a matrix of arbitrary shape and set the diagonal according
to a passed vector.
|
double |
distance1(DoubleMatrix other)
Returns the (1-norm) distance.
|
double |
distance2(DoubleMatrix other)
Returns the (euclidean) distance.
|
DoubleMatrix |
div(double v)
Elementwise divide by a scalar.
|
DoubleMatrix |
div(DoubleMatrix other)
Elementwise divide by a matrix.
|
DoubleMatrix |
divColumnVector(DoubleMatrix x) |
DoubleMatrix |
divi(double v)
Elementwise divide by a scalar (in place).
|
DoubleMatrix |
divi(double a,
DoubleMatrix result)
Elementwise division with a scalar (in-place).
|
DoubleMatrix |
divi(DoubleMatrix other)
Elementwise divide by a matrix (in place).
|
DoubleMatrix |
divi(DoubleMatrix other,
DoubleMatrix result)
Elementwise division (in-place).
|
DoubleMatrix |
diviColumnVector(DoubleMatrix x) |
DoubleMatrix |
diviRowVector(DoubleMatrix x) |
DoubleMatrix |
divRowVector(DoubleMatrix x) |
double |
dot(DoubleMatrix other)
The scalar product of this with other.
|
DoubleMatrix |
dup()
Returns a duplicate of this matrix.
|
List<Double> |
elementsAsList() |
DoubleMatrix |
eq(double value)
test for equality against a scalar.
|
DoubleMatrix |
eq(DoubleMatrix other)
Test for equality.
|
DoubleMatrix |
eqi(double value)
Test for equality against a scalar (in-place).
|
DoubleMatrix |
eqi(double value,
DoubleMatrix result)
Test for equality against a scalar (in-place).
|
DoubleMatrix |
eqi(DoubleMatrix other)
Test for equality (in-place).
|
DoubleMatrix |
eqi(DoubleMatrix other,
DoubleMatrix result)
Test for equality (in-place).
|
boolean |
equals(Object o) |
static DoubleMatrix |
eye(int n)
Construct a new n-by-n identity matrix.
|
DoubleMatrix |
fill(double value)
Set all elements to a value.
|
int[] |
findIndices()
Find the linear indices of all non-zero elements.
|
DoubleMatrix |
ge(double value)
test for "greater than or equal" against a scalar.
|
DoubleMatrix |
ge(DoubleMatrix other)
Test for "greater than or equal".
|
DoubleMatrix |
gei(double value)
Test for "greater than or equal" against a scalar (in-place).
|
DoubleMatrix |
gei(double value,
DoubleMatrix result)
Test for "greater than or equal" against a scalar (in-place).
|
DoubleMatrix |
gei(DoubleMatrix other)
Test for "greater than or equal" (in-place).
|
DoubleMatrix |
gei(DoubleMatrix other,
DoubleMatrix result)
Test for "greater than or equal" (in-place).
|
DoubleMatrix |
get(DoubleMatrix indices)
Get elements specified by the non-zero entries of the passed matrix.
|
DoubleMatrix |
get(DoubleMatrix rindices,
DoubleMatrix cindices)
Get elements from columns and rows as specified by the non-zero entries of
the passed matrices.
|
DoubleMatrix |
get(DoubleMatrix indices,
int c)
Get elements from a column and rows as specified by the non-zero entries of
a matrix.
|
double |
get(int i)
Get a matrix element (linear indexing).
|
DoubleMatrix |
get(int[] indices)
Get all elements specified by the linear indices.
|
DoubleMatrix |
get(int[] indices,
int c)
Get all elements for a given column and the specified rows.
|
DoubleMatrix |
get(int[] rindices,
int[] cindices)
Get all elements from the specified rows and columns.
|
DoubleMatrix |
get(int r,
DoubleMatrix indices)
Get elements from a row and columns as specified by the non-zero entries of
a matrix.
|
double |
get(int rowIndex,
int columnIndex)
Retrieve matrix element
|
DoubleMatrix |
get(int r,
int[] indices)
Get all elements for a given row and the specified columns.
|
DoubleMatrix |
get(int r,
Range cs) |
DoubleMatrix |
get(Range rs,
int c) |
DoubleMatrix |
get(Range rs,
Range cs)
Get elements from specified rows and columns.
|
DoubleMatrix |
getColumn(int c)
Get a copy of a column.
|
DoubleMatrix |
getColumn(int c,
DoubleMatrix result)
Copy a column to the given vector.
|
DoubleMatrix |
getColumnRange(int r,
int a,
int b)
Get elements from a row and columns a to b.
|
int |
getColumns()
Get number of columns.
|
DoubleMatrix |
getColumns(DoubleMatrix cindices)
Get whole columns as specified by the non-zero entries of a matrix.
|
DoubleMatrix |
getColumns(int[] cindices)
Get whole columns from the passed indices.
|
DoubleMatrix |
getColumns(Range indices) |
DoubleMatrix |
getColumns(Range indices,
DoubleMatrix result)
Get whole columns as specified by Range.
|
int |
getLength()
Get total number of elements.
|
DoubleMatrix |
getRange(int a,
int b)
Return all elements with linear index a, a + 1, ..., b - 1.
|
DoubleMatrix |
getRange(int ra,
int rb,
int ca,
int cb)
Get elements from rows ra to rb and
columns ca to cb.
|
DoubleMatrix |
getRow(int r)
Get a copy of a row.
|
DoubleMatrix |
getRow(int r,
DoubleMatrix result)
Copy a row to a given vector.
|
DoubleMatrix |
getRowRange(int a,
int b,
int c)
Get elements from a column and rows a/tt> to b.
|
int |
getRows()
Get number of rows.
|
DoubleMatrix |
getRows(DoubleMatrix rindices)
Get whole rows as specified by the non-zero entries of a matrix.
|
DoubleMatrix |
getRows(int[] rindices)
Get whole rows from the passed indices.
|
DoubleMatrix |
getRows(Range indices) |
DoubleMatrix |
getRows(Range indices,
DoubleMatrix result) |
DoubleMatrix |
gt(double value)
test for "greater than" against a scalar.
|
DoubleMatrix |
gt(DoubleMatrix other)
Test for "greater than".
|
DoubleMatrix |
gti(double value)
Test for "greater than" against a scalar (in-place).
|
DoubleMatrix |
gti(double value,
DoubleMatrix result)
Test for "greater than" against a scalar (in-place).
|
DoubleMatrix |
gti(DoubleMatrix other)
Test for "greater than" (in-place).
|
DoubleMatrix |
gti(DoubleMatrix other,
DoubleMatrix result)
Test for "greater than" (in-place).
|
int |
hashCode() |
void |
in(DataInputStream dis)
Reads in a matrix from the given data stream.
|
int |
index(int rowIndex,
int columnIndex)
Get index of an element
|
int |
indexColumns(int i)
Compute the column index of a linear index.
|
int |
indexRows(int i)
Compute the row index of a linear index.
|
boolean |
isColumnVector()
Checks whether the matrix is a column vector.
|
boolean |
isEmpty()
Checks whether the matrix is empty.
|
DoubleMatrix |
isInfinite() |
DoubleMatrix |
isInfinitei() |
boolean |
isLowerTriangular()
Checks whether all entries (i, j) with i >= j are zero.
|
DoubleMatrix |
isNaN() |
DoubleMatrix |
isNaNi() |
boolean |
isRowVector()
Checks whether the matrix is a row vector.
|
boolean |
isScalar()
Test whether a matrix is scalar.
|
boolean |
isSquare()
Checks whether the matrix is square.
|
boolean |
isUpperTriangular()
Checks whether all entries (i, j) with i <= j are zero.
|
boolean |
isVector()
Checks whether the matrix is a vector.
|
DoubleMatrix |
le(double value)
test for "less than or equal" against a scalar.
|
DoubleMatrix |
le(DoubleMatrix other)
Test for "less than or equal".
|
DoubleMatrix |
lei(double value)
Test for "less than or equal" against a scalar (in-place).
|
DoubleMatrix |
lei(double value,
DoubleMatrix result)
Test for "less than or equal" against a scalar (in-place).
|
DoubleMatrix |
lei(DoubleMatrix other)
Test for "less than or equal" (in-place).
|
DoubleMatrix |
lei(DoubleMatrix other,
DoubleMatrix result)
Test for "less than or equal" (in-place).
|
static DoubleMatrix |
linspace(int lower,
int upper,
int size)
Construct a column vector whose entries are linearly spaced points from lower to upper with size
many steps.
|
void |
load(String filename)
Loads a matrix from a file into this matrix.
|
static DoubleMatrix |
loadAsciiFile(String filename) |
static DoubleMatrix |
loadCSVFile(String filename) |
static DoubleMatrix |
logspace(double lower,
double upper,
int size)
Construct a column vector whose entries are logarithmically spaced points from
10^lower to 10^upper using the specified number of steps
|
DoubleMatrix |
lt(double value)
test for "less than" against a scalar.
|
DoubleMatrix |
lt(DoubleMatrix other)
Test for "less than".
|
DoubleMatrix |
lti(double value)
Test for "less than" against a scalar (in-place).
|
DoubleMatrix |
lti(double value,
DoubleMatrix result)
Test for "less than" against a scalar (in-place).
|
DoubleMatrix |
lti(DoubleMatrix other)
Test for "less than" (in-place).
|
DoubleMatrix |
lti(DoubleMatrix other,
DoubleMatrix result)
Test for "less than" (in-place).
|
double |
max()
Returns the maximal element of the matrix.
|
DoubleMatrix |
max(double v) |
DoubleMatrix |
max(DoubleMatrix other)
Computes the maximum between two matrices.
|
DoubleMatrix |
maxi(double v) |
DoubleMatrix |
maxi(double v,
DoubleMatrix result) |
DoubleMatrix |
maxi(DoubleMatrix other)
Computes the maximum between two matrices.
|
DoubleMatrix |
maxi(DoubleMatrix other,
DoubleMatrix result)
Computes the maximum between two matrices.
|
double |
mean()
Computes the mean value of all elements in the matrix,
that is,
x.sum() / x.length . |
double |
min()
Returns the minimal element of the matrix.
|
DoubleMatrix |
min(double v) |
DoubleMatrix |
min(DoubleMatrix other)
Computes the minimum between two matrices.
|
DoubleMatrix |
mini(double v) |
DoubleMatrix |
mini(double v,
DoubleMatrix result) |
DoubleMatrix |
mini(DoubleMatrix other)
Computes the minimum between two matrices.
|
DoubleMatrix |
mini(DoubleMatrix other,
DoubleMatrix result)
Computes the minimum between two matrices.
|
DoubleMatrix |
mmul(double v)
Matrix-multiply by a scalar.
|
DoubleMatrix |
mmul(DoubleMatrix other)
Matrix-multiply by a matrix.
|
DoubleMatrix |
mmuli(double v)
Matrix-multiply by a scalar (in place).
|
DoubleMatrix |
mmuli(double v,
DoubleMatrix result)
Matrix-matrix multiplication with a scalar (for symmetry, does the
same as
muli(scalar) (in-place). |
DoubleMatrix |
mmuli(DoubleMatrix other)
Matrix-multiply by a matrix (in place).
|
DoubleMatrix |
mmuli(DoubleMatrix other,
DoubleMatrix result)
Matrix-matrix multiplication (in-place).
|
DoubleMatrix |
mul(double v)
Elementwise multiply by a scalar.
|
DoubleMatrix |
mul(DoubleMatrix other)
Elementwise multiply by a matrix.
|
DoubleMatrix |
mulColumn(int c,
double scale)
Multiply a column by a scalar.
|
DoubleMatrix |
mulColumnVector(DoubleMatrix x)
Multiply all columns with a column vector.
|
DoubleMatrix |
muli(double v)
Elementwise multiply by a scalar (in place).
|
DoubleMatrix |
muli(double v,
DoubleMatrix result)
Elementwise multiplication with a scalar (in-place).
|
DoubleMatrix |
muli(DoubleMatrix other)
Elementwise multiply by a matrix (in place).
|
DoubleMatrix |
muli(DoubleMatrix other,
DoubleMatrix result)
Elementwise multiplication (in-place).
|
DoubleMatrix |
muliColumnVector(DoubleMatrix x)
Multiply all columns with a column vector (in-place).
|
DoubleMatrix |
muliRowVector(DoubleMatrix x)
Multiply all rows with a row vector (in-place).
|
DoubleMatrix |
mulRow(int r,
double scale)
Multiply a row by a scalar.
|
DoubleMatrix |
mulRowVector(DoubleMatrix x)
Multiply all rows with a row vector.
|
boolean |
multipliesWith(DoubleMatrix a)
Checks whether two matrices can be multiplied (that is, number of columns of
this must equal number of rows of a.
|
DoubleMatrix |
ne(double value)
test for inequality against a scalar.
|
DoubleMatrix |
ne(DoubleMatrix other)
Test for inequality.
|
DoubleMatrix |
neg()
Negate each element.
|
DoubleMatrix |
negi()
Negate each element (in-place).
|
DoubleMatrix |
nei(double value)
Test for inequality against a scalar (in-place).
|
DoubleMatrix |
nei(double value,
DoubleMatrix result)
Test for inequality against a scalar (in-place).
|
DoubleMatrix |
nei(DoubleMatrix other)
Test for inequality (in-place).
|
DoubleMatrix |
nei(DoubleMatrix other,
DoubleMatrix result)
Test for inequality (in-place).
|
double |
norm1()
The 1-norm of the matrix as vector (sum of absolute values of elements).
|
double |
norm2()
The Euclidean norm of the matrix as vector, also the Frobenius
norm of the matrix.
|
double |
normmax()
The maximum norm of the matrix (maximal absolute value of the elements).
|
DoubleMatrix |
not()
Maps zero to 1.0 and all non-zero values to 0.0.
|
DoubleMatrix |
noti()
Maps zero to 1.0 and all non-zero values to 0.0 (in-place).
|
static DoubleMatrix |
ones(int length)
Creates a column vector with all elements equal to 1.
|
static DoubleMatrix |
ones(int rows,
int columns)
Creates a new matrix in which all values are equal 1.
|
DoubleMatrix |
or(double value)
Compute elementwise logical or against a scalar.
|
DoubleMatrix |
or(DoubleMatrix other)
Compute elementwise logical or.
|
DoubleMatrix |
ori(double value)
Compute elementwise logical or against a scalar (in-place).
|
DoubleMatrix |
ori(double value,
DoubleMatrix result)
Compute elementwise logical or against a scalar (in-place).
|
DoubleMatrix |
ori(DoubleMatrix other)
Compute elementwise logical or (in-place).
|
DoubleMatrix |
ori(DoubleMatrix other,
DoubleMatrix result)
Compute elementwise logical or (in-place).
|
void |
out(DataOutputStream dos)
Writes out this matrix to the given data stream.
|
void |
print()
Pretty-print this matrix to System.out.
|
double |
prod()
Computes the product of all elements of the matrix
|
double |
project(DoubleMatrix other)
Computes the projection coefficient of other on this.
|
DoubleMatrix |
put(DoubleMatrix indices,
double v)
Put a single value into the elements specified by the non-zero
entries of indices (linear adressing).
|
DoubleMatrix |
put(DoubleMatrix indices,
DoubleMatrix v)
Put a sub-matrix into the indices specified by the non-zero entries
of indices (linear adressing).
|
DoubleMatrix |
put(DoubleMatrix rindices,
DoubleMatrix cindices,
double v)
Put a single value in the specified rows and columns (non-zero entries
of rindices and cindices.
|
DoubleMatrix |
put(DoubleMatrix rindices,
DoubleMatrix cindices,
DoubleMatrix v)
Put a sub-matrix into the specified rows and columns (non-zero entries of
rindices and cindices.
|
DoubleMatrix |
put(DoubleMatrix indices,
int c,
double v)
Put a single value into the specified rows (non-zero entries of
indices) of a column.
|
DoubleMatrix |
put(DoubleMatrix indices,
int c,
DoubleMatrix v)
Put a sub-vector into the specified rows (non-zero entries of indices) of a column.
|
DoubleMatrix |
put(int[] indices,
double v)
Put a single value into the specified indices (linear adressing).
|
DoubleMatrix |
put(int[] indices,
DoubleMatrix x)
Set elements in linear ordering in the specified indices.
|
DoubleMatrix |
put(int[] rindices,
int[] cindices,
double v)
Put a single value into the specified rows and columns.
|
DoubleMatrix |
put(int[] rindices,
int[] cindices,
DoubleMatrix x)
Put a sub-matrix as specified by the indices.
|
DoubleMatrix |
put(int[] indices,
int c,
double v)
Put a single value into the specified rows of a column.
|
DoubleMatrix |
put(int[] indices,
int c,
DoubleMatrix x)
Set multiple elements in a row.
|
DoubleMatrix |
put(int i,
double v)
Set a matrix element (linear indexing).
|
DoubleMatrix |
put(int r,
DoubleMatrix indices,
double v)
Put a single value into the specified columns (non-zero entries of
indices) of a row.
|
DoubleMatrix |
put(int r,
DoubleMatrix indices,
DoubleMatrix v)
Put a sub-vector into the specified columns (non-zero entries of indices) of a row.
|
DoubleMatrix |
put(int r,
int[] indices,
double v)
Put a single value into a row and the specified columns.
|
DoubleMatrix |
put(int r,
int[] indices,
DoubleMatrix x)
Set multiple elements in a row.
|
DoubleMatrix |
put(int rowIndex,
int columnIndex,
double value)
Set matrix element
|
DoubleMatrix |
put(Range rs,
Range cs,
DoubleMatrix x)
Put a matrix into specified indices.
|
void |
putColumn(int c,
DoubleMatrix v)
Copy a column back into the matrix.
|
void |
putRow(int r,
DoubleMatrix v)
Copy a row back into the matrix.
|
static DoubleMatrix |
rand(int len)
Creates a column vector with random values uniformly in 0..1.
|
static DoubleMatrix |
rand(int rows,
int columns)
Create matrix with random values uniformly in 0..1.
|
static DoubleMatrix |
randn(int len)
Create column vector with normally distributed random values.
|
static DoubleMatrix |
randn(int rows,
int columns)
Create matrix with normally distributed random values.
|
DoubleMatrix |
rankOneUpdate(double alpha,
DoubleMatrix x)
Computes a rank-1-update A = A + alpha * x * x'.
|
DoubleMatrix |
rankOneUpdate(double alpha,
DoubleMatrix x,
DoubleMatrix y)
Computes a rank-1-update A = A + alpha * x * y'.
|
DoubleMatrix |
rankOneUpdate(DoubleMatrix x)
Computes a rank-1-update A = A + x * x'.
|
DoubleMatrix |
rankOneUpdate(DoubleMatrix x,
DoubleMatrix y)
Computes a rank-1-update A = A + x * y'.
|
DoubleMatrix |
rdiv(double v)
(right-)elementwise divide by a scalar.
|
DoubleMatrix |
rdiv(DoubleMatrix other)
(right-)elementwise divide by a matrix.
|
DoubleMatrix |
rdivi(double v)
(right-)elementwise divide by a scalar (in place).
|
DoubleMatrix |
rdivi(double a,
DoubleMatrix result)
(Elementwise) division with a scalar, with operands switched.
|
DoubleMatrix |
rdivi(DoubleMatrix other)
(right-)elementwise divide by a matrix (in place).
|
DoubleMatrix |
rdivi(DoubleMatrix other,
DoubleMatrix result)
Elementwise division, with operands switched.
|
DoubleMatrix |
repmat(int rowMult,
int columnMult)
Generate a new matrix which has the given number of replications of this.
|
DoubleMatrix |
reshape(int newRows,
int newColumns)
Reshape the matrix.
|
void |
resize(int newRows,
int newColumns)
Resize the matrix.
|
int[] |
rowArgmaxs()
Return index of minimal element per row.
|
int[] |
rowArgmins()
Return index of minimal element per row.
|
DoubleMatrix |
rowMaxs()
Return row-wise maximums.
|
DoubleMatrix |
rowMeans()
Return a vector containing the means of the rows.
|
DoubleMatrix |
rowMins()
Return row-wise minimums.
|
List<DoubleMatrix> |
rowsAsList() |
int[][] |
rowSortingPermutations()
Return matrix of indices which sort all columns.
|
DoubleMatrix |
rowSums()
Return a vector containing the sum of the rows.
|
DoubleMatrix |
rsub(double v)
(right-)subtract a scalar.
|
DoubleMatrix |
rsub(DoubleMatrix other)
(right-)subtract a matrix.
|
DoubleMatrix |
rsubi(double v)
(right-)subtract a scalar (in place).
|
DoubleMatrix |
rsubi(double a,
DoubleMatrix result)
Subtract a matrix from a scalar (in-place).
|
DoubleMatrix |
rsubi(DoubleMatrix other)
(right-)subtract a matrix (in place).
|
DoubleMatrix |
rsubi(DoubleMatrix other,
DoubleMatrix result)
Subtract two matrices, but subtract first from second matrix, that is,
compute result = other - this (in-place).
|
boolean |
sameLength(DoubleMatrix a)
Checks whether two matrices have the same length.
|
boolean |
sameSize(DoubleMatrix a)
Checks whether two matrices have the same size.
|
void |
save(String filename)
Saves this matrix to the specified file.
|
double |
scalar()
Return the first element of the matrix.
|
static DoubleMatrix |
scalar(double s)
Create a 1-by-1 matrix.
|
DoubleMatrix |
select(DoubleMatrix where) |
DoubleMatrix |
selecti(DoubleMatrix where) |
DoubleMatrix |
sort()
Return a new matrix with all elements sorted.
|
DoubleMatrix |
sortColumns()
Sort columns.
|
DoubleMatrix |
sortColumnsi()
Sort columns (in-place).
|
DoubleMatrix |
sorti()
Sort elements in-place.
|
int[] |
sortingPermutation()
Get the sorting permutation.
|
DoubleMatrix |
sortRows()
Sort rows.
|
DoubleMatrix |
sortRowsi()
Sort rows (in-place).
|
double |
squaredDistance(DoubleMatrix other)
Returns the squared (Euclidean) distance.
|
DoubleMatrix |
sub(double v)
Subtract a scalar.
|
DoubleMatrix |
sub(DoubleMatrix other)
Subtract a matrix.
|
DoubleMatrix |
subColumnVector(DoubleMatrix x)
Subtract a vector from all columns of the matrix.
|
DoubleMatrix |
subi(double v)
Subtract a scalar (in place).
|
DoubleMatrix |
subi(double v,
DoubleMatrix result)
Subtract a scalar from a matrix (in-place).
|
DoubleMatrix |
subi(DoubleMatrix other)
Subtract a matrix (in place).
|
DoubleMatrix |
subi(DoubleMatrix other,
DoubleMatrix result)
Subtract two matrices (in-place).
|
DoubleMatrix |
subiColumnVector(DoubleMatrix x)
Subtract a column vector from all columns of the matrix (in-place).
|
DoubleMatrix |
subiRowVector(DoubleMatrix x)
Subtract a row vector from all rows of the matrix (in-place).
|
DoubleMatrix |
subRowVector(DoubleMatrix x)
Subtract a row vector from all rows of the matrix.
|
double |
sum()
Computes the sum of all elements of the matrix.
|
DoubleMatrix |
swapColumns(int i,
int j)
Swap two columns of a matrix.
|
DoubleMatrix |
swapRows(int i,
int j)
Swap two rows of a matrix.
|
double[] |
toArray()
Converts the matrix to a one-dimensional array of doubles.
|
double[][] |
toArray2()
Converts the matrix to a two-dimensional array of doubles.
|
boolean[] |
toBooleanArray()
Convert the matrix to a one-dimensional array of boolean values.
|
boolean[][] |
toBooleanArray2()
Convert the matrix to a two-dimensional array of boolean values.
|
ComplexDoubleMatrix |
toComplex() |
FloatMatrix |
toFloat() |
int[] |
toIntArray()
Converts the matrix to a one-dimensional array of integers.
|
int[][] |
toIntArray2()
Convert the matrix to a two-dimensional array of integers.
|
String |
toString()
Generate string representation of the matrix.
|
String |
toString(String fmt)
Generate string representation of the matrix, with specified
format for the entries.
|
String |
toString(String fmt,
String open,
String close,
String colSep,
String rowSep)
Generate string representation of the matrix, with specified
format for the entries, and delimiters.
|
DoubleMatrix |
transpose()
Return transposed copy of this matrix.
|
DoubleMatrix |
truth()
Maps zero to 0.0 and all non-zero values to 1.0.
|
DoubleMatrix |
truthi()
Maps zero to 0.0 and all non-zero values to 1.0 (in-place).
|
static DoubleMatrix |
valueOf(String text)
Construct DoubleMatrix from ASCII representation.
|
DoubleMatrix |
xor(double value)
Compute elementwise logical xor against a scalar.
|
DoubleMatrix |
xor(DoubleMatrix other)
Compute elementwise logical xor.
|
DoubleMatrix |
xori(double value)
Compute elementwise logical xor against a scalar (in-place).
|
DoubleMatrix |
xori(double value,
DoubleMatrix result)
Compute elementwise logical xor against a scalar (in-place).
|
DoubleMatrix |
xori(DoubleMatrix other)
Compute elementwise logical xor (in-place).
|
DoubleMatrix |
xori(DoubleMatrix other,
DoubleMatrix result)
Compute elementwise logical xor (in-place).
|
static DoubleMatrix |
zeros(int length)
Creates a column vector of given length.
|
static DoubleMatrix |
zeros(int rows,
int columns)
Creates a new matrix in which all values are equal 0.
|
public int rows
public int columns
public int length
public double[] data
public static final DoubleMatrix EMPTY
public DoubleMatrix(int newRows, int newColumns, double... newData)
newRows
- the number of rows of the new matrixnewColumns
- the number of columns of the new matrixnewData
- the data array to be used. Data must be stored by column (column-major)public DoubleMatrix(int newRows, int newColumns)
newRows
- the number of rows (n) of the new matrix.newColumns
- the number of columns (m) of the new matrix.public DoubleMatrix()
public DoubleMatrix(int len)
len
- public DoubleMatrix(double[] newData)
public DoubleMatrix(String filename) throws IOException
filename
- the path and name of the file to read the matrix fromIOException
public DoubleMatrix(double[][] data)
new DoubleMatrix(new double[][]{{1d, 2d, 3d}, {4d, 5d, 6d}, {7d, 8d, 9d}}).print();
1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0.
data
- n times m data arraypublic static DoubleMatrix valueOf(String text)
public static DoubleMatrix rand(int rows, int columns)
public static DoubleMatrix rand(int len)
public static DoubleMatrix randn(int rows, int columns)
public static DoubleMatrix randn(int len)
public static DoubleMatrix zeros(int rows, int columns)
public static DoubleMatrix zeros(int length)
public static DoubleMatrix ones(int rows, int columns)
public static DoubleMatrix ones(int length)
public static DoubleMatrix eye(int n)
public static DoubleMatrix diag(DoubleMatrix x)
public static DoubleMatrix diag(DoubleMatrix x, int rows, int columns)
x
- vector to fill the diagonal withrows
- number of rows of the resulting matrixcolumns
- number of columns of the resulting matrixpublic static DoubleMatrix scalar(double s)
public boolean isScalar()
public double scalar()
public static DoubleMatrix logspace(double lower, double upper, int size)
lower
- starting exponentupper
- ending exponentsize
- number of stepspublic static DoubleMatrix linspace(int lower, int upper, int size)
lower
- starting valueupper
- end valuesize
- number of stepspublic static DoubleMatrix concatHorizontally(DoubleMatrix A, DoubleMatrix B)
public static DoubleMatrix concatVertically(DoubleMatrix A, DoubleMatrix B)
public DoubleMatrix get(int[] indices)
public DoubleMatrix get(int r, int[] indices)
public DoubleMatrix get(int[] indices, int c)
public DoubleMatrix get(int[] rindices, int[] cindices)
public DoubleMatrix get(Range rs, Range cs)
public DoubleMatrix get(Range rs, int c)
public DoubleMatrix get(int r, Range cs)
public DoubleMatrix get(DoubleMatrix indices)
public DoubleMatrix get(int r, DoubleMatrix indices)
public DoubleMatrix get(DoubleMatrix indices, int c)
public DoubleMatrix get(DoubleMatrix rindices, DoubleMatrix cindices)
public DoubleMatrix getRange(int a, int b)
public DoubleMatrix getColumnRange(int r, int a, int b)
public DoubleMatrix getRowRange(int a, int b, int c)
public DoubleMatrix getRange(int ra, int rb, int ca, int cb)
public DoubleMatrix getRows(int[] rindices)
public DoubleMatrix getRows(DoubleMatrix rindices)
public DoubleMatrix getRows(Range indices, DoubleMatrix result)
public DoubleMatrix getRows(Range indices)
public DoubleMatrix getColumns(int[] cindices)
public DoubleMatrix getColumns(DoubleMatrix cindices)
public DoubleMatrix getColumns(Range indices, DoubleMatrix result)
public DoubleMatrix getColumns(Range indices)
public void checkLength(int l)
SizeException
public void checkRows(int r)
SizeException
public void checkColumns(int c)
SizeException
public DoubleMatrix put(int[] indices, DoubleMatrix x)
a.put(new int[]{ 1, 2, 0 }, new DoubleMatrix(3, 1, 2.0, 4.0, 8.0)
does a.put(1, 2.0), a.put(2, 4.0), a.put(0, 8.0)
.public DoubleMatrix put(int r, int[] indices, DoubleMatrix x)
public DoubleMatrix put(int[] indices, int c, DoubleMatrix x)
public DoubleMatrix put(int[] rindices, int[] cindices, DoubleMatrix x)
public DoubleMatrix put(Range rs, Range cs, DoubleMatrix x)
public DoubleMatrix put(int[] indices, double v)
public DoubleMatrix put(int r, int[] indices, double v)
public DoubleMatrix put(int[] indices, int c, double v)
public DoubleMatrix put(int[] rindices, int[] cindices, double v)
public DoubleMatrix put(DoubleMatrix indices, DoubleMatrix v)
public DoubleMatrix put(int r, DoubleMatrix indices, DoubleMatrix v)
public DoubleMatrix put(DoubleMatrix indices, int c, DoubleMatrix v)
public DoubleMatrix put(DoubleMatrix rindices, DoubleMatrix cindices, DoubleMatrix v)
public DoubleMatrix put(DoubleMatrix indices, double v)
public DoubleMatrix put(int r, DoubleMatrix indices, double v)
public DoubleMatrix put(DoubleMatrix indices, int c, double v)
public DoubleMatrix put(DoubleMatrix rindices, DoubleMatrix cindices, double v)
public int[] findIndices()
public DoubleMatrix transpose()
public boolean compare(Object o, double tolerance)
public void resize(int newRows, int newColumns)
public DoubleMatrix reshape(int newRows, int newColumns)
public DoubleMatrix repmat(int rowMult, int columnMult)
public boolean sameSize(DoubleMatrix a)
public void assertSameSize(DoubleMatrix a)
public boolean multipliesWith(DoubleMatrix a)
public void assertMultipliesWith(DoubleMatrix a)
public boolean sameLength(DoubleMatrix a)
public void assertSameLength(DoubleMatrix a)
public DoubleMatrix copy(DoubleMatrix a)
public DoubleMatrix dup()
public DoubleMatrix swapColumns(int i, int j)
public DoubleMatrix swapRows(int i, int j)
public DoubleMatrix put(int rowIndex, int columnIndex, double value)
public double get(int rowIndex, int columnIndex)
public int index(int rowIndex, int columnIndex)
public int indexRows(int i)
public int indexColumns(int i)
public double get(int i)
public DoubleMatrix put(int i, double v)
public DoubleMatrix fill(double value)
public int getRows()
public int getColumns()
public int getLength()
public boolean isEmpty()
public boolean isSquare()
public void assertSquare()
public boolean isVector()
public boolean isRowVector()
public boolean isColumnVector()
public DoubleMatrix diag()
public void print()
public String toString()
public String toString(String fmt)
x.toString("%.1f")
generates a string representations having only one position after the
decimal point.public String toString(String fmt, String open, String close, String colSep, String rowSep)
fmt
- entry format (passed to String.format())open
- opening parenthesisclose
- closing parenthesiscolSep
- separator between columnsrowSep
- separator between rowspublic double[] toArray()
public double[][] toArray2()
public int[] toIntArray()
public int[][] toIntArray2()
public boolean[] toBooleanArray()
public boolean[][] toBooleanArray2()
public FloatMatrix toFloat()
public List<DoubleMatrix> rowsAsList()
public List<DoubleMatrix> columnsAsList()
public DoubleMatrix addi(DoubleMatrix other, DoubleMatrix result)
public DoubleMatrix addi(double v, DoubleMatrix result)
public DoubleMatrix subi(DoubleMatrix other, DoubleMatrix result)
public DoubleMatrix subi(double v, DoubleMatrix result)
public DoubleMatrix rsubi(DoubleMatrix other, DoubleMatrix result)
public DoubleMatrix rsubi(double a, DoubleMatrix result)
public DoubleMatrix muli(DoubleMatrix other, DoubleMatrix result)
public DoubleMatrix muli(double v, DoubleMatrix result)
public DoubleMatrix mmuli(DoubleMatrix other, DoubleMatrix result)
public DoubleMatrix mmuli(double v, DoubleMatrix result)
muli(scalar)
(in-place).public DoubleMatrix divi(DoubleMatrix other, DoubleMatrix result)
public DoubleMatrix divi(double a, DoubleMatrix result)
public DoubleMatrix rdivi(DoubleMatrix other, DoubleMatrix result)
result = other / this
(in-place).public DoubleMatrix rdivi(double a, DoubleMatrix result)
result = a / this
(in-place).public DoubleMatrix negi()
public DoubleMatrix neg()
public DoubleMatrix noti()
public DoubleMatrix not()
public DoubleMatrix truthi()
public DoubleMatrix truth()
public DoubleMatrix isNaNi()
public DoubleMatrix isNaN()
public DoubleMatrix isInfinitei()
public DoubleMatrix isInfinite()
public boolean isLowerTriangular()
public boolean isUpperTriangular()
public DoubleMatrix selecti(DoubleMatrix where)
public DoubleMatrix select(DoubleMatrix where)
public DoubleMatrix rankOneUpdate(double alpha, DoubleMatrix x, DoubleMatrix y)
public DoubleMatrix rankOneUpdate(double alpha, DoubleMatrix x)
public DoubleMatrix rankOneUpdate(DoubleMatrix x)
public DoubleMatrix rankOneUpdate(DoubleMatrix x, DoubleMatrix y)
public double min()
public int argmin()
public DoubleMatrix mini(DoubleMatrix other, DoubleMatrix result)
public DoubleMatrix mini(DoubleMatrix other)
public DoubleMatrix min(DoubleMatrix other)
public DoubleMatrix mini(double v, DoubleMatrix result)
public DoubleMatrix mini(double v)
public DoubleMatrix min(double v)
public double max()
public int argmax()
public DoubleMatrix maxi(DoubleMatrix other, DoubleMatrix result)
public DoubleMatrix maxi(DoubleMatrix other)
public DoubleMatrix max(DoubleMatrix other)
public DoubleMatrix maxi(double v, DoubleMatrix result)
public DoubleMatrix maxi(double v)
public DoubleMatrix max(double v)
public double sum()
public double prod()
public double mean()
x.sum() / x.length
.public DoubleMatrix cumulativeSumi()
public DoubleMatrix cumulativeSum()
public double dot(DoubleMatrix other)
public double project(DoubleMatrix other)
public double norm2()
public double normmax()
public double norm1()
public double squaredDistance(DoubleMatrix other)
public double distance2(DoubleMatrix other)
public double distance1(DoubleMatrix other)
public DoubleMatrix sort()
public DoubleMatrix sorti()
public int[] sortingPermutation()
public DoubleMatrix sortColumnsi()
public DoubleMatrix sortColumns()
public int[][] columnSortingPermutations()
public DoubleMatrix sortRowsi()
public DoubleMatrix sortRows()
public int[][] rowSortingPermutations()
public DoubleMatrix columnSums()
public DoubleMatrix columnMeans()
public DoubleMatrix rowSums()
public DoubleMatrix rowMeans()
public DoubleMatrix getColumn(int c)
public DoubleMatrix getColumn(int c, DoubleMatrix result)
public void putColumn(int c, DoubleMatrix v)
public DoubleMatrix getRow(int r)
public DoubleMatrix getRow(int r, DoubleMatrix result)
public void putRow(int r, DoubleMatrix v)
public DoubleMatrix columnMins()
public int[] columnArgmins()
public DoubleMatrix columnMaxs()
public int[] columnArgmaxs()
public DoubleMatrix rowMins()
public int[] rowArgmins()
public DoubleMatrix rowMaxs()
public int[] rowArgmaxs()
public DoubleMatrix addiRowVector(DoubleMatrix x)
public DoubleMatrix addRowVector(DoubleMatrix x)
public DoubleMatrix addiColumnVector(DoubleMatrix x)
public DoubleMatrix addColumnVector(DoubleMatrix x)
public DoubleMatrix subiRowVector(DoubleMatrix x)
public DoubleMatrix subRowVector(DoubleMatrix x)
public DoubleMatrix subiColumnVector(DoubleMatrix x)
public DoubleMatrix subColumnVector(DoubleMatrix x)
public DoubleMatrix mulRow(int r, double scale)
public DoubleMatrix mulColumn(int c, double scale)
public DoubleMatrix muliColumnVector(DoubleMatrix x)
public DoubleMatrix mulColumnVector(DoubleMatrix x)
public DoubleMatrix muliRowVector(DoubleMatrix x)
public DoubleMatrix mulRowVector(DoubleMatrix x)
public DoubleMatrix diviRowVector(DoubleMatrix x)
public DoubleMatrix divRowVector(DoubleMatrix x)
public DoubleMatrix diviColumnVector(DoubleMatrix x)
public DoubleMatrix divColumnVector(DoubleMatrix x)
public void out(DataOutputStream dos) throws IOException
dos
- the data output stream to write to.IOException
public void in(DataInputStream dis) throws IOException
dis
- the data input stream to read from.IOException
public void save(String filename) throws IOException
filename
- the file to write the matrix in.IOException
- thrown on errors while writing the matrix to the filepublic void load(String filename) throws IOException
filename
- the file to read the matrix fromIOException
- thrown on errors while reading the matrixpublic static DoubleMatrix loadAsciiFile(String filename) throws IOException
IOException
public static DoubleMatrix loadCSVFile(String filename) throws IOException
IOException
public DoubleMatrix addi(DoubleMatrix other)
public DoubleMatrix add(DoubleMatrix other)
public DoubleMatrix addi(double v)
public DoubleMatrix add(double v)
public DoubleMatrix subi(DoubleMatrix other)
public DoubleMatrix sub(DoubleMatrix other)
public DoubleMatrix subi(double v)
public DoubleMatrix sub(double v)
public DoubleMatrix rsubi(DoubleMatrix other)
public DoubleMatrix rsub(DoubleMatrix other)
public DoubleMatrix rsubi(double v)
public DoubleMatrix rsub(double v)
public DoubleMatrix divi(DoubleMatrix other)
public DoubleMatrix div(DoubleMatrix other)
public DoubleMatrix divi(double v)
public DoubleMatrix div(double v)
public DoubleMatrix rdivi(DoubleMatrix other)
public DoubleMatrix rdiv(DoubleMatrix other)
public DoubleMatrix rdivi(double v)
public DoubleMatrix rdiv(double v)
public DoubleMatrix muli(DoubleMatrix other)
public DoubleMatrix mul(DoubleMatrix other)
public DoubleMatrix muli(double v)
public DoubleMatrix mul(double v)
public DoubleMatrix mmuli(DoubleMatrix other)
public DoubleMatrix mmul(DoubleMatrix other)
public DoubleMatrix mmuli(double v)
public DoubleMatrix mmul(double v)
public DoubleMatrix lti(DoubleMatrix other, DoubleMatrix result)
public DoubleMatrix lti(DoubleMatrix other)
public DoubleMatrix lt(DoubleMatrix other)
public DoubleMatrix lti(double value, DoubleMatrix result)
public DoubleMatrix lti(double value)
public DoubleMatrix lt(double value)
public DoubleMatrix gti(DoubleMatrix other, DoubleMatrix result)
public DoubleMatrix gti(DoubleMatrix other)
public DoubleMatrix gt(DoubleMatrix other)
public DoubleMatrix gti(double value, DoubleMatrix result)
public DoubleMatrix gti(double value)
public DoubleMatrix gt(double value)
public DoubleMatrix lei(DoubleMatrix other, DoubleMatrix result)
public DoubleMatrix lei(DoubleMatrix other)
public DoubleMatrix le(DoubleMatrix other)
public DoubleMatrix lei(double value, DoubleMatrix result)
public DoubleMatrix lei(double value)
public DoubleMatrix le(double value)
public DoubleMatrix gei(DoubleMatrix other, DoubleMatrix result)
public DoubleMatrix gei(DoubleMatrix other)
public DoubleMatrix ge(DoubleMatrix other)
public DoubleMatrix gei(double value, DoubleMatrix result)
public DoubleMatrix gei(double value)
public DoubleMatrix ge(double value)
public DoubleMatrix eqi(DoubleMatrix other, DoubleMatrix result)
public DoubleMatrix eqi(DoubleMatrix other)
public DoubleMatrix eq(DoubleMatrix other)
public DoubleMatrix eqi(double value, DoubleMatrix result)
public DoubleMatrix eqi(double value)
public DoubleMatrix eq(double value)
public DoubleMatrix nei(DoubleMatrix other, DoubleMatrix result)
public DoubleMatrix nei(DoubleMatrix other)
public DoubleMatrix ne(DoubleMatrix other)
public DoubleMatrix nei(double value, DoubleMatrix result)
public DoubleMatrix nei(double value)
public DoubleMatrix ne(double value)
public DoubleMatrix andi(DoubleMatrix other, DoubleMatrix result)
public DoubleMatrix andi(DoubleMatrix other)
public DoubleMatrix and(DoubleMatrix other)
public DoubleMatrix andi(double value, DoubleMatrix result)
public DoubleMatrix andi(double value)
public DoubleMatrix and(double value)
public DoubleMatrix ori(DoubleMatrix other, DoubleMatrix result)
public DoubleMatrix ori(DoubleMatrix other)
public DoubleMatrix or(DoubleMatrix other)
public DoubleMatrix ori(double value, DoubleMatrix result)
public DoubleMatrix ori(double value)
public DoubleMatrix or(double value)
public DoubleMatrix xori(DoubleMatrix other, DoubleMatrix result)
public DoubleMatrix xori(DoubleMatrix other)
public DoubleMatrix xor(DoubleMatrix other)
public DoubleMatrix xori(double value, DoubleMatrix result)
public DoubleMatrix xori(double value)
public DoubleMatrix xor(double value)
public ComplexDoubleMatrix toComplex()
Copyright © 2015. All rights reserved.