R
- the result class of this parallel computation.public abstract class MatrixEngine<R> extends Engine<MatrixEngine.MatrixCoordinate,R>
Modifier and Type | Class and Description |
---|---|
static class |
MatrixEngine.MatrixCoordinate
This identifies a coordinate in a matrix as a tuple of row index and
column index.
|
Engine.CalculationResult<I,R>
DEFAULT_NUMBER_OF_THREADS
Constructor and Description |
---|
MatrixEngine(int M,
int N,
Class<R> resultClass) |
Modifier and Type | Method and Description |
---|---|
static <X> X[][] |
createGenericMatrix(int m,
int n,
Class<X> entryClass)
This is a helper method that creates an object matrix of the given class.
|
static <R> int |
extractNumberOfColumns(R[][] matrix)
Returns the number of columns in the given matrix and checks if the
number of columns is consistent, that is: if the given input-array is
indeed a matrix.
|
double[][] |
getDoubleResultMatrix()
Returns the results of the calculation as a primitive double matrix.
|
int |
getM()
Returns the number of rows in the matrix.
|
int |
getN()
Returns the number of columns in the matrix.
|
R[][] |
getResultMatrix()
Returns the results of the calculation as an object matrix.
|
void |
removeDiagonal()
Ensures that the diagonal of the matrix is not calculated at the next
call to "calculate".
|
void |
setFull()
Clears all current calculation tasks and instead adds a task for every
matrix entry, such that the full matrix is calculated on the next call of
the "calculate" method.
|
void |
setSpecificTasks(boolean[][] cells)
Clears all current calculation tasks and instead adds a task for every
matrix entry that is set to "true" in the given boolean matrix.
|
void |
setSpecificTasks(Collection<MatrixEngine.MatrixCoordinate> coords)
Clears all current calculation tasks and instead adds a task for every
given matrix coordinate.
|
void |
setSpecificTasks(int[][] coords)
Clears all current calculation tasks and instead adds a task for every
given matrix coordinate.
|
void |
setSpecificTasks(MatrixEngine.MatrixCoordinate[] coords)
Clears all current calculation tasks and instead adds a task for every
given matrix coordinate.
|
void |
setSymmetric()
Clears all current calculation tasks and instead adds a task for every
matrix entry in the upper half of the matrix.
|
addTask, addTasks, addTasks, calculate, clearTasks, createCallable, getIdentClass, getNumberOfThreads, getReporter, getResultClass, getResults, isCancelOnException, removeTask, removeTasks, removeTasks, setCancelOnException, setNumberOfThreads, setReporter
public int getM()
public int getN()
public void setFull()
public void setSymmetric()
public void setSpecificTasks(boolean[][] cells)
cells
- a boolean matrix specifying the cells that should be
calculated.public void setSpecificTasks(MatrixEngine.MatrixCoordinate[] coords)
coords
- an array of coordinates in the matrix.public void setSpecificTasks(Collection<MatrixEngine.MatrixCoordinate> coords)
coords
- a collection of coordinates in the matrix.public void setSpecificTasks(int[][] coords)
coords
- a n x 2 matrix with row indices in the first column and
column indices in the second column.public void removeDiagonal()
public R[][] getResultMatrix()
public double[][] getDoubleResultMatrix()
public static <X> X[][] createGenericMatrix(int m, int n, Class<X> entryClass)
X
- the class of the matrix entries.m
- the number of rows.n
- the number of columns.entryClass
- the class of the matrix entries.public static <R> int extractNumberOfColumns(R[][] matrix)
R
- the class of the matrix entries.matrix
- some matrix.Copyright (C) 2013-2015 Benjamin Paaßen, Georg Zentgraf, AG Theoretical Computer Science, Centre of Excellence Cognitive Interaction Technology (CITEC), University of Bielefeld, licensed under the AGPL v. 3: http://openresearch.cit-ec.de/projects/tcs . This documentation is licensed under the conditions of CC-BY-SA 4.0: https://creativecommons.org/licenses/by-sa/4.0/