Difference between revisions of "ApCoCoA-1:MatlabCoCoARing"

From ApCoCoAWiki
m (Renaming of attributes)
m (→‎Constructor: More Ordering keywords added.)
 
(4 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=
* typ: Defines the coefficent ring. Available are:
+
<table border="1">
** Q: Ring of rational numbers
+
      <tr>
** Z: Ring of integers
+
        <td> typ </td><td> Defines the coefficent ring. In the current implementation only Q
** RF:
+
            - Ring of rational numbers - is available.</td>
** RD:
+
      </tr>
* order: Defines the order of the polynmoial ring. Usually a prime number or 0.
+
      <tr>
* noindets: Stores the number of indeterminates.
+
        <td> order </td><td> Defines the order of the polynmoial ring. Usually a prime number or 0.</td>
* indets: Holds the label of the indeterminates as a 1xNoindets cell array of strings.
+
      </tr>
* ordering: A matrix representing a degree compatible term ordering.
+
      <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:
* display: Is used by Matlab to print a CoCoARing to the command window. E.g. when a command is not terminated by a ';'.
+
<table border="1">
* 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.
+
      <tr>
* neq: returns NOT eq. This function is called when using the '!=' operator
+
        <td><b>Method</b></td><td><b>Operator</b></td><td><b>Description</b></td>
* 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.  
+
      </tr>
* one: returns the 1 polynomial of the polynomial ring
+
      <tr>
* zero: returns the 0 polynomial of the polynomial ring
+
        <td> display </td><td>&nbsp;</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>&nbsp;</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>&nbsp;</td><td> returns the 1 polynomial of the polynomial ring</td>
 +
      </tr>
 +
      <tr>
 +
        <td> zero </td><td>&nbsp;</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:

KeywordPossible ValuesDefault
Typ'Q','Z','RF','RD''Q'
Order0,1,2,...0
Noindets1,2,...1
Indets'auto', {'anyString1','anyString2',...}{'x[1]'}
Ordering'DegRevLex', 'DegLex', 'Lex', 'RevLex' , AnyTermOrderingMatrix1

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:

MethodOperatorDescription
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>