public class MultidimensionalDoubleFV extends DoubleFV implements Serializable, Cloneable, FeatureVector
Modifier and Type | Field and Description |
---|---|
int[] |
nbins
Array containing the number of bins in each dimension
|
values
Constructor and Description |
---|
MultidimensionalDoubleFV()
Construct an empty feature vector
|
MultidimensionalDoubleFV(double[][] values)
Construct from 2-dimensional array
|
MultidimensionalDoubleFV(double[][][] values)
Construct from 3-dimensional array
|
MultidimensionalDoubleFV(double[] values,
int... nbins)
Construct from flattened values array and dimensions
|
MultidimensionalDoubleFV(int... nbins)
Construct empty FV with given dimensions
|
Modifier and Type | Method and Description |
---|---|
String |
asciiHeader()
Header for ascii input.
|
MultidimensionalDoubleFV |
asDoubleFV()
Convert the FV to a DoubleFV representation
|
byte[] |
binaryHeader()
Header for binary input.
|
MultidimensionalDoubleFV |
clone() |
double |
compare(MultidimensionalDoubleFV h,
DoubleFVComparison method)
Compare this FV to another with the given method.
|
double |
get(int... coords)
Get the element at the given n-dimensional coordinate
|
double |
get(int x)
Get the element at the given flat index
|
int[] |
getCoordinates(int index)
Given an index, calculate the coordinate which would map to that index using
getIndex(int...) |
int |
getIndex(int... coords)
Convert the given coordinate into a flat index value
|
double[] |
getVector()
Get the underlying flat-vector representation
|
void |
readASCII(Scanner in)
Read internal state from in.
|
void |
readBinary(DataInput in)
Read internal state from in.
|
void |
set(double value,
int... coords)
Set the the element at the given n-dimensional coordinate
|
String |
toString() |
void |
writeASCII(PrintWriter out)
Write the content of this as ascii to out.
|
void |
writeBinary(DataOutput out)
Write the content of this as binary to out.
|
asDoubleVector, compare, concatenate, concatenate, equals, getAsDouble, hashCode, length, newInstance, normaliseFV, normaliseFV, normaliseFV, normaliseFV, setFromDouble, subvector, subvector
finalize, getClass, notify, notifyAll, wait, wait, wait
asDoubleVector, getAsDouble, length, newInstance, normaliseFV, normaliseFV, normaliseFV, normaliseFV, setFromDouble
public int[] nbins
public MultidimensionalDoubleFV()
public MultidimensionalDoubleFV(int... nbins)
nbins
- the number of bins in each dimensionpublic MultidimensionalDoubleFV(double[] values, int... nbins)
values
- the flat array of valuesnbins
- the number of bins in each dimensionpublic MultidimensionalDoubleFV(double[][] values)
values
- the 2d arraypublic MultidimensionalDoubleFV(double[][][] values)
values
- the 3d arraypublic double[] getVector()
getVector
in interface FeatureVector
getVector
in class ArrayFeatureVector<double[]>
public double get(int x)
public int getIndex(int... coords)
coords
- the coordinatepublic void set(double value, int... coords)
value
- the value to setcoords
- the coordinatespublic double get(int... coords)
coords
- the coordinatespublic MultidimensionalDoubleFV clone()
public MultidimensionalDoubleFV asDoubleFV()
asDoubleFV
in interface FeatureVector
asDoubleFV
in class DoubleFV
public double compare(MultidimensionalDoubleFV h, DoubleFVComparison method)
h
- the feature to compare against.method
- the method to compare with.public void writeBinary(DataOutput out) throws IOException
WriteableBinary
writeBinary
in interface WriteableBinary
writeBinary
in class DoubleFV
out
- sink to write toIOException
- an error writing to outpublic void writeASCII(PrintWriter out) throws IOException
WriteableASCII
writeASCII
in interface WriteableASCII
writeASCII
in class DoubleFV
out
- sink to write toIOException
- an error writing to outpublic void readBinary(DataInput in) throws IOException
ReadableBinary
readBinary
in interface ReadableBinary
readBinary
in class DoubleFV
in
- source to read from.IOException
- an error reading inputpublic void readASCII(Scanner in) throws IOException
ReadableASCII
readASCII
in interface ReadableASCII
readASCII
in class DoubleFV
in
- source to read from.IOException
- an error reading inputpublic byte[] binaryHeader()
ReadableBinary
binaryHeader
in interface ReadableBinary
binaryHeader
in interface WriteableBinary
binaryHeader
in class DoubleFV
public String asciiHeader()
ReadableASCII
asciiHeader
in interface ReadableASCII
asciiHeader
in interface WriteableASCII
asciiHeader
in class DoubleFV
public int[] getCoordinates(int index)
getIndex(int...)
index
-