Search in sources :

Example 1 with ArrayTensor

use of jcog.math.tensor.ArrayTensor in project narchy by automenta.

the class Log01Wave method get.

/* (non-Javadoc)
     * @see net.beadsproject.beads.data.BufferFactory#generateBuffer(int)
     */
@Override
public ArrayTensor get(int bufferSize) {
    int size = bufferSize;
    ArrayTensor b = new ArrayTensor(size);
    for (int i = 0; i < bufferSize; i++) {
        float fract = (float) i / (bufferSize - 1);
        b.data[i] = 1f / (1f - (float) Math.log(fract));
    }
    return b;
}
Also used : ArrayTensor(jcog.math.tensor.ArrayTensor)

Example 2 with ArrayTensor

use of jcog.math.tensor.ArrayTensor in project narchy by automenta.

the class NoiseWave method get.

@Override
public ArrayTensor get(int bufferSize) {
    int size = bufferSize;
    ArrayTensor b = new ArrayTensor(size);
    for (int i = 0; i < bufferSize; i++) {
        b.data[i] = (float) (1. - 2. * Math.random());
    }
    return b;
}
Also used : ArrayTensor(jcog.math.tensor.ArrayTensor)

Example 3 with ArrayTensor

use of jcog.math.tensor.ArrayTensor in project narchy by automenta.

the class RampWave method get.

@Override
public ArrayTensor get(int bufferSize) {
    int size = bufferSize;
    ArrayTensor b = new ArrayTensor(size);
    for (int i = 0; i < bufferSize; i++) {
        b.data[i] = ramp((i + 0.5f) / bufferSize) / bufferSize;
    }
    return b;
}
Also used : ArrayTensor(jcog.math.tensor.ArrayTensor)

Example 4 with ArrayTensor

use of jcog.math.tensor.ArrayTensor in project narchy by automenta.

the class SawWave method get.

/* (non-Javadoc)
     * @see net.beadsproject.beads.data.BufferFactory#generateBuffer(int)
     */
@Override
public ArrayTensor get(int bufferSize) {
    int size = bufferSize;
    ArrayTensor b = new ArrayTensor(size);
    for (int i = 0; i < bufferSize; i++) {
        b.data[i] = (float) i / bufferSize * 2.0f - 1.0f;
    }
    return b;
}
Also used : ArrayTensor(jcog.math.tensor.ArrayTensor)

Example 5 with ArrayTensor

use of jcog.math.tensor.ArrayTensor in project narchy by automenta.

the class SquareWave method get.

/* (non-Javadoc)
     * @see net.beadsproject.beads.data.BufferFactory#generateBuffer(int)
     */
@Override
public ArrayTensor get(int bufferSize) {
    int size = bufferSize;
    ArrayTensor b = new ArrayTensor(size);
    int halfBufferSize = bufferSize / 2;
    for (int i = 0; i < halfBufferSize; i++) {
        b.data[i] = 1f;
    }
    for (int i = halfBufferSize; i < bufferSize; i++) {
        b.data[i] = -1f;
    }
    return b;
}
Also used : ArrayTensor(jcog.math.tensor.ArrayTensor)

Aggregations

ArrayTensor (jcog.math.tensor.ArrayTensor)18 Test (org.junit.jupiter.api.Test)3 XoRoShiRo128PlusRandom (jcog.math.random.XoRoShiRo128PlusRandom)1 XorShift128PlusRandom (jcog.math.random.XorShift128PlusRandom)1 Tensor (jcog.math.tensor.Tensor)1 Frequency (org.apache.commons.math3.stat.Frequency)1