|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectucar.ma2.MAVector
public class MAVector
Abstraction for vector operations. A vector is a rank-1 Array. All operations done in double precision (??)
Constructor Summary | |
---|---|
MAVector(Array a)
Create an MAVector using the given rank-1 array. |
|
MAVector(double[] values)
Create an MAVector out of a double array |
|
MAVector(int nelems)
Create an MAVector of the given length. |
Method Summary | |
---|---|
MAVector |
copy()
Create a new MAVector that is the same as this one, with a copy of the backing store. |
double |
cos(MAVector v)
Cos between two vectors = dot(v) / norm() * norm(v) |
double |
dot(MAVector v)
Dot product of 2 vectors |
double |
getDouble(int i)
|
int |
getNelems()
|
double |
norm()
Get the L2 norm of this vector. |
void |
normalize()
Normalize this vector, so it has norm = 1.0. |
void |
setDouble(int i,
double val)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MAVector(double[] values)
public MAVector(int nelems)
public MAVector(Array a)
a
- rank-1 array
java.lang.IllegalArgumentException
- is a is not rank 1Method Detail |
---|
public int getNelems()
public double getDouble(int i)
public void setDouble(int i, double val)
public MAVector copy()
public double cos(MAVector v)
v
- cosine with this vector
java.lang.IllegalArgumentException
- if nelems != v.getNelems().public double dot(MAVector v)
v
- dot product with this vector
java.lang.IllegalArgumentException
- if nelems != v.getNelems().public double norm()
public void normalize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |