Difference between revisions of "ApCoCoA-1:MatlabCoCoARing"
m (→Methods: Syntax error ~= corrected) |
m (→Constructor: More Ordering keywords added.) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 23: | Line 23: | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
− | <td>Ordering</td><td>'DegRevLex', 'DegLex', AnyTermOrderingMatrix</td><td>1</td> | + | <td>Ordering</td><td>'DegRevLex', 'DegLex', 'Lex', 'RevLex' , AnyTermOrderingMatrix</td><td>1</td> |
</tr> | </tr> | ||
</table> | </table> | ||
Line 34: | Line 34: | ||
=Attributes= | =Attributes= | ||
− | + | <table border="1"> | |
− | + | <tr> | |
− | + | <td> typ </td><td> Defines the coefficent ring. In the current implementation only Q | |
− | + | - Ring of rational numbers - is available.</td> | |
− | + | </tr> | |
− | + | <tr> | |
− | + | <td> order </td><td> Defines the order of the polynmoial ring. Usually a prime number or 0.</td> | |
− | + | </tr> | |
− | + | <tr> | |
+ | <td> noindets </td><td> Stores the number of indeterminates.</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td> indets </td><td> Holds the label of the indeterminates as a 1xNoindets cell array of strings.</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td> ordering</td><td> A matrix representing a term ordering.</td> | ||
+ | </tr> | ||
+ | </table> | ||
=Methods= | =Methods= | ||
The following methods are available for rings: | The following methods are available for rings: | ||
− | + | <table border="1"> | |
− | + | <tr> | |
− | + | <td><b>Method</b></td><td><b>Operator</b></td><td><b>Description</b></td> | |
− | + | </tr> | |
− | + | <tr> | |
− | + | <td> display </td><td> </td><td> Is used by Matlab to print a CoCoARing to the command window. E.g. when a command is not terminated by a ';'.</td> | |
+ | </tr> | ||
+ | <tr> | ||
+ | <td> eq </td><td>==</td><td> Compares two rings and returns 1 in case that all attributes of the two rings are equal. Otherwise 0 is returned.</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td> neq </td><td>~=</td><td> returns NOT eq.</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td> get </td><td> </td><td> 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. </td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td> one </td><td> </td><td> returns the 1 polynomial of the polynomial ring</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td> zero </td><td> </td><td> returns the 0 polynomial of the polynomial ring</td> | ||
+ | </tr> | ||
+ | </table> | ||
=Examples= | =Examples= |
Latest revision as of 12:46, 31 July 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', 'Lex', 'RevLex' , 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. In the current implementation only Q - Ring of rational numbers - is available. |
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 term ordering. |
Methods
The following methods are available for rings:
Method | Operator | Description |
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. |
neq | ~= | returns NOT eq. |
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>