Example usage for org.apache.commons.math3.linear SparseRealVector setEntry

List of usage examples for org.apache.commons.math3.linear SparseRealVector setEntry

Introduction

In this page you can find the example usage for org.apache.commons.math3.linear SparseRealVector setEntry.

Prototype

public abstract void setEntry(int index, double value) throws OutOfRangeException;

Source Link

Document

Set a single element.

Usage

From source file:edu.byu.nlp.dataset.BasicSparseFeatureVector.java

@Override
public SparseRealVector asApacheSparseRealVector() {
    SparseRealVector retval = new OpenMapRealVector(length());
    for (int i = 0; i < indices.length; i++) {
        retval.setEntry(indices[i], values[i]);
    }/*from  w  ww  . jav a 2 s  .  c  om*/
    return retval;
}