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

File: [local] / OpenXM / src / asir-contrib / packages / src / datatype.rr (download)

Revision 1.7, Tue Jul 29 23:15:12 2008 UTC (15 years, 10 months ago) by takayama
Branch: MAIN
CVS Tags: R_1_3_1-2, RELEASE_1_3_1_13b, RELEASE_1_2_3_12, HEAD
Changes since 1.6: +4 -2 lines

Added a field "Weyl"  (fixed a bug for poly_elimination_ideal).

/* $OpenXM: OpenXM/src/asir-contrib/packages/src/datatype.rr,v 1.7 2008/07/29 23:15:12 takayama Exp $ */

#include "tags.h"

/* Objects in the category base */
struct base_field {
  Type
}$
def new_base_filed() {
  A = newstruct(base_field);
  return A;
}
def new__base_filed(T) {
  A = new_base_field();
  A -> Type = T;
  return A;
}

struct base_identity {
  Left,
  Right,
  Condition
}$
def new_base_identity() {
  A = newstruct(base_identity);
  return A;
}
def new__base_identity(L,R,C) {
  A = new__base_identity();
  A->Left = L;
  A->Right = R;
  A->Condition = C;
  return A;
}


/*
  Example:  
    L = newstruct(base_rule);
    L->Rule = [[x,1/x],[y,1/y]];
*/
struct base_rule {
  Rule
}$
def new_base_rule() {
  A = newstruct(base_rule);
  return A;
}
def new__base_rule(R) {
  A = new_base_rule();
  A->Rule = R;
  return A;
}

struct base_text {
  Type, /* Type is "tex" or "html" ... */
  S   /* Sentence */
}$
def new_base_text() {
  A = newstruct(base_text);
  return A;
}
def new__base_text(T,S) {
  A = new_base_text();
  A->Type = T;
  A->S = S;
  return A;
}



/* Objects in the category poly */

struct poly_factored_polynomial {
  F
}$
def new_poly_factored_polynomial() {
  A = newstruct(poly_factored_polynomial);
  return A;
}
def new__poly_factored_polynomial(F) {
  A = new_poly_factored_polynomial();
  A->F = F;
  return A;
}

struct poly_factored_rational {
  Numerator, Denominator
}$
def new_poly_factored_rational() {
  A = newstruct(poly_factored_rational);
  return A;
}
def new__poly_factored_rational(F,G) {
  A = new_poly_factored_rational();
  A->Numerator = F;
  A->Denominator = G;
  return A;
}

struct poly_ideal {
  Ring,
  Generators,  /* List of native poly or dpoly. */
  Grobner,      /* 1 or 0,  is it already Grobner basis? */
  Weyl         /* 1 or 0(commutative) */ 
}$

def new_poly_ideal() {
  A = newstruct(poly_ideal);
  return A;
}
def new__poly_ideal(R,F,G) {
  A = new_poly_ideal();
  if (type(R) != STRUCT) { 
     error("The first argument should be a ring.");
  }else{
    A->Ring = R;
  }
  if (type(F) != LIST) {
    error("The second argument should be a list of polynomial.");
  }else{
    A->Generators = F;
  }
  A->Grobner = G;
  A->Weyl = 0; /* it is a polynomial ring */
  return A;
}

struct poly_polynomial {
  Ring,  
  F  /*  native poly, dpoly, quote  
      or struct factored_polynomial */
}$
def new_poly_polynomial() {
  A = newstruct(poly_polynomial);
  return A;
}
def new__poly_polynomial(R,F) {
  A = new_poly_polynomial();
  if (type(R) != STRUCT) { 
    error("The first argument should be a ring.");
  }else{
    A->Ring = R;
  }
  A->F = F;
  return A;
}


struct poly_ring {
  Variables,  
  Order,
  K,  /* base_field.  base_Q (rational numbers),  */
  Weyl
}$

def new_poly_ring() {
  A = newstruct(poly_ring);
  return A;
}

def new__poly_ring(V,O,K,W) {
  A = new_poly_ring();
  A->Variables = V;
  A->Order = O;
  A->K = K;
  A->Weyl = W;
  return A;
}

end$