|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.vector.doubles.dense.DenseVector
com.numericalmethod.suanshu.vector.doubles.dense.operation.Basis
public class Basis
A basis is a set of linearly independent vectors spanning a vector space. Every element in this space can be uniquely represented by a linear combination of elements in the basis.
This class implements the standard basis in the Euclidean Rn space.
| Field Summary |
|---|
| Fields inherited from class com.numericalmethod.suanshu.vector.doubles.dense.DenseVector |
|---|
length |
| Constructor Summary | |
|---|---|
Basis(int dim,
int i)
Construct a vector which corresponds to the i-th dimension in Rn. |
|
| Method Summary | |
|---|---|
double |
angle(Vector that)
Measure the angle between this and that. |
static VectorList |
basis(int dim)
Get the full set of standard basis vectors. |
static VectorList |
basis(int dim,
int ncols)
Get a subset of standard basis vectors. |
double |
norm()
Compute the length or magnitude or Euclidean norm of a vector, namely, ||v||. |
Vector |
opposite()
Get the opposite of this vector. |
Vector |
scaled(Real scalar)
scalar * that
If scalar is 1, it simply returns itself. |
| Methods inherited from class com.numericalmethod.suanshu.vector.doubles.dense.DenseVector |
|---|
add, add, add, as, deepCopy, divide, divide, equals, get, hashCode, innerProduct, minus, minus, minus, multiply, multiply, norm, pow, scaled, set, set, size, toArray, toString, ZERO |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Basis(int dim,
int i)
| 0 |
| ... |
| 1 | <-- the i-th entry
| ... |
| 0 |
dim - the dimensioni - the i-th dimension in Rn| Method Detail |
|---|
public static VectorList basis(int dim)
dim - the dimension
public static VectorList basis(int dim,
int ncols)
dim - the dimensionncols - number of basis vectors requested; it must be smaller than dim
java.lang.IllegalArgumentException - if there are more columns requested than the dimensionpublic Vector scaled(Real scalar)
Vectorscalar * that
If scalar is 1, it simply returns itself.
So, here is a way to get a unit version of the vector:
vector.scaled(1. / vector.norm())
scaled in interface VectorSpace<Vector,Real>scaled in interface Vectorscalar - a Real number scalar
scalarpublic Vector opposite()
Vector
opposite in interface AbelianGroup<Vector>opposite in interface Vector-vpublic double angle(Vector that)
Vectorthis and that.
That is,
this ∙ that = ||this|| * ||that|| cos(angle)
angle in interface HilbertSpace<Vector,Real>angle in interface Vectorthat - a vector
this and thatpublic double norm()
Vector||v||.
norm in interface BanachSpace<Vector,Real>norm in interface Vector
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||