public static double[] timesMinusTimes(final double[] v1, final double s1, final double[] v2, final double s2) {
    assert v1.length == v2.length : ERR_VEC_DIMENSIONS;
    final double[] sub = new double[v1.length];
    for(int i = 0; i < v1.length; i++) {
      sub[i] = v1[i] * s1 - v2[i] * s2;
    }
    return sub;
  }
public static double [ ] timesMinusTimes ( final double [ ] v1 , final double s1 , final double [ ] v2 , final double s2 ) { assert v1 . length == v2 . length : ERR_VEC_DIMENSIONS ; final double [ ] sub = new double [ v1 . length ] ; for ( int i = 0 ; i < v1 . length ; i ++ ) { sub [ i ] = v1 [ i ] * s1 - v2 [ i ] * s2 ; } return sub ; }
Computes component-wise v1 * s1 - v2 * s2.

@param v1 first vector
@param s1 the scaling factor for v1
@param v2 the vector to be subtracted from this vector
@param s2 the scaling factor for v2
@return v1 * s1 - v2 * s2