* Creates a SparseIndexedVector using the given sorted Index to identify the indexes of non-zero values,
* and a double[] array to specify all the non-zero element values
*/
public static SparseIndexedVector create(int length, Index index, double[] data) {
if (!index.isDistinctSorted()) {
throw new VectorzException("Index must be sorted and distinct");
}
if (!(index.length()==data.length)) {
throw new VectorzException("Length of index: mismatch woth data");
}
return new SparseIndexedVector(length, index.clone(),DoubleArrays.copyOf(data));
}