public class MatrixUtil extends Object
Constructor and Description |
---|
MatrixUtil() |
Modifier and Type | Method and Description |
---|---|
static cern.colt.matrix.DoubleMatrix1D |
applyToIndicesMatchingCriteria(cern.colt.matrix.DoubleMatrix1D x,
DoubleFunction<Boolean> criterion,
DoubleFunction<Double> action) |
static cern.colt.list.BooleanArrayList |
conjunction(cern.colt.list.BooleanArrayList a,
cern.colt.list.BooleanArrayList b)
Compute the conjuction (logical 'and') of two boolean vectors
|
static boolean |
containsNearlyZeros(cern.colt.matrix.DoubleMatrix1D d) |
static cern.colt.matrix.DoubleMatrix1D |
diagonal(cern.colt.matrix.DoubleMatrix2D matrix)
Extract the diagonal from a matrix.
|
static cern.colt.matrix.DoubleMatrix2D |
dropColumn(cern.colt.matrix.DoubleMatrix2D n,
int indexToDrop) |
static cern.colt.matrix.DoubleMatrix2D |
dropColumns(cern.colt.matrix.DoubleMatrix2D n,
Collection<Integer> droppedColumns) |
static cern.colt.matrix.DoubleMatrix1D |
fromList(cern.colt.list.DoubleArrayList list)
Makes a copy
|
static <R,C,V> V |
getObject(Matrix2D<R,C,V> matrix,
int rowIndex,
int colIndex) |
static <R,C,V> V[] |
getRow(Matrix2D<R,C,V> matrix,
int rowIndex) |
static void |
maskMissing(cern.colt.matrix.DoubleMatrix2D source,
cern.colt.matrix.DoubleMatrix2D target) |
static cern.colt.list.BooleanArrayList |
matchingCriteria(cern.colt.matrix.DoubleMatrix1D x,
DoubleFunction<Boolean> criterion) |
static cern.colt.matrix.DoubleMatrix1D |
multWithMissing(cern.colt.matrix.DoubleMatrix1D a,
cern.colt.matrix.DoubleMatrix2D b) |
static cern.colt.matrix.DoubleMatrix1D |
multWithMissing(cern.colt.matrix.DoubleMatrix2D a,
cern.colt.matrix.DoubleMatrix1D b) |
static cern.colt.matrix.DoubleMatrix2D |
multWithMissing(cern.colt.matrix.DoubleMatrix2D a,
cern.colt.matrix.DoubleMatrix2D b)
Multiple two matrices, tolerate missing values.
|
static List<Integer> |
notNearlyZeroIndices(cern.colt.matrix.DoubleMatrix1D d) |
static cern.colt.matrix.DoubleMatrix1D |
removeMissing(cern.colt.matrix.DoubleMatrix1D x) |
static cern.colt.matrix.DoubleMatrix1D |
removeMissingOrInfinite(cern.colt.matrix.DoubleMatrix1D data) |
static cern.colt.matrix.DoubleMatrix1D |
removeMissingOrInfinite(cern.colt.matrix.DoubleMatrix1D reference,
cern.colt.matrix.DoubleMatrix1D data)
Remove values from data corresponding to missing values in reference.
|
static void |
replaceValues(cern.colt.matrix.DoubleMatrix1D x,
cern.colt.list.BooleanArrayList toReplace,
cern.colt.matrix.DoubleMatrix1D replacements)
Perform the awkward operation of substituting certain values in a vector from values in another vector.
|
static cern.colt.matrix.DoubleMatrix1D |
select(cern.colt.matrix.DoubleMatrix1D v,
Collection<Integer> selected) |
static cern.colt.matrix.DoubleMatrix2D |
selectColumns(cern.colt.matrix.DoubleMatrix2D n,
Collection<Integer> selected) |
static cern.colt.matrix.DoubleMatrix2D |
selectColumnsAndRows(cern.colt.matrix.DoubleMatrix2D n,
Collection<Integer> selected) |
static cern.colt.matrix.DoubleMatrix2D |
selectRows(cern.colt.matrix.DoubleMatrix2D n,
Collection<Integer> selected) |
static int |
sizeWithoutMissingValues(cern.colt.matrix.DoubleMatrix1D list) |
static cern.colt.matrix.DoubleMatrix1D |
stripByCriterion(cern.colt.matrix.DoubleMatrix1D x,
DoubleFunction<Boolean> criterion) |
static cern.colt.matrix.DoubleMatrix1D |
stripNegative(cern.colt.matrix.DoubleMatrix1D x) |
static cern.colt.matrix.DoubleMatrix1D |
stripNonOK(cern.colt.matrix.DoubleMatrix1D x,
cern.colt.list.BooleanArrayList ok) |
static cern.colt.list.DoubleArrayList |
toList(cern.colt.matrix.DoubleMatrix1D vector)
Makes a copy
|
public static boolean containsNearlyZeros(cern.colt.matrix.DoubleMatrix1D d)
d
- public static cern.colt.matrix.DoubleMatrix1D diagonal(cern.colt.matrix.DoubleMatrix2D matrix)
matrix
- public static cern.colt.matrix.DoubleMatrix2D dropColumn(cern.colt.matrix.DoubleMatrix2D n, int indexToDrop)
n
- indexToDrop
- public static cern.colt.matrix.DoubleMatrix2D dropColumns(cern.colt.matrix.DoubleMatrix2D n, Collection<Integer> droppedColumns)
n
- droppedColumns
- public static cern.colt.matrix.DoubleMatrix1D fromList(cern.colt.list.DoubleArrayList list)
list
- public static <R,C,V> V getObject(Matrix2D<R,C,V> matrix, int rowIndex, int colIndex)
R
- C
- V
- matrix
- rowIndex
- colIndex
- public static <R,C,V> V[] getRow(Matrix2D<R,C,V> matrix, int rowIndex)
R
- C
- V
- matrix
- rowIndex
- public static void maskMissing(cern.colt.matrix.DoubleMatrix2D source, cern.colt.matrix.DoubleMatrix2D target)
source
- the source of information about missing valuestarget
- the target where we want to convert values to missingpublic static cern.colt.matrix.DoubleMatrix1D multWithMissing(cern.colt.matrix.DoubleMatrix1D a, cern.colt.matrix.DoubleMatrix2D b)
public static cern.colt.matrix.DoubleMatrix1D multWithMissing(cern.colt.matrix.DoubleMatrix2D a, cern.colt.matrix.DoubleMatrix1D b)
a
- b
- public static cern.colt.matrix.DoubleMatrix2D multWithMissing(cern.colt.matrix.DoubleMatrix2D a, cern.colt.matrix.DoubleMatrix2D b)
a
- b
- public static List<Integer> notNearlyZeroIndices(cern.colt.matrix.DoubleMatrix1D d)
public static cern.colt.matrix.DoubleMatrix1D removeMissingOrInfinite(cern.colt.matrix.DoubleMatrix1D data)
data
- public static final cern.colt.matrix.DoubleMatrix1D removeMissing(cern.colt.matrix.DoubleMatrix1D x)
x
- public static cern.colt.matrix.DoubleMatrix1D removeMissingOrInfinite(cern.colt.matrix.DoubleMatrix1D reference, cern.colt.matrix.DoubleMatrix1D data)
reference
- data
- public static final cern.colt.matrix.DoubleMatrix1D stripNegative(cern.colt.matrix.DoubleMatrix1D x)
public static final cern.colt.matrix.DoubleMatrix1D stripByCriterion(cern.colt.matrix.DoubleMatrix1D x, DoubleFunction<Boolean> criterion)
public static final cern.colt.list.BooleanArrayList conjunction(cern.colt.list.BooleanArrayList a, cern.colt.list.BooleanArrayList b)
a
- b
- public static cern.colt.list.BooleanArrayList matchingCriteria(cern.colt.matrix.DoubleMatrix1D x, DoubleFunction<Boolean> criterion)
x
- vector to be operated oncriterion
- a function that returns a boolean if a double matches the desired criteriapublic static cern.colt.matrix.DoubleMatrix1D applyToIndicesMatchingCriteria(cern.colt.matrix.DoubleMatrix1D x, DoubleFunction<Boolean> criterion, DoubleFunction<Double> action)
x
- vector to be operated oncriterion
- criterion used to test values if they should be acted on.action
- function applied to values if they match the criterionpublic static final cern.colt.matrix.DoubleMatrix1D stripNonOK(cern.colt.matrix.DoubleMatrix1D x, cern.colt.list.BooleanArrayList ok)
x
- a vector of values to be filteredok
- a list of booleans defining which values are "ok".public static void replaceValues(cern.colt.matrix.DoubleMatrix1D x, cern.colt.list.BooleanArrayList toReplace, cern.colt.matrix.DoubleMatrix1D replacements)
x
- vector to be operated on in place (it will be modified).toReplace
- boolean indicators of same length of x, 'true' indicates a value to be replaced in x with a value from 'replacements'; 'false' will be unmodified in x.replacements
- the replacements, in order, to be substituted in x where toReplace(i) is true. This vector can be shorter than x.public static cern.colt.matrix.DoubleMatrix1D select(cern.colt.matrix.DoubleMatrix1D v, Collection<Integer> selected)
public static cern.colt.matrix.DoubleMatrix2D selectColumns(cern.colt.matrix.DoubleMatrix2D n, Collection<Integer> selected)
public static cern.colt.matrix.DoubleMatrix2D selectColumnsAndRows(cern.colt.matrix.DoubleMatrix2D n, Collection<Integer> selected)
n
- square matrixselected
- public static cern.colt.matrix.DoubleMatrix2D selectRows(cern.colt.matrix.DoubleMatrix2D n, Collection<Integer> selected)
public static int sizeWithoutMissingValues(cern.colt.matrix.DoubleMatrix1D list)
public static cern.colt.list.DoubleArrayList toList(cern.colt.matrix.DoubleMatrix1D vector)
vector
- Copyright © 2003–2022 UBC Michael Smith Laboratories. All rights reserved.