Search in sources :

Example 16 with ArrayTensor

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

the class HanningWindow 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 lowerThresh = bufferSize / 4;
    int upperThresh = bufferSize - lowerThresh;
    for (int i = 0; i < bufferSize; i++) {
        b.data[i] = i < lowerThresh || i > upperThresh ? 0.5f * (1.0f + (float) Math.cos((Math.PI + Math.PI * 4.0f * i / (float) (bufferSize - 1)))) : 1.0f;
    }
    return b;
}
Also used : ArrayTensor(jcog.math.tensor.ArrayTensor)

Example 17 with ArrayTensor

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

the class CosineWindow 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) Math.sin((double) i / bufferSize * Math.PI);
    }
    return b;
}
Also used : ArrayTensor(jcog.math.tensor.ArrayTensor)

Example 18 with ArrayTensor

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

the class Exp01Wave 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] = (float) Math.exp(1f - 1f / fract);
    }
    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