@Override
    public double squaredDistance(INDArray other) {
        double sd = 0.0;
        if (other instanceof IComplexNDArray) {
            IComplexNDArray n = (IComplexNDArray) other;
            IComplexNDArray nLinear = n.linearView();

            for (int i = 0; i < length(); i++) {
                IComplexNumber diff = linearView().getComplex(i).sub(nLinear.getComplex(i));
                double d = diff.absoluteValue().doubleValue();
                sd += d * d;
            }
            return sd;
        }
        for (int i = 0; i < length(); i++) {
            INDArray linear = other.linearView();
            IComplexNumber diff = linearView().getComplex(i).sub(linear.getDouble(i));
            double d = diff.absoluteValue().doubleValue();
            sd += d * d;
        }

        return sd;
    }
@Override
    public double squaredDistance(INDArray other) {
        double sd = 0.0;
        if (other instanceof IComplexNDArray) {
            IComplexNDArray n = (IComplexNDArray) other;
            IComplexNDArray nLinear = n.linearView();

            for (int i = 0; i < length(); i++) {
                IComplexNumber diff = linearView().getComplex(i).sub(nLinear.getComplex(i));
                double d = diff.absoluteValue().doubleValue();
                sd += d * d;
            }
            return sd;
        }
        for (int i = 0; i < length(); i++) {
            INDArray linear = other.linearView();
            IComplexNumber diff = linearView().getComplex(i).sub(linear.getDouble(i));
            double d = diff.absoluteValue().doubleValue();
            sd += d * d;
        }

        return sd;
    }
@ Override public double squaredDistance ( INDArray other ) { double sd = 0.0 ; if ( other instanceof IComplexNDArray ) { IComplexNDArray n = ( IComplexNDArray ) other ; IComplexNDArray nLinear = n . linearView ( ) ; for ( int i = 0 ; i < length ( ) ; i ++ ) { IComplexNumber diff = linearView ( ) . getComplex ( i ) . sub ( nLinear . getComplex ( i ) ) ; double d = diff . absoluteValue ( ) . doubleValue ( ) ; sd += d * d ; } return sd ; } for ( int i = 0 ; i < length ( ) ; i ++ ) { INDArray linear = other . linearView ( ) ; IComplexNumber diff = linearView ( ) . getComplex ( i ) . sub ( linear . getDouble ( i ) ) ; double d = diff . absoluteValue ( ) . doubleValue ( ) ; sd += d * d ; } return sd ; }
Returns the squared (Euclidean) distance.
Returns the squared ( Euclidean ) distance .