*/
return new RealVector() {
/** {@inheritDoc} */
@Override
public RealVector mapToSelf(UnivariateFunction function) {
throw new MathUnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public RealVector map(UnivariateFunction function) {
return v.map(function);
}
/** {@inheritDoc} */
@Override
public Iterator<Entry> iterator() {
final Iterator<Entry> i = v.iterator();
return new Iterator<Entry>() {
/** The current entry. */
private final UnmodifiableEntry e = new UnmodifiableEntry();
/** {@inheritDoc} */
public boolean hasNext() {
return i.hasNext();
}
/** {@inheritDoc} */
public Entry next() {
e.setIndex(i.next().getIndex());
return e;
}
/** {@inheritDoc} */
public void remove() {
throw new MathUnsupportedOperationException();
}
};
}
/** {@inheritDoc} */
@Override
public Iterator<Entry> sparseIterator() {
final Iterator<Entry> i = v.sparseIterator();
return new Iterator<Entry>() {
/** The current entry. */
private final UnmodifiableEntry e = new UnmodifiableEntry();
/** {@inheritDoc} */
public boolean hasNext() {
return i.hasNext();
}
/** {@inheritDoc} */
public Entry next() {
e.setIndex(i.next().getIndex());
return e;
}
/** {@inheritDoc} */
public void remove() {
throw new MathUnsupportedOperationException();
}
};
}
/** {@inheritDoc} */
@Override
public RealVector copy() {
return v.copy();
}
/** {@inheritDoc} */
@Override
public RealVector add(RealVector w) {
return v.add(w);
}
/** {@inheritDoc} */
@Override
public RealVector subtract(RealVector w) {
return v.subtract(w);
}
/** {@inheritDoc} */
@Override
public RealVector mapAdd(double d) {
return v.mapAdd(d);
}
/** {@inheritDoc} */
@Override
public RealVector mapAddToSelf(double d) {
throw new MathUnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public RealVector mapSubtract(double d) {
return v.mapSubtract(d);
}
/** {@inheritDoc} */
@Override
public RealVector mapSubtractToSelf(double d) {
throw new MathUnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public RealVector mapMultiply(double d) {
return v.mapMultiply(d);
}
/** {@inheritDoc} */
@Override
public RealVector mapMultiplyToSelf(double d) {
throw new MathUnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public RealVector mapDivide(double d) {
return v.mapDivide(d);
}
/** {@inheritDoc} */
@Override
public RealVector mapDivideToSelf(double d) {
throw new MathUnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public RealVector ebeMultiply(RealVector w) {
return v.ebeMultiply(w);
}
/** {@inheritDoc} */
@Override
public RealVector ebeDivide(RealVector w) {
return v.ebeDivide(w);
}
/** {@inheritDoc} */
@Override
public double dotProduct(RealVector w) {
return v.dotProduct(w);
}
/** {@inheritDoc} */
@Override
public double cosine(RealVector w) {
return v.cosine(w);
}
/** {@inheritDoc} */
@Override
public double getNorm() {
return v.getNorm();
}
/** {@inheritDoc} */
@Override
public double getL1Norm() {
return v.getL1Norm();
}
/** {@inheritDoc} */
@Override
public double getLInfNorm() {
return v.getLInfNorm();
}
/** {@inheritDoc} */
@Override
public double getDistance(RealVector w) {
return v.getDistance(w);
}
/** {@inheritDoc} */
@Override
public double getL1Distance(RealVector w) {
return v.getL1Distance(w);
}
/** {@inheritDoc} */
@Override
public double getLInfDistance(RealVector w) {
return v.getLInfDistance(w);
}
/** {@inheritDoc} */
@Override
public RealVector unitVector() {
return v.unitVector();
}
/** {@inheritDoc} */
@Override
public void unitize() {
throw new MathUnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public RealVector projection(RealVector w) {
return v.projection(w);
}
/** {@inheritDoc} */
@Override
public RealMatrix outerProduct(RealVector w) {
return v.outerProduct(w);
}
/** {@inheritDoc} */
@Override
public double getEntry(int index) {
return v.getEntry(index);
}
/** {@inheritDoc} */
@Override
public void setEntry(int index, double value) {
throw new MathUnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public void addToEntry(int index, double value) {
throw new MathUnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public int getDimension() {
return v.getDimension();
}
/** {@inheritDoc} */
@Override
public RealVector append(RealVector w) {
return v.append(w);
}
/** {@inheritDoc} */
@Override
public RealVector append(double d) {
return v.append(d);
}
/** {@inheritDoc} */
@Override
public RealVector getSubVector(int index, int n) {
return v.getSubVector(index, n);
}
/** {@inheritDoc} */
@Override
public void setSubVector(int index, RealVector w) {
throw new MathUnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public void set(double value) {
throw new MathUnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
public double[] toArray() {
return v.toArray();
}
/** {@inheritDoc} */
@Override
public boolean isNaN() {
return v.isNaN();
}
/** {@inheritDoc} */
@Override
public boolean isInfinite() {
return v.isInfinite();
}
/** {@inheritDoc} */
@Override
public RealVector combine(double a, double b, RealVector y) {
return v.combine(a, b, y);
}
/** {@inheritDoc} */
@Override
public RealVector combineToSelf(double a, double b, RealVector y) {
throw new MathUnsupportedOperationException();
}
/** An entry in the vector. */
class UnmodifiableEntry extends Entry {
/** {@inheritDoc} */
@Override
public double getValue() {
return v.getEntry(getIndex());
}
/** {@inheritDoc} */
@Override
public void setValue(double value) {
throw new MathUnsupportedOperationException();
}
}
};
}