[BACK]Return to datatype.rr CVS log [TXT][DIR] Up to [local] / OpenXM / src / asir-contrib / packages / src

Annotation of OpenXM/src/asir-contrib/packages/src/datatype.rr, Revision 1.5

1.5     ! takayama    1: /* $OpenXM: OpenXM/src/asir-contrib/packages/src/datatype.rr,v 1.4 2001/08/25 04:39:03 takayama Exp $ */
1.4       takayama    2:
                      3: #include "tags.h"
                      4:
                      5: /* Objects in the category base */
                      6: struct base_field {
                      7:   Tag,
                      8:   Type
                      9: }$
                     10: def new_base_filed() {
                     11:   A = newstruct(base_field);
                     12:   A -> Tag = BASE_FIELD;
                     13:   return A;
                     14: }
                     15: def new__base_filed(T) {
                     16:   A = new_base_field();
                     17:   A -> Type = T;
                     18:   return A;
                     19: }
                     20:
                     21: struct base_identity {
                     22:   Tag,
                     23:   Left,
                     24:   Right,
                     25:   Condition
                     26: }$
                     27: def new_base_identity() {
                     28:   A = newstruct(base_identity);
                     29:   A->Tag = BASE_IDENTITY;
                     30:   return A;
                     31: }
                     32: def new__base_identity(L,R,C) {
                     33:   A = new__base_identity();
                     34:   A->Left = L;
                     35:   A->Right = R;
                     36:   A->Condition = C;
                     37:   return A;
                     38: }
                     39:
1.1       takayama   40:
                     41: /*
                     42:   Example:
                     43:     L = newstruct(base_rule);
                     44:     L->Rule = [[x,1/x],[y,1/y]];
                     45: */
                     46: struct base_rule {
1.4       takayama   47:   Tag,
1.1       takayama   48:   Rule
1.2       takayama   49: }$
1.4       takayama   50: def new_base_rule() {
                     51:   A = newstruct(base_rule);
                     52:   A->Tag = BASE_RULE;
                     53:   return A;
                     54: }
                     55: def new__base_rule(R) {
                     56:   A = new_base_rule();
                     57:   A->Rule = R;
                     58:   return A;
                     59: }
                     60:
                     61: struct base_text {
                     62:   Tag,
                     63:   Type, /* Type is "tex" or "html" ... */
                     64:   S   /* Sentence */
                     65: }$
                     66: def new_base_text() {
                     67:   A = newstruct(base_text);
                     68:   A->Tag = BASE_TEXT;
                     69:   return A;
                     70: }
                     71: def new__base_text(T,S) {
                     72:   A = new_base_text();
                     73:   A->Type = T;
                     74:   A->S = S;
                     75:   return A;
                     76: }
                     77:
                     78:
                     79:
                     80: /* Objects in the category poly */
1.3       takayama   81:
                     82: struct poly_factored_polynomial {
                     83:   Tag, /* Tentative */
                     84:   F
                     85: }$
                     86: def new_poly_factored_polynomial() {
                     87:   A = newstruct(poly_factored_polynomial);
1.4       takayama   88:   A->Tag = POLY_FACTORED_POLYNOMIAL;
1.3       takayama   89:   return A;
                     90: }
1.4       takayama   91: def new__poly_factored_polynomial(F) {
                     92:   A = new_poly_factored_polynomial();
                     93:   A->F = F;
                     94:   return A;
                     95: }
                     96:
1.3       takayama   97: struct poly_factored_rational {
1.4       takayama   98:   Tag,
1.3       takayama   99:   Numerator, Denominator
                    100: }$
                    101: def new_poly_factored_rational() {
                    102:   A = newstruct(poly_factored_rational);
1.4       takayama  103:   A->Tag = POLY_FACTORED_RATIONAL ;
                    104:   return A;
                    105: }
                    106: def new__poly_factored_rational(F,G) {
                    107:   A = new_poly_factored_rational();
                    108:   A->Numerator = F;
                    109:   A->Denominator = G;
                    110:   return A;
                    111: }
                    112:
                    113: struct poly_ideal {
                    114:   Tag,
                    115:   Ring,
                    116:   Generators,  /* List of native poly or dpoly. */
                    117:   Grobner      /* 1 or 0,  is it already Grobner basis? */
                    118: }$
                    119:
                    120: def new_poly_ideal() {
                    121:   A = newstruct(poly_ideal);
                    122:   A->Tag = POLY_IDEAL;
                    123:   return A;
                    124: }
                    125: def new__poly_ideal(R,F,G) {
                    126:   A = new_poly_ideal();
1.5     ! takayama  127:   if (type(R) != STRUCT) {
        !           128:      error("The first argument should be a ring.");
        !           129:   }else{
        !           130:     A->Ring = R;
        !           131:   }
        !           132:   if (type(F) != LIST) {
        !           133:     error("The second argument should be a list of polynomial.");
        !           134:   }else{
        !           135:     A->Generators = F;
        !           136:   }
1.4       takayama  137:   A->Grobner = G;
                    138:   return A;
                    139: }
                    140:
                    141: struct poly_polynomial {
                    142:   Tag,
                    143:   Ring,
                    144:   F  /*  native poly, dpoly, quote
                    145:       or struct factored_polynomial */
                    146: }$
                    147: def new_poly_polynomial() {
                    148:   A = newstruct(poly_polynomial);
                    149:   A->Tag = POLY_POLYNOMIAL;
                    150:   return A;
                    151: }
                    152: def new__poly_polynomial(R,F) {
                    153:   A = new_poly_polynomial();
1.5     ! takayama  154:   if (type(R) != STRUCT) {
        !           155:     error("The first argument should be a ring.");
        !           156:   }else{
        !           157:     A->Ring = R;
        !           158:   }
1.4       takayama  159:   A->F = F;
                    160:   return A;
                    161: }
                    162:
                    163:
                    164: struct poly_ring {
                    165:   Tag,
                    166:   Variables,
                    167:   Order,
1.5     ! takayama  168:   K,  /* base_field.  base_Q (rational numbers),  */
1.4       takayama  169:   Weyl
                    170: }$
                    171:
                    172: def new_poly_ring() {
                    173:   A = newstruct(poly_ring);
                    174:   A->Tag = POLY_RING;
                    175:   return A;
                    176: }
                    177:
                    178: def new__poly_ring(V,O,K,W) {
                    179:   A = new_poly_ring();
                    180:   A->Variables = V;
                    181:   A->Order = O;
                    182:   A->K = K;
                    183:   A->Weyl = W;
1.3       takayama  184:   return A;
                    185: }
1.1       takayama  186:
                    187: end$
                    188:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>