code: public static final DoubleMatrix1D replaceValues(DoubleMatrix1D v, double oldValue,	double newValue) {
  		if(v == null){
  			return null;
  		}
  		DoubleFactory1D F1 = (v instanceof SparseDoubleMatrix1D)? DoubleFactory1D.sparse : DoubleFactory1D.dense;   
  		DoubleMatrix1D ret = F1.make(v.size());
  		for (int i = 0; i < v.size(); i++) {
  			double vi = v.getQuick(i);
  			if (Double.compare(oldValue, vi) != 0) {
  				// no substitution
  				ret.setQuick(i, vi);
  			} else {
  				ret.setQuick(i, newValue);
  			}
  		}
  		return ret;
  	}
docs: Return a new array with all the occurences of oldValue replaced by newValue.