cern.colt.matrix
Class DoubleFactory1D

Factory for convenient construction of 1-d matrices holding double cells.
Use idioms like DoubleFactory1D.dense.make(1000) to construct dense matrices,
DoubleFactory1D.sparse.make(1000) to construct sparse matrices.
If the factory is used frequently it might be useful to streamline the notation.
For example by aliasing:

sample

Constructs a randomly sampled matrix with the given shape.
Randomly picks exactly Math.round(size*nonZeroFraction) cells and initializes them to value, all the rest will be initialized to zero.
Note that this is not the same as setting each cell with probability nonZeroFraction to value.