Example usage for org.apache.mahout.math SequentialAccessSparseVector setQuick

List of usage examples for org.apache.mahout.math SequentialAccessSparseVector setQuick

Introduction

In this page you can find the example usage for org.apache.mahout.math SequentialAccessSparseVector setQuick.

Prototype

@Override
public void setQuick(int index, double value) 

Source Link

Document

Warning!

Usage

From source file:de.isabeldrostfromm.sof.util.Vectors.java

License:Open Source License

/**
 * Creates a new SequentialSparseAccessVector and assigns the given values one after another to it.
 * *///from   w  ww.  j a v a  2s  .c  om
public static SequentialAccessSparseVector newSequentialAccessSparseVector(double... ds) {
    SequentialAccessSparseVector result = new SequentialAccessSparseVector(ds.length);
    for (int i = 0; i < ds.length; i++) {
        result.setQuick(i, ds[i]);
    }
    return result;
}

From source file:de.isabeldrostfromm.sof.util.VectorsTest.java

License:Open Source License

private SequentialAccessSparseVector randomVector() {
    int length = atMost(100);
    SequentialAccessSparseVector vec = new SequentialAccessSparseVector(length);
    for (int i = 0; i < length; i++) {
        vec.setQuick(i, randomDouble());
    }// w w w. j a  v a2 s .c o m
    return vec;
}