public class FloatDenseVector extends Object implements org.apache.hadoop.io.Writable
Constructor and Description |
---|
FloatDenseVector()
Create a new vector with default size.
|
FloatDenseVector(int size)
Create a new vector with given size.
|
Modifier and Type | Method and Description |
---|---|
void |
add(FloatDenseVector other)
Add the vector specified.
|
float |
get(int i)
Get a particular entry of the vector.
|
int |
getSingletonIndex()
Get the singleton index.
|
float |
getSingletonValue()
Get the singleton value.
|
void |
readFields(DataInput in) |
void |
set(int i,
float value)
Set the given value to the entry with the index specified.
|
void |
setSingleton(int index,
float value)
Set the singleton index and value.
|
void |
write(DataOutput out) |
public FloatDenseVector()
public FloatDenseVector(int size)
size
- the size of the vectorpublic void setSingleton(int index, float value)
index
- the indexvalue
- the valuepublic int getSingletonIndex()
public float getSingletonValue()
public float get(int i)
i
- the entrypublic void set(int i, float value)
i
- the entryvalue
- the value to set to the entrypublic void add(FloatDenseVector 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.