public double magnitude() {
        if (magnitude < 0) {
            double m = 0;
            for (double d : vector)
                m += d * d;
            magnitude = Math.sqrt(m);
        }
        return magnitude;
    }
public double magnitude ( ) { if ( magnitude < 0 ) { double m = 0 ; for ( double d : vector ) m += d * d ; magnitude = Math . sqrt ( m ) ; } return magnitude ; }
{@inheritDoc}