Package cc.redberry.rings.poly.multivar
Class DegreeVector
java.lang.Object
cc.redberry.rings.poly.multivar.DegreeVector
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AMonomial
public class DegreeVector extends Object implements Serializable
Degree vector. This is parent class for all monomials. Instances are immutable. All
DegreeVector
methods are
prefixed with "dv" (which expands to "degree vector"), which means that they affect only exponents (not the
coefficients).- Since:
- 1.0
- See Also:
AMonomial
, Serialized Form
-
Field Summary
Fields Modifier and Type Field Description int[]
exponents
exponentsint
totalDegree
Sum of all exponents (total degree) -
Constructor Summary
Constructors Constructor Description DegreeVector(int[] exponents)
DegreeVector(int[] exponents, int totalDegree)
-
Method Summary
Modifier and Type Method Description DegreeVector
dv()
DegreeVector
dvDivideExact(int[] divider)
Gives quotientthis / oth
or throwsArithmeticException
if exact division is not possible (e.g.DegreeVector
dvDivideExact(DegreeVector divider)
Gives quotientthis / oth
or throwsArithmeticException
if exact division is not possible (e.g.DegreeVector
dvDivideOrNull(int[] divider)
Gives quotientthis / oth
or null if exact division is not possible (e.g.DegreeVector
dvDivideOrNull(int variable, int exponent)
Divides this by variable^exponentDegreeVector
dvDivideOrNull(DegreeVector divider)
Gives quotientthis / oth
or null if exact division is not possible (e.g.boolean
dvDivisibleBy(int[] oth)
Tests whether this can be divided byoth
degree vectorboolean
dvDivisibleBy(DegreeVector oth)
Tests whether this can be divided byoth
degree vectorDegreeVector
dvDropSelect(int[] variables)
Picks only specified exponentsboolean
dvEquals(DegreeVector dVector)
DegreeVector
dvInsert(int variable)
Inserts new variableDegreeVector
dvInsert(int variable, int count)
Inserts new variablesDegreeVector
dvJoinNewVariable()
Joins new variable (with zero exponent) to degree vectorDegreeVector
dvJoinNewVariables(int n)
Joins new variables (with zero exponents) to degree vectorDegreeVector
dvJoinNewVariables(int newNVariables, int[] mapping)
internal APIDegreeVector
dvMap(int nVariables, int[] mapping)
Creates degree vector with old variables renamed to specified mapping variablesDegreeVector
dvMultiply(int[] oth)
Multiplies this by othDegreeVector
dvMultiply(int variable, int exponent)
Multiplies this by variable^exponentDegreeVector
dvMultiply(DegreeVector oth)
Multiplies this by othDegreeVector
dvRange(int from, int to)
Selects range from thisDegreeVector
dvSelect(int var)
Sets exponents of all variables except the specified variable to zeroDegreeVector
dvSelect(int[] variables)
Set's exponents of all variables except specified variables to zeroDegreeVector
dvSet(int variable, int exponent)
Set's exponent of specified variable to specified valueDegreeVector
dvSetNVariables(int n)
Sets the number of variablesDegreeVector
dvSetZero(int var)
Set exponent of specifiedvar
to zeroDegreeVector
dvSetZero(int[] variables)
Set exponents of specified variables to zeroint
dvTotalDegree(int... variables)
Returns the total degree in specified variablesDegreeVector
dvWithout(int variable)
Drops specified variable (number of variables will be reduced)DegreeVector
dvWithout(int[] variables)
Drops specified variables (number of variables will be reduced)boolean
equals(Object o)
int
hashCode()
boolean
isZeroVector()
Returns whether all exponents are zeroint
nVariables()
Returns number of variablesString
toString()
String
toString(String[] vars)
String representation of this monomial with specified string names for variablesString
toStringArray()
-
Field Details
-
exponents
public final int[] exponentsexponents -
totalDegree
public final int totalDegreeSum of all exponents (total degree)
-
-
Constructor Details
-
DegreeVector
public DegreeVector(int[] exponents, int totalDegree)- Parameters:
exponents
- exponentstotalDegree
- total degree (sum of exponents)
-
DegreeVector
public DegreeVector(int[] exponents)- Parameters:
exponents
- exponents
-
-
Method Details
-
nVariables
public final int nVariables()Returns number of variables -
isZeroVector
public final boolean isZeroVector()Returns whether all exponents are zero -
dv
-
dvTotalDegree
public final int dvTotalDegree(int... variables)Returns the total degree in specified variables -
dvMultiply
Multiplies this by oth -
dvMultiply
Multiplies this by oth -
dvMultiply
Multiplies this by variable^exponent -
dvDivideOrNull
Divides this by variable^exponent -
dvDivideOrNull
Gives quotientthis / oth
or null if exact division is not possible (e.g. a^2*b^3 / a^3*b^5) -
dvDivideOrNull
Gives quotientthis / oth
or null if exact division is not possible (e.g. a^2*b^3 / a^3*b^5) -
dvDivideExact
Gives quotientthis / oth
or throwsArithmeticException
if exact division is not possible (e.g. a^2*b^3 / a^3*b^5) -
dvDivideExact
Gives quotientthis / oth
or throwsArithmeticException
if exact division is not possible (e.g. a^2*b^3 / a^3*b^5) -
dvDivisibleBy
public final boolean dvDivisibleBy(int[] oth)Tests whether this can be divided byoth
degree vector -
dvDivisibleBy
Tests whether this can be divided byoth
degree vector -
dvJoinNewVariable
Joins new variable (with zero exponent) to degree vector -
dvJoinNewVariables
Joins new variables (with zero exponents) to degree vector -
dvJoinNewVariables
internal API -
dvSetNVariables
Sets the number of variables -
dvSelect
Sets exponents of all variables except the specified variable to zero -
dvSelect
Set's exponents of all variables except specified variables to zero -
dvDropSelect
Picks only specified exponents -
dvRange
Selects range from this- Parameters:
from
- from inclusiveto
- to exclusive
-
dvSetZero
Set exponent of specifiedvar
to zero -
dvSetZero
Set exponents of specified variables to zero -
dvWithout
Drops specified variable (number of variables will be reduced) -
dvWithout
Drops specified variables (number of variables will be reduced) -
dvInsert
Inserts new variable -
dvInsert
Inserts new variables -
dvSet
Set's exponent of specified variable to specified value- Parameters:
variable
- the variableexponent
- new exponent
-
dvMap
Creates degree vector with old variables renamed to specified mapping variables- Parameters:
nVariables
- new total number of variablesmapping
- mapping from old variables to new variables
-
toString
String representation of this monomial with specified string names for variables- Parameters:
vars
- string names of variables
-
toString
-
toStringArray
-
dvEquals
-
equals
-
hashCode
public int hashCode()
-