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

org.nd4j.linalg.ops.elementwise.MultiplyOp Maven / Gradle / Ivy

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

import org.nd4j.linalg.api.complex.IComplexNumber;
import org.nd4j.linalg.factory.Nd4j;
import org.nd4j.linalg.ops.BaseTwoArrayElementWiseOp;

/**
 * Multiply a scalar or a matrix
 *
 * @author Adam Gibson
 */
public class MultiplyOp extends BaseTwoArrayElementWiseOp {


    @Override
    protected IComplexNumber complexComplex(IComplexNumber num1, IComplexNumber num2) {
        return num1.mul(num2);
    }

    @Override
    protected IComplexNumber realComplex(double real, IComplexNumber other) {
        return Nd4j.createDouble(real * other.realComponent().doubleValue(), other.complexArgument().doubleValue());
    }

    @Override
    protected IComplexNumber complexReal(IComplexNumber origin, double secondValue) {
        return origin.mul(secondValue);
    }

    @Override
    protected double realReal(double firstElement, double secondElement) {
        return firstElement * secondElement;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy