## org.apache.mahout.math
Class VectorWritable

    java.lang.Object
      org.apache.hadoop.conf.Configured
          org.apache.mahout.math.VectorWritable

All Implemented Interfaces:
  org.apache.hadoop.conf.Configurable, org.apache.hadoop.io.Writable

    public final class VectorWritable

extends org.apache.hadoop.conf.Configured
implements org.apache.hadoop.io.Writable

Field Summary
`static int` `FLAG_DENSE`
`static int` `FLAG_LAX_PRECISION`
`static int` `FLAG_NAMED`
`static int` `FLAG_SEQUENTIAL`
`static int` `NUM_FLAGS`

Constructor Summary
`VectorWritable()`
`VectorWritable(boolean writesLaxPrecision)`
`VectorWritable(Vector vector)`
`VectorWritable(Vector vector, boolean writesLaxPrecision)`

Method Summary
`boolean` `equals(Object o)`
`Vector` `get()`
`int` `hashCode()`
`boolean` `isWritesLaxPrecision()`
`static VectorWritable` `merge(Iterator<VectorWritable> vectors)`
`static Vector` `mergeToVector(Iterator<VectorWritable> vectors)`
`void` `readFields(DataInput in)`
`static Vector` `readVector(DataInput in)`
`void` `set(Vector vector)`
`void` `setWritesLaxPrecision(boolean writesLaxPrecision)`
`String` `toString()`
`void` `write(DataOutput out)`
`static void` `writeVector(DataOutput out, Vector vector)` Write the vector to the output
`static void` `writeVector(DataOutput out, Vector vector, boolean laxPrecision)`

Methods inherited from class org.apache.hadoop.conf.Configured
`getConf, setConf`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### FLAG_DENSE

    public static final int FLAG_DENSE

See Also:
  Constant Field Values

### FLAG_SEQUENTIAL

    public static final int FLAG_SEQUENTIAL

See Also:
  Constant Field Values

### FLAG_NAMED

    public static final int FLAG_NAMED

See Also:
  Constant Field Values

### FLAG_LAX_PRECISION

    public static final int FLAG_LAX_PRECISION

See Also:
  Constant Field Values

### NUM_FLAGS

    public static final int NUM_FLAGS

See Also:
  Constant Field Values

Constructor Detail

### VectorWritable

    public VectorWritable()

### VectorWritable

    public VectorWritable(boolean writesLaxPrecision)

### VectorWritable

    public VectorWritable(Vector vector)

### VectorWritable

    public VectorWritable(Vector vector,
                          boolean writesLaxPrecision)

Method Detail

### get

    public Vector get()

  Returns:
    `Vector` that this is to write, or has just read

### set

    public void set(Vector vector)

### isWritesLaxPrecision

    public boolean isWritesLaxPrecision()

  Returns:
    true if this is allowed to encode `Vector` values using fewer bytes, possibly losing precision. In particular this means that floating point values will be encoded as floats, not doubles.

### setWritesLaxPrecision

    public void setWritesLaxPrecision(boolean writesLaxPrecision)

### write

    public void write(DataOutput out)
               throws IOException

  Specified by:
    `write` in interface `org.apache.hadoop.io.Writable`
  Throws:
    `IOException`

### readFields

    public void readFields(DataInput in)
                    throws IOException

  Specified by:
    `readFields` in interface `org.apache.hadoop.io.Writable`
  Throws:
    `IOException`

### writeVector

    public static void writeVector(DataOutput out,
                                   Vector vector)
                            throws IOException

  Write the vector to the output

  Throws:
    `IOException`

### writeVector

    public static void writeVector(DataOutput out,
                                   Vector vector,
                                   boolean laxPrecision)
                            throws IOException

  Throws:
    `IOException`

### readVector

    public static Vector readVector(DataInput in)
                             throws IOException

  Throws:
    `IOException`

### merge

    public static VectorWritable merge(Iterator<VectorWritable> vectors)

### mergeToVector

    public static Vector mergeToVector(Iterator<VectorWritable> vectors)

### equals

    public boolean equals(Object o)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.