Package edu.jas.vector
Class GenVector<C extends RingElem<C>>
- java.lang.Object
-
- edu.jas.vector.GenVector<C>
-
- All Implemented Interfaces:
AbelianGroupElem<GenVector<C>>
,Element<GenVector<C>>
,ModulElem<GenVector<C>,C>
,java.io.Serializable
,java.lang.Comparable<GenVector<C>>
public class GenVector<C extends RingElem<C>> extends java.lang.Object implements ModulElem<GenVector<C>,C>
GenVector implements generic vectors with RingElem entries. Vectors of n columns over C.- Author:
- Heinz Kredel
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description GenVectorModul<C>
modul
java.util.List<C>
val
-
Constructor Summary
Constructors Constructor Description GenVector(GenVectorModul<C> m)
Constructor for zero GenVector.GenVector(GenVectorModul<C> m, C[] v)
Constructor for GenVector.GenVector(GenVectorModul<C> m, java.util.List<C> v)
Constructor for GenVector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GenVector<C>
abs()
Absolute value of this vector.int
compareTo(GenVector<C> b)
compareTo, lexicographical comparison.GenVector<C>
copy()
clone method.boolean
equals(java.lang.Object other)
equals method.GenVectorModul<C>
factory()
Get the corresponding element factory.C
get(int i)
get element.int
hashCode()
Hash code for this GenVector.boolean
isZERO()
test if this is equal to a zero vector.GenVector<C>
leftLinearCombination(C s, C t, GenVector<C> b)
left linear combination of this vector with scalar multiple of other vector.GenVector<C>
leftScalarMultiply(C s)
Left product of this vector with scalar.GenVector<C>
linearCombination(C t, GenVector<C> b)
Left linear combination of this vector with scalar multiple of other vector.GenVector<C>
linearCombination(C s, GenVector<C> b, C t)
Linear combination of this vector with scalar multiple of other vector.GenVector<C>
linearCombination(GenVector<C> b, C t)
Linear combination of this vector with scalar multiple of other vector.GenVector<C>
multiply(C s)
Product of this vector with scalar.GenVector<C>
negate()
Negative of this vector.GenVector<C>
rightScalarProduct(java.util.List<GenVector<C>> B)
right scalar / dot product of this vector with list of other vectors.GenVector<C>
scalarMultiply(C s)
Product of this vector with scalar.C
scalarProduct(GenVector<C> b)
scalar / dot product of this vector with other vector.GenVector<C>
scalarProduct(java.util.List<GenVector<C>> B)
scalar / dot product of this vector with list of other vectors.C
setMutate(int i, C e)
set element, mutate this.int
signum()
sign of vector.GenVector<C>
subtract(GenVector<C> b)
Difference of vectors.GenVector<C>
sum(GenVector<C> b)
Sum of vectors.java.lang.String
toScript()
Get a scripting compatible string representation.java.lang.String
toScriptFactory()
Get a scripting compatible string representation of the factory.java.lang.String
toString()
Get the String representation as RingElem.
-
-
-
Constructor Detail
-
GenVector
public GenVector(GenVectorModul<C> m)
Constructor for zero GenVector.
-
GenVector
public GenVector(GenVectorModul<C> m, java.util.List<C> v)
Constructor for GenVector.
-
GenVector
public GenVector(GenVectorModul<C> m, C[] v)
Constructor for GenVector.
-
-
Method Detail
-
toString
public java.lang.String toString()
Get the String representation as RingElem.- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
toScript
public java.lang.String toScript()
Get a scripting compatible string representation.
-
toScriptFactory
public java.lang.String toScriptFactory()
Get a scripting compatible string representation of the factory.- Specified by:
toScriptFactory
in interfaceElement<C extends RingElem<C>>
- Returns:
- script compatible representation for this ElemFactory.
- See Also:
Element.toScriptFactory()
-
factory
public GenVectorModul<C> factory()
Get the corresponding element factory.
-
isZERO
public boolean isZERO()
test if this is equal to a zero vector.- Specified by:
isZERO
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Returns:
- true if this is 0, else false.
-
equals
public boolean equals(java.lang.Object other)
equals method.
-
hashCode
public int hashCode()
Hash code for this GenVector.
-
setMutate
public C setMutate(int i, C e)
set element, mutate this.- Parameters:
i
- indexe
- value- Returns:
- this with this(i) = e.
-
signum
public int signum()
sign of vector.- Specified by:
signum
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Returns:
- 1 if (this < 0), 0 if (this == 0) or -1 if (this > 0).
-
sum
public GenVector<C> sum(GenVector<C> b)
Sum of vectors.- Specified by:
sum
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Parameters:
b
- other vector.- Returns:
- this+b
-
subtract
public GenVector<C> subtract(GenVector<C> b)
Difference of vectors.- Specified by:
subtract
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Parameters:
b
- other vector.- Returns:
- this-b
-
negate
public GenVector<C> negate()
Negative of this vector.- Specified by:
negate
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Returns:
- -this
-
abs
public GenVector<C> abs()
Absolute value of this vector.- Specified by:
abs
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Returns:
- abs(this)
-
multiply
public GenVector<C> multiply(C s)
Product of this vector with scalar.- Parameters:
s
- scalar.- Returns:
- this*s
-
scalarMultiply
public GenVector<C> scalarMultiply(C s)
Product of this vector with scalar.
-
leftScalarMultiply
public GenVector<C> leftScalarMultiply(C s)
Left product of this vector with scalar.- Parameters:
s
- scalar.- Returns:
- s*this
-
linearCombination
public GenVector<C> linearCombination(C s, GenVector<C> b, C t)
Linear combination of this vector with scalar multiple of other vector.
-
linearCombination
public GenVector<C> linearCombination(GenVector<C> b, C t)
Linear combination of this vector with scalar multiple of other vector.
-
linearCombination
public GenVector<C> linearCombination(C t, GenVector<C> b)
Left linear combination of this vector with scalar multiple of other vector.- Parameters:
b
- other vector.t
- scalar.- Returns:
- this+t*b
-
leftLinearCombination
public GenVector<C> leftLinearCombination(C s, C t, GenVector<C> b)
left linear combination of this vector with scalar multiple of other vector.- Parameters:
s
- scalar.b
- other vector.t
- scalar.- Returns:
- s*this+t*b
-
scalarProduct
public C scalarProduct(GenVector<C> b)
scalar / dot product of this vector with other vector.
-
scalarProduct
public GenVector<C> scalarProduct(java.util.List<GenVector<C>> B)
scalar / dot product of this vector with list of other vectors.
-
rightScalarProduct
public GenVector<C> rightScalarProduct(java.util.List<GenVector<C>> B)
right scalar / dot product of this vector with list of other vectors.- Parameters:
B
- list of vectors.- Returns:
- b * this
-
-