Package edu.cmu.tetrad.util
Class Vector
java.lang.Object
edu.cmu.tetrad.util.Vector
- All Implemented Interfaces:
TetradSerializable,Serializable
Vector wrapping matrix library.
- Version:
- $Id: $Id
- Author:
- josephramsey
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidassign(double value) assign.voidassign.copy()copy.diag()diag.doubledot.doubledotProduct(Vector v2) dotProduct.booleandoubleget(int i) get.getSelection(int[] selection) viewSelection.like()like.minus.plus.scalarMult(double scalar) scalarMult.static VectorGenerates a simple exemplar of this class to test serialization.voidset(int j, double v) set.intsize()size.double[]toArray()toArray.toString()toString.
-
Constructor Details
-
Vector
public Vector(double[] data) Constructs a new Vector object from an array of double values.- Parameters:
data- the array of double values used to initialize the Vector object
-
Vector
public Vector(org.apache.commons.math3.linear.RealVector v) Creates a new Vector object from a RealVector object.- Parameters:
v- the RealVector object to be used for creating the Vector object
-
Vector
public Vector(int size) Constructs a new Vector object with the specified size.- Parameters:
size- the size of the vector- Throws:
IllegalArgumentException- if the size is negative
-
-
Method Details
-
serializableInstance
-
assign
public void assign(double value) assign.
- Parameters:
value- a double
-
assign
-
copy
-
diag
-
dotProduct
-
get
public double get(int i) get.
- Parameters:
i- a int- Returns:
- a double
-
like
-
minus
-
plus
-
scalarMult
-
set
public void set(int j, double v) set.
- Parameters:
j- a intv- a double
-
size
public int size()size.
- Returns:
- a int
-
toArray
public double[] toArray()toArray.
- Returns:
- an array of objects
-
toString
-
getSelection
-
equals
-
dot
-