hama-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Edward J. Yoon" <edwardy...@apache.org>
Subject Re: Implementation of DoubleVector/DenseDoubleVector/SparseDoubleVector
Date Mon, 03 Mar 2014 05:44:13 GMT
> 4. Is the toArray method available for SparseDoubleVector? In my opinion,
> it is better not to do that.

I think SparseDoubleVector can be represented by index/value pairs.
And, toArray can be implemented like:

public double[] toArray() {
  double[] arr = new double[size];
  for(Element e : vector) {
    arr[e.getIndex()] = e.getValue();
  }
}

For bit vector, java.util.BitSet can be used.

On Tue, Feb 25, 2014 at 6:14 AM, Yexi Jiang <yxjiang@apache.org> wrote:
> Hi, All,
>
> I am currently working on the SparseDoubleVector (HAMA-863) and found some
> unclear places about the vector implementation.
>
> 1. What is the definition for a vector? According to the implementation, it
> is implemented as elementwise sqrt. In such a case, problem will occur if
> the one of the entry is negative.
>
> 2. Most of the operators are conducted on a copy of the current object. Do
> we also need to provide a set of operators that directly modify the current
> object itself? e.g. addOriginal, subtractOriginal, etc.
>
> 3. When a DenseDoubleVector operates with a SparseDoubleVector, what will
> be the concrete type of the result object? A simple implementation is to
> always return a SparseDoubleVector, even if it is dense. A complex
> implementation is we maintain a sparsity ratio (the ratio of non-default
> entries), if the ratio exceed a threshold, a DenseDoubleVector will be
> returned.
>
> 4. Is the toArray method available for SparseDoubleVector? In my opinion,
> it is better not to do that.
>
>
> Regards,
> Yexi



-- 
Edward J. Yoon (@eddieyoon)
Chief Executive Officer
DataSayer, Inc.

Mime
View raw message