## org.apache.mahout.math
Class WeightedVector

    java.lang.Object
      org.apache.mahout.math.DelegatingVector
          org.apache.mahout.math.WeightedVector

All Implemented Interfaces:
  Cloneable, Vector

Direct Known Subclasses:
  Centroid

    public class WeightedVector

extends DelegatingVector

Decorates a vector with a floating point weight and an index.

Nested Class Summary

Nested classes/interfaces inherited from interface org.apache.mahout.math.Vector
`Vector.Element`

Field Summary

Fields inherited from class org.apache.mahout.math.DelegatingVector
`delegate`

Constructor Summary
`protected` `WeightedVector(double weight, int index)`
`` `WeightedVector(Vector v, double weight, int index)`
`` `WeightedVector(Vector v, Vector projection, int index)`

Method Summary
`WeightedVector` `clone()` Return a copy of the recipient
`int` `getIndex()`
`double` `getWeight()`
`Vector` `like()` Return an empty vector of the same underlying class as the receiver
`static WeightedVector` `project(Vector v, Vector projection)`
`static WeightedVector` `project(Vector v, Vector projection, int index)`
`void` `setIndex(int index)`
`void` `setWeight(double newWeight)`
`String` `toString()`

Methods inherited from class org.apache.mahout.math.DelegatingVector

`aggregate, aggregate, all, asFormatString, assign, assign, assign, assign, assign, assign, cross, divide, dot, equals, get, getDistanceSquared, getElement, getIteratorAdvanceCost, getLengthSquared, getLookupCost, getNumNondefaultElements, getNumNonZeroElements, getQuick, getVector, hashCode, incrementQuick, invalidateCachedLength, isAddConstantTime, isDense, isSequentialAccess, logNormalize, logNormalize, maxValue, maxValueIndex, mergeUpdates, minus, minValue, minValueIndex, nonZeroes, norm, normalize, normalize, plus, plus, set, setQuick, size, times, times, viewPart, zSum`

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

Constructor Detail

### WeightedVector

    protected WeightedVector(double weight,
                             int index)

### WeightedVector

    public WeightedVector(Vector v,
                          double weight,
                          int index)

### WeightedVector

    public WeightedVector(Vector v,
                          Vector projection,
                          int index)

Method Detail

### project

    public static WeightedVector project(Vector v,
                                         Vector projection)

### project

    public static WeightedVector project(Vector v,
                                         Vector projection,
                                         int index)

### getWeight

    public double getWeight()

### getIndex

    public int getIndex()

### setWeight

    public void setWeight(double newWeight)

### setIndex

    public void setIndex(int index)

### like

    public Vector like()

  Description copied from interface: `Vector`
  Return an empty vector of the same underlying class as the receiver

  Specified by:
    `like` in interface `Vector`
  Overrides:
    `like` in class `DelegatingVector`
  Returns:
    a Vector

### toString

    public String toString()

  Overrides:
    `toString` in class `DelegatingVector`

### clone

    public WeightedVector clone()

  Description copied from interface: `Vector`
  Return a copy of the recipient

  Specified by:
    `clone` in interface `Vector`
  Overrides:
    `clone` in class `DelegatingVector`
  Returns:
    a new Vector

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