All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nd4j.linalg.ops.reduceops.complex.Mean Maven / Gradle / Ivy

There is a newer version: 1.0.0-M2.1
Show newest version
package org.nd4j.linalg.ops.reduceops.complex;

import org.nd4j.linalg.api.complex.IComplexNDArray;
import org.nd4j.linalg.api.complex.IComplexNumber;
import org.nd4j.linalg.factory.Nd4j;

/**
 *
 * @author Adam Gibson
 */
public class Mean extends BaseScalarOp {

    public Mean() {
        super(Nd4j.createDouble(0, 0));
    }

    @Override
    public IComplexNumber accumulate(IComplexNDArray arr, int i, IComplexNumber soFar) {
       if(i < arr.length() - 1)
           return soFar.addi(arr.getComplex(i));
        else {
           soFar.addi(arr.getComplex(i));
           return soFar.div(arr.length());
       }

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy