|
Orbital library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Vector
Represents a mathematical vector of any dimension n.
v∈V=Rn, v = (v0,v1,v2,…,vn-1)T = | ( | v0 | ) |
v1 | |||
⋮ | |||
vn-1 |
The components vi∈R are any arithmetic objects forming a ring. (Rn,+,·) form a (free) R-module with the law of composition + and the law of action ·. If R is a field the vectors even form a vector space over R, which justifies the name vector. If R is an integrity domain, then Rn≅Rm ⇔ n=m.
(1) | (V,+) is an Abelian group with the law of composition | |
+:V×V→V; (v,w)↦v+w | ||
(2) | ·:R×V→V; (λ,v)↦λ·v is a law of action (the scalar multiplication · or sometimes ·) | |
("a") | λ·(μ·v) = (λ⋅μ)·v | |
("d") | (λ+μ)·v = λ·v + μ·v | |
("d") | λ·(v+w) = λ·v + λ·w | |
("n") | 1·v = v |
If you intend to use mutable arithmetic elements, note the discussion of
mutations per reference vs. explicit cloning in Tensor.set(int[],Arithmetic)
which generally holds for all operations that set component values.
Also note that some few methods will change its instance and explicitly return this
to allow chaining of structural changes,
whilst arithmetic methods will leave a vector unchanged but return a modified version.
Refer to the documentation of the individual methods for details.
ValueFactory.tensor(Arithmetic[])
,
ValueFactory.valueOf(Arithmetic[])
,
ValueFactory.valueOf(double[])
Field Summary |
---|
Fields inherited from interface orbital.math.Arithmetic |
---|
numerical |
Method Summary | |
---|---|
Vector |
add(Vector b)
Adds two vectors returning a vector. |
Vector |
cross(Vector b)
Vector-cross-product of two vectors. |
int |
dimension()
Returns the dimension of the vector. |
Arithmetic |
get(int i)
Returns the value at the component specified by index. |
Vector |
insert(Arithmetic v)
Append a value to this vector. |
Vector |
insert(int index,
Arithmetic v)
Insert a value into this vector at the specified index. |
Vector |
insertAll(int index,
Vector v)
Insert all components of a vector into this vector at the specified index. |
Vector |
insertAll(Vector v)
Append all components of a vector to this vector. |
java.util.ListIterator |
iterator()
Returns an iterator over all components. |
Vector |
multiply(Matrix B)
Multiplies a vector with a matrix returning a vector. |
Vector |
multiply(Scalar s)
Multiplies a vector with a scalar returning a vector. |
Arithmetic |
multiply(Vector b)
Scalar-dot-product 〈·,·〉:V×V→F of two vectors. |
Real |
norm(double p)
Returns the norm || ||p of this vector. |
Vector |
remove(int index)
Remove the component at an index from this vector. |
Vector |
scale(Scalar s)
Multiplies a vector with a scalar returning a vector. |
void |
set(int i,
Arithmetic vi)
Sets a value at the component specified by index. |
Vector |
subtract(Vector b)
Subtracts two vectors returning a vector. |
Vector |
subVector(int i1,
int i2)
Get a sub-vector view ranging (i1:i2) inclusive. |
Arithmetic[] |
toArray()
Returns an array containing all the elements in this vector. |
Matrix |
transpose()
Returns this vector transposed. |
Methods inherited from interface orbital.math.Tensor |
---|
add, clone, dimensions, entries, get, indices, multiply, rank, set, setSubTensor, subTensor, subTensor, subTensorTransposed, subtract, tensor |
Methods inherited from interface orbital.math.Arithmetic |
---|
add, divide, equals, inverse, isOne, isZero, minus, multiply, one, power, scale, subtract, toString, valueFactory, zero |
Methods inherited from interface orbital.math.Normed |
---|
norm |
Method Detail |
---|
int dimension()
n
of elements contained.
Arithmetic get(int i)
Of course, this method only has a meaning for free modules like vector spaces.
void set(int i, Arithmetic vi) throws java.lang.UnsupportedOperationException
Of course, this method only has a meaning for free modules like vector spaces.
java.lang.UnsupportedOperationException
- if this vector is constant and does not allow modifications.java.util.ListIterator iterator()
iterator
in interface Tensor
Vector subVector(int i1, int i2)
The returned vector is a structurally unmodifiable view.
Real norm(double p)
This method implements p-norms, where
||x||p = (|x1|p + … + |xn|p)1/p.
||x||∞ = max {|x1|,…,|xn|}.
Vector add(Vector b)
Vector subtract(Vector b)
Arithmetic multiply(Vector b)
〈·,·〉:V×V→R is a real scalar product and V a euclidian vector space, if ∀x,y∈V:
(bl) | 〈.,y〉 and 〈x,.〉 are linear | "bilinear" |
(s) | 〈x,y〉 = 〈y,x〉 | "symmetric" (this method is commutative) |
(pdef) | 〈x,x〉≥0 and 〈x,x〉=0 ⇔ x=0 | "positive definite" |
〈·,·〉:V×V→C is a complex scalar product and V a unitarian vector space, if ∀x,y∈V:
(ll) | 〈·,y〉 is linear | "left-linear" |
(h) | 〈x,y〉 = 〈y,x〉 | "hermite" |
(pdef) | 〈x,x〉≥0 and 〈x,x〉=0 ⇔ x=0 | "positive definite" |
A scalar product 〈·,·〉 induces a norm ||.||:V→[0,∞); x ↦ ||x|| := √〈x,x〉
The standard scalar-product which will often be implemented, is
(x,y) ↦ 〈x,y〉 = xT·y = ∑i=0n-1 xi⋅yi.
It belongs to the euclidian 2-norm and is the inner product of vectors.
Normed
Vector scale(Scalar s)
Vector multiply(Scalar s)
scale(Scalar)
Vector multiply(Matrix B)
v
is sized n
and
the matrix A
is sized n×m
,
the resulting row-vector v∙A
is sized m
.
This is an inner product.
Vector cross(Vector b)
cross is antisymmetric: y×x = -(x×y)
Matrix transpose()
Matrix.transpose()
Vector insert(int index, Arithmetic v)
Vector insertAll(int index, Vector v)
Vector insert(Arithmetic v)
Vector insertAll(Vector v)
Vector remove(int index)
Arithmetic[] toArray()
Object.clone()
|
Orbital library 1.3.0: 11 Apr 2009 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |