Search in sources :

Example 6 with Well1024a

use of org.apache.commons.math3.random.Well1024a in project incubator-systemml by apache.

the class MatrixBlock method randOperations.

/**
	 * Function to generate the random matrix with specified dimensions and block dimensions.
	 * 
	 * @param rgen random matrix generator
	 * @param seed seed value
	 * @param k ?
	 * @return matrix block
	 * @throws DMLRuntimeException if DMLRuntimeException occurs
	 */
public static MatrixBlock randOperations(RandomMatrixGenerator rgen, long seed, int k) throws DMLRuntimeException {
    MatrixBlock out = new MatrixBlock();
    Well1024a bigrand = null;
    LongStream nnzInBlock = null;
    //setup seeds and nnz per block
    if (!LibMatrixDatagen.isShortcutRandOperation(rgen._min, rgen._max, rgen._sparsity, rgen._pdf)) {
        bigrand = LibMatrixDatagen.setupSeedsForRand(seed);
        nnzInBlock = LibMatrixDatagen.computeNNZperBlock(rgen._rows, rgen._cols, rgen._rowsPerBlock, rgen._colsPerBlock, rgen._sparsity);
    }
    //generate rand data
    if (k > 1)
        out.randOperationsInPlace(rgen, nnzInBlock, bigrand, -1, k);
    else
        out.randOperationsInPlace(rgen, nnzInBlock, bigrand, -1);
    return out;
}
Also used : LongStream(java.util.stream.LongStream) Well1024a(org.apache.commons.math3.random.Well1024a)

Aggregations

Well1024a (org.apache.commons.math3.random.Well1024a)6 LongStream (java.util.stream.LongStream)3 DMLRuntimeException (org.apache.sysml.runtime.DMLRuntimeException)3 PrintWriter (java.io.PrintWriter)2 ArrayList (java.util.ArrayList)2 PrimitiveIterator (java.util.PrimitiveIterator)2 FileSystem (org.apache.hadoop.fs.FileSystem)2 Path (org.apache.hadoop.fs.Path)2 MatrixCharacteristics (org.apache.sysml.runtime.matrix.MatrixCharacteristics)2 MatrixBlock (org.apache.sysml.runtime.matrix.data.MatrixBlock)2 MatrixIndexes (org.apache.sysml.runtime.matrix.data.MatrixIndexes)2 IOException (java.io.IOException)1 Random (java.util.Random)1 PoissonDistribution (org.apache.commons.math3.distribution.PoissonDistribution)1 SynchronizedRandomGenerator (org.apache.commons.math3.random.SynchronizedRandomGenerator)1 Group (org.apache.hadoop.mapred.Counters.Group)1 JobConf (org.apache.hadoop.mapred.JobConf)1 RunningJob (org.apache.hadoop.mapred.RunningJob)1 DMLConfig (org.apache.sysml.conf.DMLConfig)1 DataGenMRInstruction (org.apache.sysml.runtime.instructions.mr.DataGenMRInstruction)1