org.apache.spark.util
Class Vector

Object
  extended by org.apache.spark.util.Vector
All Implemented Interfaces:
java.io.Serializable

public class Vector
extends Object
implements scala.Serializable

See Also:
Serialized Form

Nested Class Summary
static class Vector.Multiplier
           
static class Vector.VectorAccumParam$
           
 
Constructor Summary
Vector(double[] elements)
           
 
Method Summary
 Vector add(Vector other)
           
 Vector addInPlace(Vector other)
           
 double apply(int index)
           
 double dist(Vector other)
           
 Vector divide(double d)
           
 double dot(Vector other)
           
static Vector.Multiplier doubleToMultiplier(double num)
           
 double[] elements()
           
 int length()
           
 Vector multiply(double d)
           
static Vector ones(int length)
           
 double plusDot(Vector plus, Vector other)
          return (this + plus) dot other, but without creating any intermediate storage
static Vector random(int length, scala.util.Random random)
          Creates this Vector of given length containing random numbers between 0.0 and 1.0.
 double squaredDist(Vector other)
           
 Vector subtract(Vector other)
           
 double sum()
           
 String toString()
           
static Vector zeros(int length)
           
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Vector

public Vector(double[] elements)
Method Detail

zeros

public static Vector zeros(int length)

ones

public static Vector ones(int length)

random

public static Vector random(int length,
                            scala.util.Random random)
Creates this Vector of given length containing random numbers between 0.0 and 1.0. Optional scala.util.Random number generator can be provided.

Parameters:
length - (undocumented)
random - (undocumented)
Returns:
(undocumented)

doubleToMultiplier

public static Vector.Multiplier doubleToMultiplier(double num)

elements

public double[] elements()

length

public int length()

apply

public double apply(int index)

add

public Vector add(Vector other)

subtract

public Vector subtract(Vector other)

dot

public double dot(Vector other)

plusDot

public double plusDot(Vector plus,
                      Vector other)
return (this + plus) dot other, but without creating any intermediate storage

Parameters:
plus -
other -
Returns:

addInPlace

public Vector addInPlace(Vector other)

multiply

public Vector multiply(double d)

divide

public Vector divide(double d)

sum

public double sum()

squaredDist

public double squaredDist(Vector other)

dist

public double dist(Vector other)

toString

public String toString()
Overrides:
toString in class Object