VectorInfo info = null;
if (r.hasInfo())
info = r.readVectorInfo();
else
info = new VectorInfo(true, VectorField.Real);
VectorSize size = r.readVectorSize(info);
// Resize the vector to correct size
this.size = size.size();
data = new double[size.size()];
// Check that the vector is in an acceptable format
if (info.isPattern())
throw new UnsupportedOperationException(
"Pattern vectors are not supported");
if (info.isComplex())
throw new UnsupportedOperationException(
"Complex vectors are not supported");
// Read the entries
if (info.isCoordinate()) {
// Read coordinate data
int nz = size.numEntries();
int[] index = new int[nz];
double[] entry = new double[nz];
r.readCoordinate(index, entry);
// Shift indices from 1-offset to 0-offset