mikera.vectorz
Class Op2
- java.lang.Object
-
- mikera.vectorz.Op2
-
- Direct Known Subclasses:
- Add, AddFunction, ComposedOp2, CrossEntropy, CrossEntropyDerivative, CrossEntropyLogisticDerivative, Max, Min
public abstract class Op2 extends java.lang.ObjectAbstract class for representing a unary operation
-
-
Constructor Summary
Constructors Constructor and Description Op2()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description abstract doubleapply(double x, double y)voidapplyTo(ADenseArrayVector a, AVector b)voidapplyTo(AMatrix a, AMatrix b)voidapplyTo(AScalar a, AScalar b)voidapplyTo(AVector a, AVector b)voidapplyTo(double[] data, AVector b)voidapplyTo(double[] data, double b)voidapplyTo(double[] data, int start, int length, AVector b)voidapplyTo(double[] data, int start, int length, double b)voidapplyTo(INDArray a, INDArray b)doubleaverageValue()voidconstrainValues(double[] src, double[] dest, int offset, int length)Creates a copy of the values of src in dest, constraining them to be within the valid range of output values from this OpOp2getDerivative(int i)Gets the derivative of this Op2 with respect to the specified parameter (0 or 1)booleanisBounded()booleanisStochastic()Returns true if the operator is stochastic, i.e returns random values for at least some inputsdoublemaxValue()doubleminValue()doublereduce(double init, double[] data, int offset, int length)Method to reduce over a subset of a double[] arraydoublereduce(double init, double[] data, int offset, int length, int stride)Method to reduce over a strided subset of a double[] arraydoublereduceZeros(double init, long length)Method to reduce over a sequence of zeros.doublereduceZeros(long length)Method to reduce over a sequence of zeros.java.lang.StringtoString()booleanvalidateOutput(double[] output)Validates whether all values in a double[] are within the possible output range for this Op
-
-
-
Method Detail
-
apply
public abstract double apply(double x, double y)
-
applyTo
public void applyTo(ADenseArrayVector a, AVector b)
-
applyTo
public void applyTo(double[] data, int start, int length, AVector b)
-
applyTo
public void applyTo(double[] data, int start, int length, double b)
-
applyTo
public void applyTo(double[] data, AVector b)
-
applyTo
public void applyTo(double[] data, double b)
-
isStochastic
public boolean isStochastic()
Returns true if the operator is stochastic, i.e returns random values for at least some inputs- Returns:
-
averageValue
public double averageValue()
-
minValue
public double minValue()
-
maxValue
public double maxValue()
-
validateOutput
public boolean validateOutput(double[] output)
Validates whether all values in a double[] are within the possible output range for this Op- Parameters:
output-- Returns:
-
constrainValues
public void constrainValues(double[] src, double[] dest, int offset, int length)Creates a copy of the values of src in dest, constraining them to be within the valid range of output values from this Op- Parameters:
src-dest-offset-length-
-
isBounded
public boolean isBounded()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
reduce
public double reduce(double init, double[] data, int offset, int length)Method to reduce over a subset of a double[] array
-
reduce
public double reduce(double init, double[] data, int offset, int length, int stride)Method to reduce over a strided subset of a double[] array
-
reduceZeros
public double reduceZeros(double init, long length)Method to reduce over a sequence of zeros. Optimises for common stable cases.- Parameters:
init-length-- Returns:
-
reduceZeros
public double reduceZeros(long length)
Method to reduce over a sequence of zeros. Optimises for common stable cases.- Parameters:
length-- Returns:
-
getDerivative
public Op2 getDerivative(int i)
Gets the derivative of this Op2 with respect to the specified parameter (0 or 1)- Parameters:
i-- Returns:
-
-
DMelt 3.0 © DataMelt by jWork.ORG