public class Basic1DMatrix extends DenseMatrix
Constructor and Description |
---|
Basic1DMatrix() |
Basic1DMatrix(int rows,
int columns) |
Basic1DMatrix(int rows,
int columns,
double[] array) |
Modifier and Type | Method and Description |
---|---|
Matrix |
blankOfShape(int rows,
int columns)
Creates the blank matrix (a zero matrix with same size) of this matrix
of the given shape:
rows x columns . |
static Basic1DMatrix |
block(Matrix a,
Matrix b,
Matrix c,
Matrix d)
|
static Basic1DMatrix |
constant(int rows,
int columns,
double constant)
Creates a constant
Basic1DMatrix of the given shape and value . |
Matrix |
copyOfShape(int rows,
int columns)
Copies this matrix into the new matrix with specified dimensions:
rows and columns . |
static Basic1DMatrix |
diagonal(int size,
double diagonal)
|
static Basic1DMatrix |
from1DArray(int rows,
int columns,
double[] array)
Creates a
Basic1DMatrix of the given 1D array w/o
copying the underlying array. |
static Basic1DMatrix |
from2DArray(double[][] array)
Creates a
Basic1DMatrix of the given 2D array with
copying the underlying array. |
static Basic1DMatrix |
fromBinary(byte[] array)
Decodes
Basic1DMatrix from the given byte array . |
static Basic1DMatrix |
fromCSV(String csv)
Parses
Basic1DMatrix from the given CSV string. |
static Basic1DMatrix |
fromMatrixMarket(String mm)
Parses
Basic1DMatrix from the given Matrix Market string. |
double |
get(int i,
int j)
Gets the specified element of this matrix.
|
Vector |
getRow(int i)
Copies the specified row of this matrix into the vector.
|
static Basic1DMatrix |
identity(int size)
Creates an identity
Basic1DMatrix of the given size . |
static Basic1DMatrix |
random(int rows,
int columns,
Random random)
|
static Basic1DMatrix |
randomSymmetric(int size,
Random random)
Creates a random symmetric
Basic1DMatrix of the given size . |
void |
set(int i,
int j,
double value)
Sets the specified element of this matrix to given
value . |
void |
setAll(double value)
Sets all elements of this matrix to the given
value . |
void |
swapColumns(int i,
int j)
Swaps the specified columns of this matrix.
|
void |
swapRows(int i,
int j)
Swaps the specified rows of this matrix.
|
<T extends Matrix> |
to(MatrixFactory<T> factory)
Converts this matrix using the given
factory . |
double[][] |
toArray()
Converts this dense matrix to double array.
|
byte[] |
toBinary()
Encodes this matrix into a byte array.
|
static Basic1DMatrix |
unit(int rows,
int columns)
|
static Basic1DMatrix |
zero(int rows,
int columns)
|
apply, apply, apply, getColumn, toMatrixMarket
add, add, blank, blankOfColumns, blankOfRows, columnMajorIterator, columns, copy, copyOfColumns, copyOfRows, determinant, diagonalProduct, divide, each, eachInColumn, eachInRow, ensureDimensionsAreCorrect, ensureIndexesAreInBounds, equals, equals, euclideanNorm, fail, fold, foldColumn, foldColumns, foldRow, foldRows, hadamardProduct, hashCode, infinityNorm, insert, insert, insert, insert, insertColumn, insertRow, is, is, iterator, iteratorOfColumn, iteratorOfRow, kroneckerProduct, manhattanNorm, max, maxInColumn, maxInRow, min, minInColumn, minInRow, mkString, mkString, mkString, multiply, multiply, multiply, multiplyByItsTranspose, non, non, norm, power, product, rank, removeColumn, removeFirstColumn, removeFirstRow, removeLastColumn, removeLastRow, removeRow, rotate, rowMajorIterator, rows, select, setColumn, setColumn, setRow, setRow, shuffle, slice, sliceBottomRight, sliceTopLeft, subtract, subtract, sum, toColumnMajorSparseMatrix, toColumnVector, toCSV, toCSV, toDenseMatrix, toMatrixMarket, toRowMajorSparseMatrix, toRowVector, toSparseMatrix, toString, trace, transform, transformColumn, transformRow, transpose, update, updateAt, updateColumn, updateRow, withDecompositor, withInverter, withSolver
public Basic1DMatrix()
public Basic1DMatrix(int rows, int columns)
public Basic1DMatrix(int rows, int columns, double[] array)
public static Basic1DMatrix zero(int rows, int columns)
public static Basic1DMatrix constant(int rows, int columns, double constant)
Basic1DMatrix
of the given shape and value
.public static Basic1DMatrix diagonal(int size, double diagonal)
public static Basic1DMatrix unit(int rows, int columns)
public static Basic1DMatrix identity(int size)
Basic1DMatrix
of the given size
.public static Basic1DMatrix random(int rows, int columns, Random random)
public static Basic1DMatrix randomSymmetric(int size, Random random)
Basic1DMatrix
of the given size
.public static Basic1DMatrix from1DArray(int rows, int columns, double[] array)
Basic1DMatrix
of the given 1D array
w/o
copying the underlying array.public static Basic1DMatrix from2DArray(double[][] array)
Basic1DMatrix
of the given 2D array
with
copying the underlying array.public static Basic1DMatrix block(Matrix a, Matrix b, Matrix c, Matrix d)
public static Basic1DMatrix fromBinary(byte[] array)
Basic1DMatrix
from the given byte array
.array
- the byte array representing a matrixpublic static Basic1DMatrix fromCSV(String csv)
Basic1DMatrix
from the given CSV string.csv
- the CSV string representing a matrixpublic static Basic1DMatrix fromMatrixMarket(String mm)
Basic1DMatrix
from the given Matrix Market string.mm
- the string in Matrix Market formatpublic double get(int i, int j)
Matrix
public void set(int i, int j, double value)
Matrix
value
.public void setAll(double value)
Matrix
value
.public void swapRows(int i, int j)
Matrix
public void swapColumns(int i, int j)
Matrix
swapColumns
in class Matrix
i
- the column indexj
- the column indexpublic Vector getRow(int i)
Matrix
getRow
in class DenseMatrix
i
- the row indexpublic Matrix copyOfShape(int rows, int columns)
Matrix
rows
and columns
.copyOfShape
in class Matrix
rows
- the number of rows in new matrixcolumns
- the number of columns in new matrixpublic double[][] toArray()
DenseMatrix
toArray
in class DenseMatrix
public <T extends Matrix> T to(MatrixFactory<T> factory)
Matrix
factory
.public Matrix blankOfShape(int rows, int columns)
Matrix
rows
x columns
.blankOfShape
in class Matrix
Copyright © 2015. All rights reserved.