类 MAVector
- java.lang.Object
-
- org.meteoinfo.ndarray.MAVector
-
public class MAVector extends java.lang.ObjectAbstraction for vector operations. A vector is a rank-1 Array. All operations done in double precision- 作者:
-
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 MAVectorcopy()Create a new MAVector that is the same as this one, with a copy of the backing store.doublecos(MAVector v)Cos between two vectors = dot(v) / norm() * norm(v)doubledot(MAVector v)Dot product of 2 vectorsdoublegetDouble(int i)intgetNelems()doublenorm()Get the L2 norm of this vector.voidnormalize()Normalize this vector, so it has norm = 1.0.voidsetDouble(int i, double val)
-
-
-
构造器详细资料
-
MAVector
public MAVector(double[] values)
Create an MAVector out of a double array
-
MAVector
public MAVector(int nelems)
Create an MAVector of the given length.
-
MAVector
public MAVector(Array a)
Create an MAVector using the given rank-1 array.- 参数:
a- rank-1 array- 抛出:
java.lang.IllegalArgumentException- is a is not rank 1
-
-
方法详细资料
-
getNelems
public int getNelems()
-
getDouble
public double getDouble(int i)
-
setDouble
public void setDouble(int i, double val)
-
copy
public MAVector copy()
Create a new MAVector that is the same as this one, with a copy of the backing store.
-
cos
public double cos(MAVector v)
Cos between two vectors = dot(v) / norm() * norm(v)- 参数:
v- cosine with this vector- 返回:
- double result: cos between this and v
- 抛出:
java.lang.IllegalArgumentException- if nelems != v.getNelems().
-
dot
public double dot(MAVector v)
Dot product of 2 vectors- 参数:
v- dot product with this vector- 返回:
- double result: dot product
- 抛出:
java.lang.IllegalArgumentException- if nelems != v.getNelems().
-
norm
public double norm()
Get the L2 norm of this vector.- 返回:
- double norm
-
normalize
public void normalize()
Normalize this vector, so it has norm = 1.0.
-
-