Package edu.jas.poly
Class ExpVector
java.lang.Object
edu.jas.poly.ExpVector
- All Implemented Interfaces:
AbelianGroupElem<ExpVector>
,Element<ExpVector>
,Serializable
,Comparable<ExpVector>
- Direct Known Subclasses:
ExpVectorByte
,ExpVectorInteger
,ExpVectorLong
,ExpVectorShort
ExpVector implements exponent vectors for polynomials. Exponent vectors are
implemented as arrays of Java elementary types, like long, int, short and
byte. ExpVector provides also the familiar MAS static method names. The
implementation is only tested for nonnegative exponents but should work also
for negative exponents. Objects of this class are intended to be immutable,
but exponents can be set (during construction); also the hash code is only
computed once, when needed. The different storage unit implementations are
ExpVectorLong
ExpVectorInteger
,
ExpVectorShort
and ExpVectorByte
. The static
factory methods create()
of ExpVector
select the
respective storage unit. The selection of the desired storage unit is
internally done via the static variable storunit
. This variable
should not be changed dynamically.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Storage representation of exponent arrays. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract ExpVector
abs()
ExpVector absolute value.long
Returns the number of bits in the representation of this exponent vector.abstract ExpVector
Combine with ExpVector.int
ExpVector compareTo.abstract ExpVector
contract
(int i, int len) Contract variables.abstract ExpVector
copy()
Clone this.static final ExpVector
create
(int n) Factory constructor for ExpVector.static final ExpVector
create
(int n, int i, long e) Factory constructor for ExpVector.static final ExpVector
create
(long[] v) Internal factory constructor for ExpVector.static final ExpVector
Factory constructor for ExpVector.static final ExpVector
create
(Collection<Long> v) Factory constructor for ExpVector.long
degree()
ExpVector degree.abstract int[]
ExpVector dependency on variables.abstract int
ExpVector dependent variables.boolean
ExpVector divides test.boolean
Comparison with any other object.static final ExpVector
ExpVector absolute value.<C extends RingElem<C>>
Cevaluate
(RingFactory<C> cf, List<C> a) Evaluate.static final ExpVector
ExpVector difference.static final int[]
ExpVector dependency on variables.static final ExpVector
ExpVector greatest common divisor.static final int
Inverse graded lexicographical compare.static final int
Inverse graded lexicographical compare part.static final int
Inverse lexicographical compare.static final int
Inverse lexicographical compare part.static final int
Inverse total degree lexicographical compare.static final int
Inverse weighted lexicographical compare.static final int
Inverse weighted lexicographical compare part.static final ExpVector
ExpVector least common multiple.static final long
ExpVector maximal degree.static final long
ExpVector minimal degree.static final boolean
ExpVector multiple test.static final ExpVector
ExpVector negate.static final ExpVector
EVRAND
(int r, long k, float q) Generate a random ExpVector.static final ExpVector
Generate a random ExpVector.static final int
Reverse inverse graded lexicographical compare.static final int
Reverse inverse graded lexicographical compare part.static final int
Reverse inverse lexicographical compare.static final int
Reverse inverse lexicographical compare part.static final int
EVRLITDEGC
(ExpVector U, ExpVector V) Reverse lexicographical inverse total degree compare.static final int
ExpVector sign.static final ExpVector
ExpVector substitution.static final ExpVector
ExpVector summation.static final long
ExpVector total degree.static final long
ExpVector weighted degree.abstract ExpVector
extend
(int i, int j, long e) Extend variables.abstract ExpVector
extendLower
(int i, int j, long e) Extend lower variables.factory()
Get the corresponding element factory.abstract ExpVector
ExpVector greatest common divisor.abstract long[]
getVal()
Get the exponent vector.abstract long
getVal
(int i) Get the exponent at position i.int
hashCode()
hashCode.int
Get the index of a variable.indexVarName
(int idx, String... vars) Get the variable name at index.abstract int
ExpVector inverse graded lexicographical compareTo.abstract int
invGradCompareTo
(ExpVector V, int begin, int end) ExpVector inverse graded lexicographical compareTo.abstract int
ExpVector inverse lexicographical compareTo.abstract int
invLexCompareTo
(ExpVector V, int begin, int end) ExpVector inverse lexicographical compareTo.abstract int
ExpVector inverse total degree lexicographical compareTo.abstract int
invWeightCompareTo
(long[][] w, ExpVector V) ExpVector inverse weighted lexicographical compareTo.abstract int
invWeightCompareTo
(long[][] w, ExpVector V, int begin, int end) ExpVector inverse weighted lexicographical compareTo.boolean
isFinite()
Is this structure finite or infinite.boolean
isZERO()
Is ExpVector zero.abstract ExpVector
ExpVector least common multiple.abstract int
length()
Get the length of this exponent vector.abstract long
maxDeg()
ExpVector maximal degree.abstract long
minDeg()
ExpVector minimal degree.abstract boolean
ExpVector multiple test.abstract ExpVector
negate()
ExpVector negate.abstract ExpVector
permutation
(List<Integer> P) Permutation of exponent vector.static final ExpVector
random
(int r, long k, float q) Generate a random ExpVector.static final ExpVector
Generate a random ExpVector.abstract ExpVector
reverse()
Reverse variables.abstract ExpVector
reverse
(int j) Reverse lower j variables.abstract int
ExpVector reverse inverse graded compareTo.abstract int
revInvGradCompareTo
(ExpVector V, int begin, int end) ExpVector reverse inverse graded compareTo.abstract int
ExpVector reverse inverse lexicographical compareTo.abstract int
revInvLexCompareTo
(ExpVector V, int begin, int end) ExpVector reverse inverse lexicographical compareTo.abstract int
ExpVector reverse lexicographical inverse total degree compareTo.abstract ExpVector
scalarMultiply
(long s) ExpVector multiply by scalar.protected abstract long
setVal
(int i, long e) Set the exponent at position i to e.abstract int
signum()
ExpVector signum.String[]
stdVars()
Standard variable names.String[]
Generate variable names.static final String[]
STDVARS
(int n) Standard variable names.static final String[]
Generate variable names.subst
(int i, long d) ExpVector substitution.abstract ExpVector
ExpVector subtract.abstract ExpVector
ExpVector summation.toScript()
Get a scripting compatible string representation.Get a scripting compatible string representation.Get a scripting compatible string representation of the factory.toString()
Get the string representation.Get the string representation with variable names.abstract long
totalDeg()
ExpVector total degree.static ExpVector
Value of other.int
varIndex
(int idx) Get the array index of a variable at index.static final String
varsToString
(String[] vars) Get the string representation of the variables.abstract long
weightDeg
(long[] w) ExpVector weighted degree.abstract long
weightDeg
(long[][] w) ExpVector weighted degree.
-
Field Details
-
hash
protected transient int hashStored hash code. -
blen
protected transient long blenStored bitLength. -
random
Random number generator. -
storunit
Used storage representation of exponent arrays. Note: Set this only statically and not dynamically.
-
-
Constructor Details
-
ExpVector
public ExpVector()Constructor for ExpVector.
-
-
Method Details
-
create
Factory constructor for ExpVector.- Parameters:
n
- length of exponent vector.
-
create
Factory constructor for ExpVector. Sets exponent i to e.- Parameters:
n
- length of exponent vector.i
- index of exponent to be set.e
- exponent to be set.
-
create
Internal factory constructor for ExpVector. Sets val.- Parameters:
v
- internal representation array.
-
create
Factory constructor for ExpVector. Converts a String representation to an ExpVector. Accepted format = (1,2,3,4,5,6,7).- Parameters:
s
- String representation.
-
create
Factory constructor for ExpVector. Sets val.- Parameters:
v
- collection of exponents.
-
factory
Get the corresponding element factory. -
isFinite
public boolean isFinite()Is this structure finite or infinite.- Returns:
- true if this structure is finite, else false.
- See Also:
-
valueOf
Value of other.- Parameters:
e
- other ExpVector.- Returns:
- value in sub class of ExpVector.
-
copy
Clone this. -
getVal
public abstract long[] getVal()Get the exponent vector.- Returns:
- val.
-
getVal
public abstract long getVal(int i) Get the exponent at position i.- Parameters:
i
- position.- Returns:
- val[i].
-
setVal
protected abstract long setVal(int i, long e) Set the exponent at position i to e.- Parameters:
i
-e
-- Returns:
- old val[i].
-
length
public abstract int length()Get the length of this exponent vector.- Returns:
- val.length.
-
extend
Extend variables. Used e.g. in module embedding. Extend this by i elements and set val[j] to e.- Parameters:
i
- number of elements to extend.j
- index of element to be set.e
- new exponent for val[j].- Returns:
- extended exponent vector.
-
extendLower
Extend lower variables. Extend this by i lower elements and set val[j] to e.- Parameters:
i
- number of elements to extend.j
- index of element to be set.e
- new exponent for val[j].- Returns:
- extended exponent vector.
-
contract
Contract variables. Used e.g. in module embedding. Contract this to len elements.- Parameters:
i
- position of first element to be copied.len
- new length.- Returns:
- contracted exponent vector.
-
reverse
Reverse variables. Used e.g. in opposite rings.- Returns:
- reversed exponent vector.
-
reverse
Reverse lower j variables. Used e.g. in opposite rings. Reverses the first j-1 variables, the rest is unchanged.- Parameters:
j
- index of first variable reversed.- Returns:
- reversed exponent vector.
-
combine
Combine with ExpVector. Combine this with the other ExpVector V.- Parameters:
V
- the other exponent vector.- Returns:
- combined exponent vector.
-
permutation
Permutation of exponent vector.- Parameters:
P
- permutation.- Returns:
- P(e).
-
toString
Get the string representation. -
toString
Get the string representation with variable names.- Parameters:
vars
- names of variables.- See Also:
-
varsToString
Get the string representation of the variables.- Parameters:
vars
- names of variables.- Returns:
- string representation of the variables.
- See Also:
-
toScript
Get a scripting compatible string representation. -
toScript
Get a scripting compatible string representation.- Returns:
- script compatible representation for this Element.
- See Also:
-
toScriptFactory
Get a scripting compatible string representation of the factory.- Specified by:
toScriptFactory
in interfaceElement<ExpVector>
- Returns:
- script compatible representation for this ElemFactory.
- See Also:
-
indexVarName
Get the variable name at index.- Parameters:
idx
- index of the variablevars
- array of names of variables- Returns:
- name of variable at the given index.
-
varIndex
public int varIndex(int idx) Get the array index of a variable at index.- Parameters:
idx
- index of the variable- Returns:
- array index of the variable.
-
indexVar
Get the index of a variable.- Parameters:
x
- variable name to be searched.vars
- array of names of variables- Returns:
- index of x in vars.
-
evaluate
Evaluate.- Parameters:
cf
- ring factory for elements of a.a
- list of values.- Returns:
- a_1^{e_1} * ... * a_n^{e_n}.
-
equals
Comparison with any other object. -
hashCode
public int hashCode()hashCode. Optimized for small exponents, i.e. ≤ 24 and small number of variables, i.e. ≤ 8. -
bitLength
public long bitLength()Returns the number of bits in the representation of this exponent vector.- Returns:
- number of bits in the representation of this ExpVector, including sign bits.
-
isZERO
public boolean isZERO()Is ExpVector zero.- Specified by:
isZERO
in interfaceAbelianGroupElem<ExpVector>
- Returns:
- If this has all elements 0 then true is returned, else false.
-
stdVars
Standard variable names. Generate standard names for variables, i.e. x0 to x(n-1).- Returns:
- standard names.
-
stdVars
Generate variable names. Generate names for variables, i.e. prefix0 to prefix(n-1).- Parameters:
prefix
- name prefix.- Returns:
- standard names.
-
STDVARS
Standard variable names. Generate standard names for variables, i.e. x0 to x(n-1).- Parameters:
n
- size of names array- Returns:
- standard names.
-
STDVARS
Generate variable names. Generate names for variables from given prefix. i.e. prefix0 to prefix(n-1).- Parameters:
prefix
- name prefix.n
- size of names array.- Returns:
- vatiable names.
-
EVABS
ExpVector absolute value.- Parameters:
U
-- Returns:
- abs(U).
-
abs
ExpVector absolute value.- Specified by:
abs
in interfaceAbelianGroupElem<ExpVector>
- Returns:
- abs(this).
-
EVNEG
ExpVector negate.- Parameters:
U
-- Returns:
- -U.
-
negate
ExpVector negate.- Specified by:
negate
in interfaceAbelianGroupElem<ExpVector>
- Returns:
- -this.
-
EVSUM
ExpVector summation.- Parameters:
U
-V
-- Returns:
- U+V.
-
sum
ExpVector summation.- Specified by:
sum
in interfaceAbelianGroupElem<ExpVector>
- Parameters:
V
-- Returns:
- this+V.
-
EVDIF
ExpVector difference. Result may have negative entries.- Parameters:
U
-V
-- Returns:
- U-V.
-
subtract
ExpVector subtract. Result may have negative entries.- Specified by:
subtract
in interfaceAbelianGroupElem<ExpVector>
- Parameters:
V
-- Returns:
- this-V.
-
scalarMultiply
ExpVector multiply by scalar.- Parameters:
s
- scalar- Returns:
- s*this.
-
EVSU
ExpVector substitution. Clone and set exponent to d at position i.- Parameters:
U
-i
- position.d
- new exponent.- Returns:
- substituted ExpVector.
-
subst
ExpVector substitution. Clone and set exponent to d at position i.- Parameters:
i
- position.d
- new exponent.- Returns:
- substituted ExpVector.
-
EVRAND
Generate a random ExpVector.- Parameters:
r
- length of new ExpVector.k
- maximal degree in each exponent.q
- density of nozero exponents.- Returns:
- random ExpVector.
-
EVRAND
Generate a random ExpVector.- Parameters:
r
- length of new ExpVector.k
- maximal degree in each exponent.q
- density of nozero exponents.rnd
- is a source for random bits.- Returns:
- random ExpVector.
-
random
Generate a random ExpVector.- Parameters:
r
- length of new ExpVector.k
- maximal degree in each exponent.q
- density of nozero exponents.- Returns:
- random ExpVector.
-
random
Generate a random ExpVector.- Parameters:
r
- length of new ExpVector.k
- maximal degree in each exponent.q
- density of nozero exponents.rnd
- is a source for random bits.- Returns:
- random ExpVector.
-
EVSIGN
ExpVector sign.- Parameters:
U
-- Returns:
- 0 if U is zero, -1 if some entry is negative, 1 if no entry is negative and at least one entry is positive.
-
signum
public abstract int signum()ExpVector signum.- Specified by:
signum
in interfaceAbelianGroupElem<ExpVector>
- Returns:
- 0 if this is zero, -1 if some entry is negative, 1 if no entry is negative and at least one entry is positive.
-
EVTDEG
ExpVector total degree.- Parameters:
U
-- Returns:
- sum of all exponents.
-
degree
public long degree()ExpVector degree.- Returns:
- total degree of all exponents.
-
totalDeg
public abstract long totalDeg()ExpVector total degree.- Returns:
- sum of all exponents.
-
EVMDEG
ExpVector maximal degree.- Parameters:
U
-- Returns:
- maximal exponent.
-
maxDeg
public abstract long maxDeg()ExpVector maximal degree.- Returns:
- maximal exponent.
-
EVMINDEG
ExpVector minimal degree.- Parameters:
U
-- Returns:
- minimal exponent.
-
minDeg
public abstract long minDeg()ExpVector minimal degree.- Returns:
- minimal exponent.
-
EVWDEG
ExpVector weighted degree.- Parameters:
w
- weights.U
-- Returns:
- weighted sum of all exponents.
-
weightDeg
public abstract long weightDeg(long[][] w) ExpVector weighted degree.- Parameters:
w
- weights.- Returns:
- weighted sum of all exponents.
-
weightDeg
public abstract long weightDeg(long[] w) ExpVector weighted degree.- Parameters:
w
- weights.- Returns:
- weighted sum of all exponents.
-
EVLCM
ExpVector least common multiple.- Parameters:
U
-V
-- Returns:
- component wise maximum of U and V.
-
lcm
ExpVector least common multiple.- Parameters:
V
-- Returns:
- component wise maximum of this and V.
-
EVGCD
ExpVector greatest common divisor.- Parameters:
U
-V
-- Returns:
- component wise minimum of U and V.
-
gcd
ExpVector greatest common divisor.- Parameters:
V
-- Returns:
- component wise minimum of this and V.
-
EVDOV
ExpVector dependency on variables.- Parameters:
U
-- Returns:
- array of indices where U has positive exponents.
-
dependentVariables
public abstract int dependentVariables()ExpVector dependent variables.- Returns:
- number of indices where val has positive exponents.
-
dependencyOnVariables
public abstract int[] dependencyOnVariables()ExpVector dependency on variables.- Returns:
- array of indices where val has positive exponents.
-
EVMT
ExpVector multiple test. Test if U is component wise greater or equal to V.- Parameters:
U
-V
-- Returns:
- true if U is a multiple of V, else false.
-
multipleOf
ExpVector multiple test. Test if this is component wise greater or equal to V.- Parameters:
V
-- Returns:
- true if this is a multiple of V, else false.
-
divides
ExpVector divides test. Test if V is component wise greater or equal to this.- Parameters:
V
-- Returns:
- true if this divides V, else false.
-
compareTo
ExpVector compareTo. -
EVILCP
Inverse lexicographical compare.- Parameters:
U
-V
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
invLexCompareTo
ExpVector inverse lexicographical compareTo.- Parameters:
V
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
EVILCP
Inverse lexicographical compare part. Compare entries between begin and end (-1).- Parameters:
U
-V
-begin
-end
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
invLexCompareTo
ExpVector inverse lexicographical compareTo.- Parameters:
V
-begin
-end
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
EVIGLC
Inverse graded lexicographical compare.- Parameters:
U
-V
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
invGradCompareTo
ExpVector inverse graded lexicographical compareTo.- Parameters:
V
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
EVIGLC
Inverse graded lexicographical compare part. Compare entries between begin and end (-1).- Parameters:
U
-V
-begin
-end
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
invGradCompareTo
ExpVector inverse graded lexicographical compareTo.- Parameters:
V
-begin
-end
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
EVRILCP
Reverse inverse lexicographical compare.- Parameters:
U
-V
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
revInvLexCompareTo
ExpVector reverse inverse lexicographical compareTo.- Parameters:
V
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
EVRILCP
Reverse inverse lexicographical compare part. Compare entries between begin and end (-1).- Parameters:
U
-V
-begin
-end
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
revInvLexCompareTo
ExpVector reverse inverse lexicographical compareTo.- Parameters:
V
-begin
-end
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
EVRIGLC
Reverse inverse graded lexicographical compare.- Parameters:
U
-V
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
revInvGradCompareTo
ExpVector reverse inverse graded compareTo.- Parameters:
V
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
EVRIGLC
Reverse inverse graded lexicographical compare part. Compare entries between begin and end (-1).- Parameters:
U
-V
-begin
-end
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
revInvGradCompareTo
ExpVector reverse inverse graded compareTo.- Parameters:
V
-begin
-end
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
EVITDEGLC
Inverse total degree lexicographical compare.- Parameters:
U
-V
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
invTdegCompareTo
ExpVector inverse total degree lexicographical compareTo.- Parameters:
V
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
EVRLITDEGC
Reverse lexicographical inverse total degree compare.- Parameters:
U
-V
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
revLexInvTdegCompareTo
ExpVector reverse lexicographical inverse total degree compareTo.- Parameters:
V
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
EVIWLC
Inverse weighted lexicographical compare.- Parameters:
w
- weight array.U
-V
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
invWeightCompareTo
ExpVector inverse weighted lexicographical compareTo.- Parameters:
w
- weight array.V
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
EVIWLC
Inverse weighted lexicographical compare part. Compare entries between begin and end (-1).- Parameters:
w
- weight array.U
-V
-begin
-end
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
invWeightCompareTo
ExpVector inverse weighted lexicographical compareTo.- Parameters:
w
- weight array.V
-begin
-end
-- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-