org.apache.spark.util
Class Vector
Object
org.apache.spark.util.Vector
- All Implemented Interfaces:
- java.io.Serializable
public class Vector
- extends Object
- implements scala.Serializable
- See Also:
- Serialized Form
Constructor Summary |
Vector(double[] elements)
|
Methods inherited from class Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Vector
public Vector(double[] elements)
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