Search in sources :

Example 16 with Well1024a

use of org.apache.commons.math3.random.Well1024a in project mixcr by milaboratory.

the class ClonalSequenceTest method testIsCompatible5.

@Test
public void testIsCompatible5() throws Exception {
    RandomGenerator random = new Well1024a();
    ClonalSequence c1 = create("AAAAAAAAAA", "AAAAAAAAAAAAAA");
    ClonalSequence c2 = create("AAAAA", "AAAAAAA");
    testCompatiblePair(c1, c2, random);
    testCompatiblePair(c2, c1, random);
// c2 = create("AAAAA", "AAAAAAAAAAAAAAAAAAAAAAAAAA");
// testCompatiblePair(c1, c2, random);
// testCompatiblePair(c2, c1, random);
// c2 = create("AAAAAAAAAAAAAAAAAAAAAAAAAA", "AAAAA");
// testCompatiblePair(c1, c2, random);
// testCompatiblePair(c2, c1, random);
}
Also used : RandomGenerator(org.apache.commons.math3.random.RandomGenerator) Well1024a(org.apache.commons.math3.random.Well1024a) Test(org.junit.Test)

Example 17 with Well1024a

use of org.apache.commons.math3.random.Well1024a in project mixcr by milaboratory.

the class ClonalSequenceTest method testIsCompatible2.

@Test
public void testIsCompatible2() throws Exception {
    RandomGenerator generator = new Well1024a();
    Mutations<NucleotideSequence> muts = Mutations.decode("", NucleotideSequence.ALPHABET);
    for (int i = 0; i < 100; i++) {
        ClonalSequence c1 = createRandom(5 + generator.nextInt(10), generator);
        Assert.assertTrue(c1.isCompatible(c1, muts));
    }
}
Also used : NucleotideSequence(com.milaboratory.core.sequence.NucleotideSequence) RandomGenerator(org.apache.commons.math3.random.RandomGenerator) Well1024a(org.apache.commons.math3.random.Well1024a) Test(org.junit.Test)

Example 18 with Well1024a

use of org.apache.commons.math3.random.Well1024a in project tetrad by cmu-phil.

the class LargeScaleSimulation method getUncorrelatedGaussianShocks.

public double[][] getUncorrelatedGaussianShocks(int sampleSize) {
    NormalDistribution normal = new NormalDistribution(new Well1024a(++seed), 0, 1);
    int numVars = variableNodes.size();
    setupModel(numVars);
    double[][] shocks = new double[sampleSize][numVars];
    for (int i = 0; i < sampleSize; i++) {
        for (int j = 0; j < numVars; j++) {
            shocks[i][j] = normal.sample() * sqrt(errorVars[j]);
        }
    }
    return shocks;
}
Also used : Well1024a(org.apache.commons.math3.random.Well1024a)

Aggregations

Well1024a (org.apache.commons.math3.random.Well1024a)18 DMLRuntimeException (org.apache.sysml.runtime.DMLRuntimeException)6 PrintWriter (java.io.PrintWriter)4 ArrayList (java.util.ArrayList)4 FileSystem (org.apache.hadoop.fs.FileSystem)4 Path (org.apache.hadoop.fs.Path)4 MatrixCharacteristics (org.apache.sysml.runtime.matrix.MatrixCharacteristics)4 MatrixBlock (org.apache.sysml.runtime.matrix.data.MatrixBlock)4 MatrixIndexes (org.apache.sysml.runtime.matrix.data.MatrixIndexes)4 RandomGenerator (org.apache.commons.math3.random.RandomGenerator)3 Test (org.junit.Test)3 NucleotideSequence (com.milaboratory.core.sequence.NucleotideSequence)2 IOException (java.io.IOException)2 Random (java.util.Random)2 PoissonDistribution (org.apache.commons.math3.distribution.PoissonDistribution)2 SynchronizedRandomGenerator (org.apache.commons.math3.random.SynchronizedRandomGenerator)2 Group (org.apache.hadoop.mapred.Counters.Group)2 JobConf (org.apache.hadoop.mapred.JobConf)2 RunningJob (org.apache.hadoop.mapred.RunningJob)2 DMLConfig (org.apache.sysml.conf.DMLConfig)2