Class LibMatrixDatagen
- java.lang.Object
- 
- org.apache.sysds.runtime.matrix.data.LibMatrixDatagen
 
- 
 public class LibMatrixDatagen extends Object 
- 
- 
Method SummaryAll Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static LongStreamcomputeNNZperBlock(long nrow, long ncol, int blen, double sparsity)Deprecated.static RandomMatrixGeneratorcreateRandomMatrixGenerator(String pdfStr, int r, int c, int blen, double sp, double min, double max, String distParams)static voidgenerateRandomMatrix(MatrixBlock out, RandomMatrixGenerator rgen, org.apache.commons.math3.random.Well1024a bigrand, long bSeed)Function to generate a matrix of random numbers.static voidgenerateRandomMatrix(MatrixBlock out, RandomMatrixGenerator rgen, org.apache.commons.math3.random.Well1024a bigrand, long bSeed, int k)Function to generate a matrix of random numbers.static voidgenerateSample(MatrixBlock out, long range, int size, boolean replace, long seed)Generates a sample of sizesizefrom a range of values [1,range].static voidgenerateSequence(MatrixBlock out, double from, double to, double incr)Method to generate a sequence according to the given parameters.static StringgenerateUniqueSeedPath(String basedir)static booleanisShortcutRandOperation(double min, double max, double sparsity, RandomMatrixGenerator.PDF pdf)static org.apache.commons.math3.random.Well1024asetupSeedsForRand(long seed)A matrix of random numbers is generated by using multiple seeds, one for each block.static doubleupdateSeqIncr(double seq_from, double seq_to, double seq_incr)
 
- 
- 
- 
Method Detail- 
isShortcutRandOperationpublic static boolean isShortcutRandOperation(double min, double max, double sparsity, RandomMatrixGenerator.PDF pdf)
 - 
updateSeqIncrpublic static double updateSeqIncr(double seq_from, double seq_to, double seq_incr)
 - 
setupSeedsForRandpublic static org.apache.commons.math3.random.Well1024a setupSeedsForRand(long seed) A matrix of random numbers is generated by using multiple seeds, one for each block. Such block-level seeds are produced via Well equidistributed long-period linear generator (Well1024a). For a given seed, this function sets up the block-level seeds. This function is invoked from both CP (RandCPInstruction.processInstruction()) as well as MR (RandMR.java while setting up the Rand job).- Parameters:
- seed- seed for random generator
- Returns:
- Well1024a pseudo-random number generator
 
 - 
computeNNZperBlock@Deprecated public static LongStream computeNNZperBlock(long nrow, long ncol, int blen, double sparsity) Deprecated.
 - 
createRandomMatrixGeneratorpublic static RandomMatrixGenerator createRandomMatrixGenerator(String pdfStr, int r, int c, int blen, double sp, double min, double max, String distParams) 
 - 
generateRandomMatrixpublic static void generateRandomMatrix(MatrixBlock out, RandomMatrixGenerator rgen, org.apache.commons.math3.random.Well1024a bigrand, long bSeed) Function to generate a matrix of random numbers. This is invoked both from CP as well as from MR. In case of CP, it generates an entire matrix block-by-block. Abigrandis passed so that block-level seeds are generated internally. In case of MR, it generates a single block for given block-level seedbSeed. When pdf="uniform", cell values are drawn from uniform distribution in range[min,max]. When pdf="normal", cell values are drawn from standard normal distribution N(0,1). The range of generated values will always be (-Inf,+Inf).- Parameters:
- out- output matrix block
- rgen- random matrix generator
- bigrand- Well1024a pseudo-random number generator
- bSeed- seed for random generator
 
 - 
generateRandomMatrixpublic static void generateRandomMatrix(MatrixBlock out, RandomMatrixGenerator rgen, org.apache.commons.math3.random.Well1024a bigrand, long bSeed, int k) Function to generate a matrix of random numbers. This is invoked both from CP as well as from MR. In case of CP, it generates an entire matrix block-by-block. Abigrandis passed so that block-level seeds are generated internally. In case of MR, it generates a single block for given block-level seedbSeed. When pdf="uniform", cell values are drawn from uniform distribution in range[min,max]. When pdf="normal", cell values are drawn from standard normal distribution N(0,1). The range of generated values will always be (-Inf,+Inf).- Parameters:
- out- output matrix block
- rgen- random matrix generator
- bigrand- Well1024a pseudo-random number generator
- bSeed- seed for random generator
- k- ?
 
 - 
generateSequencepublic static void generateSequence(MatrixBlock out, double from, double to, double incr) Method to generate a sequence according to the given parameters. The generated sequence is always in dense format. Both end points specifiedfromandtomust be included in the generated sequence i.e., [from,to] both inclusive. Note that,tois included only if (to-from) is perfectly divisible byincr. For example, seq(0,1,0.5) generates (0.0 0.5 1.0) whereas seq(0,1,0.6) generates (0.0 0.6) but not (0.0 0.6 1.0)- Parameters:
- out- output matrix block
- from- lower end point
- to- upper end point
- incr- increment value
 
 - 
generateSamplepublic static void generateSample(MatrixBlock out, long range, int size, boolean replace, long seed) Generates a sample of sizesizefrom a range of values [1,range].replacedefines if sampling is done with or without replacement.- Parameters:
- out- output matrix block
- range- range upper bound
- size- sample size
- replace- if true, sample with replacement
- seed- seed for random generator
 
 
- 
 
-