public class DoubleSparseVector extends Object implements org.apache.hadoop.io.Writable
Constructor and Description |
---|
DoubleSparseVector()
Create a new vector with default size.
|
DoubleSparseVector(int size)
Create a new vector with given size.
|
Modifier and Type | Method and Description |
---|---|
void |
add(DoubleSparseVector other)
Add the vector specified.
|
void |
add(int key,
double value)
Increment value for a given key
|
void |
clear()
Clear the contents of the vector.
|
double |
get(int i)
Get a particular entry of the vector.
|
void |
readFields(DataInput in) |
void |
set(int i,
double value)
Set the given value to the entry specified.
|
void |
write(DataOutput out) |
public DoubleSparseVector()
public DoubleSparseVector(int size)
size
- the size of the vectorpublic double get(int i)
i
- the entrypublic void set(int i, double value)
i
- the entryvalue
- the value to set to the entrypublic void add(int key, double value)
key
- Keyvalue
- Incrementpublic void clear()
public void add(DoubleSparseVector other)
other
- the vector to add.public void write(DataOutput out) throws IOException
write
in interface org.apache.hadoop.io.Writable
IOException
public void readFields(DataInput in) throws IOException
readFields
in interface org.apache.hadoop.io.Writable
IOException
Copyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.