public class BlockDenseDoubleMatrix2D extends AbstractDenseDoubleMatrix2D implements HasBlockDoubleArray2D
Example: a 4x4 matrix with block size 2x2 is internally re-organised into 4 separate blocks :
|(0,0) , (0, 1) | (0, 2) , (0, 3) |
|(1,0) , (1, 1) | (1, 2) , (1, 3) |
|----------------------------------
|(2,0) , (2, 1) | (2, 2) , (2, 3) |
|(3,0) , (3, 1) | (3, 2) , (3, 3) |
This can be described as a matrix of the following blocks:
| A | B |
| C | D |
Each block is mapped to a separate one-dimensional array. For example block A:
[ (0,0), (1,0), (0, 1), (1, 1)]
This layout is similar to what's described in [ref: II fig. 4b].
The blocks may be square and can be configured by the user at runtime. However, matrix multiplication performance will be sensitive to the choice of block size, depending on the amount of CPU cache available on the system.
'Efficient Matrix Multiplication Using Cache Conscious Data Layouts';
Neungsoo Park, Wenheng Liuy, Viktor K. Prasanna, Cauligi Raghavendra;
Department of Electrical Engineering{Systems), University of Southern
California,
'Tiling, Block Data Layout, and Memory Hierarchy Performance';
Neungsoo Park, Bo Hong, and Viktor K. Prasanna,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
protected BlockMatrixLayout |
layout
Layout of matrix and blocks.
|
guiObject, sizeFactorychol, divideMatrix, divideScalar, eig, inv, lu, minusMatrix, minusScalar, mtimes, plusMatrix, plusScalar, qr, solve, svd, timesMatrix, timesScalar, transposeALL, COLUMN, LINK, NEW, NONE, ORIG, ROW, X, Y, ZDIMENSIONMETADATADESCRIPTIONFactory| Constructor and Description |
|---|
BlockDenseDoubleMatrix2D(BlockDenseDoubleMatrix2D m)
Constructor which takes an existing BlockMatrix to copy data and
structure from.
|
BlockDenseDoubleMatrix2D(double[][] values) |
BlockDenseDoubleMatrix2D(double[][] values,
int blockStripeSize,
BlockMatrixLayout.BlockOrder blockOrder)
Create a block matrix from a jagged array.
|
BlockDenseDoubleMatrix2D(int rows,
int cols)
Create a new matrix with the specified size, and specified block stripe
size.
|
BlockDenseDoubleMatrix2D(int rows,
int cols,
BlockMatrixLayout.BlockOrder blockOrder)
Create a new matrix with the given size (rows, cols) and block layout.
|
BlockDenseDoubleMatrix2D(int rows,
int cols,
int blockStripeSize,
BlockMatrixLayout.BlockOrder blockOrder)
Create a new matrix with the specified size, and specified block stripe
size.
|
BlockDenseDoubleMatrix2D(Matrix m)
Constructor which takes an existing Matrix to copy data and structure
from.
|
BlockDenseDoubleMatrix2D(Matrix m,
int blockStripeSize)
Constructor which takes a Matrix and a proposed default block stripe
size.
|
BlockDenseDoubleMatrix2D(Matrix m,
int blockStripeSize,
BlockMatrixLayout.BlockOrder blockOrder)
Constructor which takes a Matrix and a proposed default block stripe
size.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addBlockData(int row,
int column,
double[] newData) |
BlockDenseDoubleMatrix2D |
clone() |
Matrix |
divide(double value)
Divides every entry in the matrix by a scalar.
|
Matrix |
divide(Matrix value)
Calculates an entrywise division of the two matrices.
|
void |
fill(double[][] data) |
void |
fill(double[][] data,
int startRow,
int startCol)
Populate matrix with given data.
|
double[][] |
getBlockDoubleArray2D() |
BlockMatrixLayout |
getBlockLayout() |
int |
getBlockStripeSize() |
double |
getDouble(int row,
int col) |
double |
getDouble(long row,
long column) |
Matrix |
minus(double value)
Subtracts a specified value from all entries in the matrix.
|
Matrix |
minus(Matrix value)
Calculates the difference of the entries in both matrices
|
Matrix |
mtimes(Matrix m2)
Shortcut to create a BlockMatrix for target
|
Matrix |
plus(double value)
Adds a specified value to all entries in the matrix.
|
Matrix |
plus(Matrix value)
Calculates the sum of the entries in both matrices
|
BlockMatrixLayout.BlockOrder |
setBlockOrder(BlockMatrixLayout.BlockOrder order)
Change layout of blocks in this matrix (e.g.
|
void |
setDouble(double value,
int row,
int column) |
void |
setDouble(double value,
long row,
long column) |
Matrix |
times(double value)
Multiplies every entry in the matrix with a scalar.
|
Matrix |
times(Matrix value)
Calculates the entrywise product of the two matrices.
|
Matrix |
transpose()
Returns the transpose of the current matrix.
|
Matrix |
transpose(Calculation.Ret returnType)
Returns the transpose of the Matrix, where rows and columns are
exchanged.
|
availableCoordinates, clear, containsCoordinates, getAsDouble, getAsDouble, getDimensionCount, getObject, getObject, isSparse, setAsDouble, setAsDouble, setObject, setObjectgetDouble, setDoublegetAsDouble, getNumber, getObject, getValueType, setAsDouble, setNumber, setObjectgetAsObject, setAsObjectabs, addMissing, allCoordinates, allValues, and, and, append, appendHorizontally, appendVertically, atimes, bigDecimalValue, bigIntegerValue, booleanValue, bootstrap, bootstrap, ceil, center, charValue, chebyshevDistanceTo, chol, compareTo, containsBigDecimal, containsBigInteger, containsBoolean, containsByte, containsChar, containsDate, containsDouble, containsFloat, containsInt, containsLong, containsMissingValues, containsNull, containsObject, containsShort, containsString, convert, convertEncoding, corrcoef, cos, cosh, cosineSimilarity, cosineSimilarityTo, countMissing, cov, cumprod, cumsum, dateValue, delete, delete, delete, deleteColumns, deleteColumns, deleteColumnsWithMissingValues, deleteRows, deleteRows, deleteRowsWithMissingValues, det, diag, diff, discretize, discretize, discretizeToBoolean, discretizeToColumns, divide, divide, doubleValue, eig, eigSymm, eq, eq, equals, equalsAnnotation, equalsContent, euklideanDistance, euklideanDistanceTo, exp, exportTo, extractAnnotation, eye, fadeIn, fadeOut, fill, fireValueChanged, fireValueChanged, fireValueChanged, flipdim, floatValue, floor, ge, ge, getAbsoluteValueMean, getAbsoluteValueSum, getAsBigDecimal, getAsBigInteger, getAsBoolean, getAsByte, getAsByteArray, getAsChar, getAsDate, getAsFloat, getAsInt, getAsLong, getAsMatrix, getAsShort, getAsString, getColumnCount, getColumnForLabel, getColumnLabel, getColumnList, getCoordinatesOfMaximum, getCoordinatesOfMinimum, getCoreObjectId, getDescription, getDimensionLabel, getDimensionMetaData, getEuklideanValue, getFactory, getGUIObject, getId, getLabel, getLabelObject, getMaxValue, getMeanValue, getMetaData, getMetaData, getMetaDataDimensionMatrix, getMetaDataDouble, getMetaDataMatrix, getMetaDataString, getMinValue, getPositionForLabel, getPreferredObject, getRMS, getRowCount, getRowForLabel, getRowLabel, getRowList, getSize, getSize, getStdValue, getValueCount, getValueSum, getZCount, ginv, grayScale, gt, gt, importFrom, impute, includeAnnotation, indexOfMax, indexOfMin, intValue, inv, invSPD, invSymm, isColumnVector, isDiagonal, isEmpty, isMultidimensionalMatrix, isReadOnly, isResizable, isRowVector, isScalar, isSingular, isSPD, isSquare, isSymmetric, isTransient, le, le, log, log10, log2, logistic, longValue, lowerCase, lt, lt, lu, manhattenDistance, manhattenDistanceTo, max, mean, min, minkowskiDistance, minkowskiDistanceTo, minus, minus, mtimes, mutualInf, nans, ne, ne, nonZeroCoordinates, norm1, norm2, normalize, normF, normInf, not, ones, or, or, pairedTTest, pdet, pinv, pinv, plus, plus, power, power, princomp, prod, qr, rand, randn, rank, removePunctuation, removeWords, replace, replaceMissingBy, replaceRegex, replaceRegex, reshape, round, save, save, select, select, select, selectColumns, selectColumns, selectedCoordinates, selectedCoordinates, selectRows, selectRows, setAsBigDecimal, setAsBigInteger, setAsBoolean, setAsByte, setAsByteArray, setAsChar, setAsDate, setAsFloat, setAsInt, setAsLong, setAsMatrix, setAsShort, setAsString, setColumnLabel, setContent, setDescription, setDimensionLabel, setDimensionMetaData, setId, setLabel, setMetaData, setMetaData, setMetaDataDimensionMatrix, setRowLabel, setSize, share, share, showGUI, shuffle, sign, sin, sinh, solve, solveSPD, solveSymm, sortrows, sqrt, squeeze, standardize, std, stem, stringValue, subMatrix, sum, svd, svd, swap, tan, tanh, tanh, tfIdf, times, times, toBigDecimalArray, toBigDecimalMatrix, toBigIntegerArray, toBigIntegerMatrix, toBooleanArray, toBooleanMatrix, toByteArray, toByteMatrix, toCharArray, toCharMatrix, toColumnVector, toDateArray, toDoubleArray, toDoubleMatrix, toFloatArray, toFloatMatrix, toHtml, toIntArray, toIntMatrix, toListMatrix, toLongArray, toLongMatrix, toMapMatrix, toObjectArray, toObjectMatrix, toRowVector, toSetMatrix, toShortArray, toShortMatrix, toString, toStringArray, toStringMatrix, trace, translate, transpose, tril, triu, unique, uniqueValueCount, upperCase, var, xor, xor, zerosbyteValue, shortValuefinalize, getClass, hashCode, notify, notifyAll, wait, wait, waitexportTo, fireValueChanged, fireValueChanged, fireValueChanged, importFrom, save, save, share, share, toHtmlgetFactoryallValues, equals, equalsAnnotation, equalsContent, getColumnCount, getColumnList, getRowCount, getRowList, getSize, getSize, getValueCount, getValueType, getZCount, isColumnVector, isDiagonal, isEmpty, isMultidimensionalMatrix, isReadOnly, isResizable, isRowVector, isScalar, isSingular, isSquare, isSymmetric, isTransient, setSize, toStringgetCoreObjectIdgetGUIObject, showGUIallCoordinates, getCoordinatesOfMaximum, getCoordinatesOfMinimum, nonZeroCoordinates, selectedCoordinates, selectedCoordinatesgetAsBigDecimal, getAsBigInteger, getAsBoolean, getAsByte, getAsByteArray, getAsChar, getAsDate, getAsDouble, getAsFloat, getAsInt, getAsLong, getAsMatrix, getAsObject, getAsShort, getAsString, getPreferredObject, setAsBigDecimal, setAsBigInteger, setAsBoolean, setAsByte, setAsByteArray, setAsChar, setAsDate, setAsDouble, setAsFloat, setAsInt, setAsLong, setAsMatrix, setAsObject, setAsShort, setAsString, toBigDecimalArray, toBigIntegerArray, toBooleanArray, toByteArray, toCharArray, toDateArray, toDoubleArray, toFloatArray, toIntArray, toLongArray, toObjectArray, toShortArray, toStringArrayatimes, divide, divide, minus, minus, mtimes, plus, plus, times, timesabs, exp, log, log10, log2, logistic, power, power, sign, sqrtceil, floor, roundcosh, sinh, tanh, tanhcos, sin, taneye, nans, ones, rand, randn, zerosgrayScalecorrcoef, cov, cumprod, cumsum, diff, indexOfMax, indexOfMin, max, mean, min, mutualInf, pairedTTest, prod, std, sum, varchol, eig, eigSymm, ginv, inv, invSPD, invSymm, lu, pinv, pinv, princomp, qr, solve, solveSPD, solveSymm, svd, svdaddMissing, countMissing, deleteColumnsWithMissingValues, deleteRowsWithMissingValues, imputeappend, appendHorizontally, appendVertically, center, fadeIn, fadeOut, normalize, replaceMissingBy, standardizediscretize, discretize, discretizeToBoolean, discretizeToColumnsand, and, eq, eq, ge, ge, gt, gt, le, le, lt, lt, ne, ne, not, or, or, xor, xorconvertEncoding, lowerCase, removePunctuation, removeWords, replaceRegex, replaceRegex, stem, tfIdf, translate, upperCasebootstrap, bootstrap, convert, delete, delete, delete, deleteColumns, deleteColumns, deleteRows, deleteRows, diag, extractAnnotation, fill, flipdim, includeAnnotation, replace, reshape, select, select, select, selectColumns, selectColumns, selectRows, selectRows, shuffle, sortrows, squeeze, subMatrix, swap, toColumnVector, toRowVector, transpose, tril, triu, unique, uniqueValueCountchebyshevDistanceTo, cosineSimilarity, cosineSimilarityTo, euklideanDistance, euklideanDistanceTo, manhattenDistance, manhattenDistanceTo, minkowskiDistance, minkowskiDistanceTocompareTogetColumnForLabel, getColumnLabel, getDimensionLabel, getDimensionMetaData, getMetaData, getMetaData, getMetaDataDimensionMatrix, getMetaDataDouble, getMetaDataMatrix, getMetaDataString, getPositionForLabel, getRowForLabel, getRowLabel, setColumnLabel, setDimensionLabel, setDimensionMetaData, setMetaData, setMetaData, setMetaDataDimensionMatrix, setRowLabelgetLabel, getLabelObject, setLabelgetDescription, setDescriptiontoBigDecimalMatrix, toBigIntegerMatrix, toBooleanMatrix, toByteMatrix, toCharMatrix, toDoubleMatrix, toFloatMatrix, toIntMatrix, toListMatrix, toLongMatrix, toMapMatrix, toObjectMatrix, toSetMatrix, toShortMatrix, toStringMatrixbigDecimalValue, bigIntegerValue, booleanValue, byteValue, charValue, containsBigDecimal, containsBigInteger, containsBoolean, containsByte, containsChar, containsDate, containsDouble, containsFloat, containsInt, containsLong, containsMissingValues, containsNull, containsObject, containsShort, containsString, dateValue, det, doubleValue, floatValue, getAbsoluteValueMean, getAbsoluteValueSum, getEuklideanValue, getMaxValue, getMeanValue, getMinValue, getRMS, getStdValue, getValueSum, intValue, isSPD, longValue, norm1, norm2, normF, normInf, pdet, rank, setContent, shortValue, stringValue, traceprotected BlockMatrixLayout layout
public BlockDenseDoubleMatrix2D(double[][] values)
public BlockDenseDoubleMatrix2D(double[][] values,
int blockStripeSize,
BlockMatrixLayout.BlockOrder blockOrder)
values - - the data to populate the matrix with.blockStripeSize - - length of one side of a blockblockOrder - - see BlockMatrixLayout.BlockOrder.NullPointerException - if values is null, or values[0] is null.ArrayIndexOutOfBoundsException - if any row is shorter than the first row.public BlockDenseDoubleMatrix2D(int rows,
int cols,
int blockStripeSize,
BlockMatrixLayout.BlockOrder blockOrder)
rows - - number of rows of the matrix.cols - - number of columns of the matrix.blockStripeSize - - length of one side of a square block.IllegalArgumentException - if rows, cols or blockStripeSize are 0 or less, or blockOrder
is null.public BlockDenseDoubleMatrix2D(int rows,
int cols,
BlockMatrixLayout.BlockOrder blockOrder)
#BlockMatrix(int, int)public BlockDenseDoubleMatrix2D(int rows,
int cols)
rows - - number of rows of the matrix.cols - - number of columns of the matrix.IllegalArgumentException - if rows, cols are 0 or less.public BlockDenseDoubleMatrix2D(Matrix m)
m - - matrix to copy data from.public BlockDenseDoubleMatrix2D(BlockDenseDoubleMatrix2D m)
public BlockDenseDoubleMatrix2D(Matrix m, int blockStripeSize)
m - - matrix containing existing values.blockStripeSize - - proposed default block size.public BlockDenseDoubleMatrix2D(Matrix m, int blockStripeSize, BlockMatrixLayout.BlockOrder blockOrder)
m - - matrix containing existing values.blockStripeSize - - proposed default block size.blockOrder - row major or column majorprotected void addBlockData(int row,
int column,
double[] newData)
public void fill(double[][] data)
fill(double[][], int, int)public void fill(double[][] data,
int startRow,
int startCol)
data - - to fill into matrixstartRow - - row to start filling in data atstartCol - - col to start atpublic final BlockMatrixLayout getBlockLayout()
BlockMatrixLayout of this matrix.public final int getBlockStripeSize()
public double getDouble(int row,
int col)
getDouble in interface DoubleMatrix2Dpublic double getDouble(long row,
long column)
getDouble in interface DoubleMatrix2Dpublic Matrix mtimes(Matrix m2)
mtimes in interface BasicDoubleCalculationsmtimes in class AbstractDenseDoubleMatrix2Dm2 - the second matrixpublic void setDouble(double value,
int row,
int column)
setDouble in interface DoubleMatrix2Dpublic void setDouble(double value,
long row,
long column)
setDouble in interface DoubleMatrix2Dpublic Matrix transpose()
transpose in interface ObjectCalculationstranspose in class AbstractDenseDoubleMatrix2Dpublic BlockDenseDoubleMatrix2D clone()
clone in interface CoreObjectclone in interface Matrixclone in class AbstractMatrixpublic Matrix transpose(Calculation.Ret returnType)
ObjectCalculationstranspose in interface ObjectCalculationstranspose in class AbstractMatrixreturnType - Defines if a new Matrix or a link should be returned.public final double[][] getBlockDoubleArray2D()
getBlockDoubleArray2D in interface HasBlockDoubleArray2Dpublic Matrix plus(double value)
BasicDoubleCalculationsplus in interface BasicDoubleCalculationsplus in class AbstractDenseDoubleMatrix2Dvalue - the value to addpublic Matrix plus(Matrix value)
BasicDoubleCalculationsplus in interface BasicDoubleCalculationsplus in class AbstractDenseDoubleMatrix2Dvalue - The matrix to addpublic Matrix minus(Matrix value)
BasicDoubleCalculationsminus in interface BasicDoubleCalculationsminus in class AbstractDenseDoubleMatrix2Dvalue - The matrix to subtractpublic Matrix times(Matrix value)
BasicDoubleCalculationstimes in interface BasicDoubleCalculationstimes in class AbstractDenseDoubleMatrix2Dvalue - the second matrixpublic Matrix divide(Matrix value)
BasicDoubleCalculationsdivide in interface BasicDoubleCalculationsdivide in class AbstractDenseDoubleMatrix2Dvalue - the second matrixpublic Matrix minus(double value)
BasicDoubleCalculationsminus in interface BasicDoubleCalculationsminus in class AbstractDenseDoubleMatrix2Dvalue - the value to subtractpublic Matrix times(double value)
BasicDoubleCalculationstimes in interface BasicDoubleCalculationstimes in class AbstractDenseDoubleMatrix2Dvalue - factor to multiply withpublic Matrix divide(double value)
BasicDoubleCalculationsdivide in interface BasicDoubleCalculationsdivide in class AbstractDenseDoubleMatrix2Dvalue - factor by which to dividepublic BlockMatrixLayout.BlockOrder setBlockOrder(BlockMatrixLayout.BlockOrder order)
order - - new block layout order.Copyright © 2015 Universal Java Matrix Package. All rights reserved.