Difference between revisions of "ApCoCoA-1:MatlabCoCoARing"
m (Renaming of attributes) |
m (→Methods: Syntax error ~= corrected) |
||
Line 48: | Line 48: | ||
* display: Is used by Matlab to print a CoCoARing to the command window. E.g. when a command is not terminated by a ';'. | * display: Is used by Matlab to print a CoCoARing to the command window. E.g. when a command is not terminated by a ';'. | ||
* eq: Compares two rings and returns 1 in case that all attributes of the two rings are equal. Otherwise 0 is returned. This function is called when using the '==' operator. | * eq: Compares two rings and returns 1 in case that all attributes of the two rings are equal. Otherwise 0 is returned. This function is called when using the '==' operator. | ||
− | * neq: returns NOT eq. This function is called when using the ' | + | * neq: returns NOT eq. This function is called when using the '~=' operator |
* get: Returns the attributes of a ring. Syntax: get(ringVar, 'Keyword'), where ringVar is a CoCoARing and 'Keyword' is one of the keywords listed in table 1. Additionaly the keyword 'String' can be used. This will return the polynomial as a string. | * get: Returns the attributes of a ring. Syntax: get(ringVar, 'Keyword'), where ringVar is a CoCoARing and 'Keyword' is one of the keywords listed in table 1. Additionaly the keyword 'String' can be used. This will return the polynomial as a string. | ||
* one: returns the 1 polynomial of the polynomial ring | * one: returns the 1 polynomial of the polynomial ring |
Revision as of 11:44, 28 February 2008
Introduction
The CoCoARing class represents a polynomial ring structure. It stores the name of indeterminates defined over a coefficient ring which is defined in the typ attribute amongst other supporting attributes.
Constructor
The constructor function takes a parameter in the form 'keyword',value. For example to build a ring over Q use the keyword = 'Typ' and the value = 'Q'. The function is called CoCoARing().
Available keywords are listed below:
Keyword | Possible Values | Default |
Typ | 'Q','Z','RF','RD' | 'Q' |
Order | 0,1,2,... | 0 |
Noindets | 1,2,... | 1 |
Indets | 'auto', {'anyString1','anyString2',...} | {'x[1]'} |
Ordering | 'DegRevLex', 'DegLex', AnyTermOrderingMatrix | 1 |
Table 1: Keywords for CoCoARing
Note: The order of the keywords is not completly arbitrary:
- The keyword Ordering can only be used after the keyword Indets.
- Noindets should be defined before Indets otherwise result might not be correct as default value is used.
Attributes
- typ: Defines the coefficent ring. Available are:
- Q: Ring of rational numbers
- Z: Ring of integers
- RF:
- RD:
- order: Defines the order of the polynmoial ring. Usually a prime number or 0.
- noindets: Stores the number of indeterminates.
- indets: Holds the label of the indeterminates as a 1xNoindets cell array of strings.
- ordering: A matrix representing a degree compatible term ordering.
Methods
The following methods are available for rings:
- display: Is used by Matlab to print a CoCoARing to the command window. E.g. when a command is not terminated by a ';'.
- eq: Compares two rings and returns 1 in case that all attributes of the two rings are equal. Otherwise 0 is returned. This function is called when using the '==' operator.
- neq: returns NOT eq. This function is called when using the '~=' operator
- get: Returns the attributes of a ring. Syntax: get(ringVar, 'Keyword'), where ringVar is a CoCoARing and 'Keyword' is one of the keywords listed in table 1. Additionaly the keyword 'String' can be used. This will return the polynomial as a string.
- one: returns the 1 polynomial of the polynomial ring
- zero: returns the 0 polynomial of the polynomial ring
Examples
A collection of examples is provided in the file TestCoCoARing.m. This file defines the function TestCoCoARing which will run and display many examples. A few common examples are presented below.
- Default ring Q[x[1]]:
<matlab> defaultRing = CoCoARing(); </matlab>
- Q[x1,...,xN]: The only supported ring for the CoCoAPoly class at the moment is Q[x1,...,xN]. To generate this ring with a DegRevLex ordering over 3 indeterminates x,y and z use the following code:
<matlab> myR = CoCoARing('Typ','Q','Indets',{'x','y','z'},'Ordering','DegRevLex'); </matlab>
- To generate the 1 and 0 polynomial of a CoCoARing use the following code:
<matlab> oneOfRing = one(myR); zeroOfRing = zero(myR); </matlab>
- To read the attributes of a CoCoARing use the following command (this examples reads all attributes):
<matlab> [a1,a2,a3,a4,a5] = get(myR,'Typ','Order','Noindets','Indets','Ordering'); </matlab>