source: git/kernel/tgb_internal.h @ ebe987

spielwiese
Last change on this file since ebe987 was a7d970, checked in by Michael Brickenstein <bricken@…>, 17 years ago
*bricken: beginning templating arithmetic git-svn-id: file:///usr/local/Singular/svn/trunk@9883 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 18.3 KB
Line 
1#ifndef TGB_INTERNAL_H
2#define TGB_INTERNAL_H
3//!\file tgb_internal.h
4/****************************************
5*  Computer Algebra System SINGULAR     *
6****************************************/
7/* $Id: tgb_internal.h,v 1.56 2007-02-22 10:45:00 bricken Exp $ */
8/*
9 * ABSTRACT: tgb internal .h file
10*/
11#include <omalloc.h>
12#include "p_polys.h"
13
14#include "ideals.h"
15#include "ring.h"
16#include "febase.h"
17#include "structs.h"
18#include "polys.h"
19#include "stdlib.h"
20#include <modulop.h>
21//#define USE_NORO 1
22#ifdef USE_NORO
23#define NORO_CACHE 1
24#define NORO_SPARSE_ROWS_PRE 1
25#define NORO_NON_POLY 1
26#endif
27#ifdef NORO_CACHE
28//#include <map>
29#include <vector>
30#endif
31#ifdef HAVE_BOOST_DYNAMIC_BITSET_HPP
32#define  HAVE_BOOST 1
33#endif
34//#define HAVE_BOOST 1
35//#define USE_STDVECBOOL 1
36#ifdef HAVE_BOOST
37#include "boost/dynamic_bitset.hpp"
38#include <vector>
39using boost::dynamic_bitset;
40using std::vector;
41#endif
42#ifdef USE_STDVECBOOL
43#include <vector>
44using std::vector;
45#endif
46#include "kutil.h"
47#include "kInline.cc"
48#include "kstd1.h"
49#include "kbuckets.h"
50
51
52
53
54//#define TGB_DEBUG
55#define FULLREDUCTIONS
56#define HANS_IDEA
57//#define HALFREDUCTIONS
58//#define HEAD_BIN
59//#define HOMOGENEOUS_EXAMPLE
60#define REDTAIL_S
61#define PAR_N 100
62#define PAR_N_F4 5000
63#define AC_NEW_MIN 2
64#define AC_FLATTEN 1
65
66//#define FIND_DETERMINISTIC
67//#define REDTAIL_PROT
68//#define QUICK_SPOLY_TEST
69class PolySimple{
70public:
71  PolySimple(poly p){
72    impl=p;
73  }
74  PolySimple(){
75    impl=NULL;
76  }
77  PolySimple(const PolySimple& a){
78    //impl=p_Copy(a.impl,currRing);
79    impl=a.impl;
80  }
81  PolySimple& operator=(const PolySimple& p2){
82    //p_Delete(&impl,currRing);
83    //impl=p_Copy(p2.impl,currRing);
84    impl=p2.impl;
85    return *this;
86  }
87  ~PolySimple(){
88    //p_Delete(&impl,currRing);
89  }
90  bool operator< (const PolySimple& other) const{
91    return pLmCmp(impl,other.impl)<0;
92  }
93  bool operator==(const PolySimple& other){
94    return pLmEqual(impl,other.impl);
95  }
96  poly impl;
97 
98};
99class DataNoroCacheNode;
100class MonRedRes{
101public:
102  poly p;
103  number coef;
104  BOOLEAN changed;
105  int len;
106  BOOLEAN onlyBorrowed;
107  bool operator<(const MonRedRes& other) const{
108    int cmp=p_LmCmp(p,other.p,currRing);
109    if ((cmp<0)||((cmp==0)&&((onlyBorrowed)&&(!(other.onlyBorrowed))))){
110      return true;
111    } else return false;
112  }
113  DataNoroCacheNode* ref;
114  MonRedRes(){
115    ref=NULL;
116    p=NULL;
117  }
118};
119class MonRedResNP{
120public:
121  number coef;
122
123
124  DataNoroCacheNode* ref;
125  MonRedResNP(){
126    ref=NULL;
127  }
128};
129struct sorted_pair_node{
130  //criterium, which is stable 0. small lcm 1. small i 2. small j
131  wlen_type expected_length;
132  poly lcm_of_lm;
133  int i;
134  int j;
135  int deg;
136 
137 
138};
139
140
141class NoroPlaceHolder{
142public:
143  DataNoroCacheNode* ref;
144  number coef;
145};
146
147//static ideal debug_Ideal;
148
149
150struct poly_list_node{
151  poly p;
152  poly_list_node* next;
153};
154
155struct int_pair_node{
156  int_pair_node* next;
157  int a;
158  int b;
159};
160struct monom_poly{
161  poly m;
162  poly f;
163};
164struct mp_array_list{
165  monom_poly* mp;
166  int size;
167  mp_array_list* next;
168};
169
170
171struct poly_array_list{
172  poly* p;
173  int size;
174  poly_array_list* next;
175};
176class slimgb_alg
177{
178  public:
179    slimgb_alg(ideal I, int syz_comp,BOOLEAN F4);
180                void introduceDelayedPairs(poly* pa,int s);
181    virtual ~slimgb_alg();
182    void cleanDegs(int lower, int upper);
183#ifndef HAVE_BOOST
184#ifdef USE_STDVECBOOL
185  vector<vector<bool> > states;
186#else
187  char** states;
188#endif
189#else
190  vector<dynamic_bitset<> > states;
191#endif
192  ideal add_later;
193  ideal S;
194  ring r;
195  int* lengths;
196  wlen_type* weighted_lengths;
197  long* short_Exps;
198  kStrategy strat;
199  int* T_deg;
200  int* T_deg_full;
201  poly tmp_lm;
202  poly* tmp_pair_lm;
203  sorted_pair_node** tmp_spn;
204  poly* expandS;
205  poly* gcd_of_terms;
206  int_pair_node* soon_free;
207  sorted_pair_node** apairs;
208  #if 0
209  BOOLEAN* modifiedS;
210  #endif
211  #ifdef TGB_RESORT_PAIRS
212  bool* replaced;
213  #endif
214  poly_list_node* to_destroy;
215  //for F4
216  mp_array_list* F;
217  poly_array_list* F_minus;
218
219  //end for F4
220#ifdef HEAD_BIN
221  struct omBin_s*   HeadBin;
222#endif
223  unsigned int reduction_steps;
224  int n;
225  //! array_lengths should be greater equal n;
226  int syz_comp;
227  int array_lengths; 
228  int normal_forms;
229  int current_degree;
230  int Rcounter;
231  int last_index;
232  int max_pairs;
233  int pair_top;
234  int easy_product_crit;
235  int extended_product_crit;
236  int average_length;
237  int lastDpBlockStart;
238  int lastCleanedDeg;
239  BOOLEAN isDifficultField;
240  BOOLEAN completed;
241  BOOLEAN is_homog;
242  BOOLEAN tailReductions;
243  BOOLEAN eliminationProblem;
244  BOOLEAN F4_mode;
245  BOOLEAN nc;
246  #ifdef TGB_RESORT_PAIRS
247  BOOLEAN used_b;
248  #endif
249};
250class red_object{
251 public:
252  kBucket_pt bucket;
253  poly p;
254  unsigned long sev;
255  int sugar;
256  void flatten();
257  void validate();
258  wlen_type initial_quality;
259  void adjust_coefs(number c_r, number c_ac_r);
260  wlen_type guess_quality(slimgb_alg* c);
261  int clear_to_poly();
262  void canonicalize();
263};
264
265
266enum calc_state
267  {
268    UNCALCULATED,
269    HASTREP//,
270    //UNIMPORTANT,
271    //SOONTREP
272  };
273static BOOLEAN pair_cmp(sorted_pair_node* a,sorted_pair_node* b);
274template <class len_type, class set_type>  int pos_helper(kStrategy strat, poly p, len_type len, set_type setL, polyset set);
275static int add_to_reductors(slimgb_alg* c, poly h, int len, int ecart, BOOLEAN simplified=FALSE);
276static int bucket_guess(kBucket* bucket);
277static poly redNFTail (poly h,const int sl,kStrategy strat, int len);
278static poly redNF2 (poly h,slimgb_alg* c , int &len, number&  m,int n=0);
279void free_sorted_pair_node(sorted_pair_node* s, ring r);
280static void shorten_tails(slimgb_alg* c, poly monom);
281static void replace_pair(int & i, int & j, slimgb_alg* c);
282//static sorted_pair_node** add_to_basis(poly h, int i, int j,slimgb_alg* c, int* ip=NULL);
283static void do_this_spoly_stuff(int i,int j,slimgb_alg* c);
284//ideal t_rep_gb(ring r,ideal arg_I);
285static BOOLEAN has_t_rep(const int & arg_i, const int & arg_j, slimgb_alg* state);
286static int* make_connections(int from, poly bound, slimgb_alg* c);
287static int* make_connections(int from, int to, poly bound, slimgb_alg* c);
288void now_t_rep(const int & arg_i, const int & arg_j, slimgb_alg* c);
289static void soon_t_rep(const int & arg_i, const int & arg_j, slimgb_alg* c);
290static int pLcmDeg(poly a, poly b);
291static int simple_posInS (kStrategy strat, poly p,int len, wlen_type wlen);
292static BOOLEAN find_next_pair(slimgb_alg* c, BOOLEAN go_higher=TRUE);
293
294static sorted_pair_node* pop_pair(slimgb_alg* c);
295static BOOLEAN no_pairs(slimgb_alg* c);
296void clean_top_of_pair_list(slimgb_alg* c);
297static void super_clean_top_of_pair_list(slimgb_alg* c);
298static BOOLEAN state_is(calc_state state, const int & i, const int & j, slimgb_alg* c);
299static BOOLEAN pair_better(sorted_pair_node* a,sorted_pair_node* b, slimgb_alg* c=NULL);
300static int tgb_pair_better_gen(const void* ap,const void* bp);
301static poly redTailShort(poly h, kStrategy strat);
302static poly gcd_of_terms(poly p, ring r);
303static BOOLEAN extended_product_criterion(poly p1, poly gcd1, poly p2, poly gcd2, slimgb_alg* c);
304static poly kBucketGcd(kBucket* b, ring r);
305static void multi_reduction(red_object* los, int & losl, slimgb_alg* c);
306int slim_nsize(number n, ring r);
307sorted_pair_node* quick_pop_pair(slimgb_alg* c);
308sorted_pair_node* top_pair(slimgb_alg* c);
309sorted_pair_node** add_to_basis_ideal_quotient(poly h, slimgb_alg* c, int* ip);//, BOOLEAN new_pairs=TRUE);
310sorted_pair_node**  spn_merge(sorted_pair_node** p, int pn,sorted_pair_node **q, int qn,slimgb_alg* c);
311int kFindDivisibleByInS_easy(kStrategy strat,const red_object & obj);
312int tgb_pair_better_gen2(const void* ap,const void* bp);
313int kFindDivisibleByInS_easy(kStrategy strat,poly p, long sev);
314//static int quality(poly p, int len, slimgb_alg* c);
315/**
316   makes on each red_object in a region a single_step
317 **/
318class reduction_step{
319 public:
320  /// we assume hat all occuring red_objects have same lm, and all
321  /// occ. lm's in r[l...u] are the same, only reductor does not occur
322  virtual void reduce(red_object* r, int l, int u);
323  //int reduction_id;
324  virtual ~reduction_step();
325  slimgb_alg* c;
326  int reduction_id;
327};
328class simple_reducer:public reduction_step{
329 public:
330  poly p;
331  kBucket_pt fill_back;
332  int p_len;
333  int reducer_deg;
334  simple_reducer(poly p, int p_len,int reducer_deg, slimgb_alg* c =NULL){
335    this->p=p;
336    this->reducer_deg=reducer_deg;
337    assume(p_len==pLength(p));
338    this->p_len=p_len;
339    this->c=c;
340  }
341  virtual void pre_reduce(red_object* r, int l, int u);
342  virtual void reduce(red_object* r, int l, int u);
343  ~simple_reducer();
344
345
346  virtual void do_reduce(red_object & ro);
347};
348
349//class sum_canceling_reducer:public reduction_step {
350//  void reduce(red_object* r, int l, int u);
351//};
352struct find_erg{
353  poly expand;
354  int expand_length;
355  int to_reduce_u;
356  int to_reduce_l;
357  int reduce_by;//index of reductor
358  BOOLEAN fromS;//else from los
359
360};
361
362static void multi_reduce_step(find_erg & erg, red_object* r, slimgb_alg* c);
363static void finalize_reduction_step(reduction_step* r);
364
365template <class len_type, class set_type>  int pos_helper(kStrategy strat, poly p, len_type len, set_type setL, polyset set){
366  //Print("POSHELER:%d",sizeof(wlen_type));
367  int length=strat->sl;
368  int i;
369  int an = 0;
370  int en= length;
371
372  if ((len>setL[length])
373      || ((len==setL[length]) && (pLmCmp(set[length],p)== -1)))
374    return length+1;
375
376  loop
377  {
378    if (an >= en-1)
379    {
380      if ((len<setL[an])
381          || ((len==setL[an]) && (pLmCmp(set[an],p) == 1))) return an;
382      return en;
383    }
384    i=(an+en) / 2;
385    if ((len<setL[i])
386        || ((len==setL[i]) && (pLmCmp(set[i],p) == 1))) en=i;
387    //else if ((len>setL[i])
388    //|| ((len==setL[i]) && (pLmCmp(set[i],p) == -1))) an=i;
389    else an=i;
390  }
391
392}
393#ifdef NORO_CACHE
394typedef unsigned short tgb_uint16;
395typedef unsigned char tgb_uint8;
396typedef unsigned int tgb_uint32;
397class NoroCacheNode{
398public:
399  NoroCacheNode** branches;
400  int branches_len;
401
402 
403  NoroCacheNode(){
404    branches=NULL;
405    branches_len=0;
406   
407  }
408  NoroCacheNode* setNode(int branch, NoroCacheNode* node){
409    if (branch>=branches_len){
410      if (branches==NULL){
411        branches_len=branch+1;
412        branches_len=si_max(branches_len,3);
413        branches=(NoroCacheNode**) omalloc(branches_len*sizeof(NoroCacheNode*));
414        int i;
415        for(i=0;i<branches_len;i++){
416          branches[i]=NULL;
417        }
418      }else{
419        int branches_len_old=branches_len;
420        branches_len=branch+1;
421        branches=(NoroCacheNode**) omrealloc(branches,branches_len*sizeof(NoroCacheNode*));
422        int i;
423        for(i=branches_len_old;i<branches_len;i++){
424          branches[i]=NULL;
425        }
426      }
427    }
428    assume(branches[branch]==NULL);
429    branches[branch]=node;
430    return node;
431  }
432  NoroCacheNode* getBranch(int branch){
433    if (branch<branches_len) return branches[branch];
434    return NULL;
435  }
436  virtual ~NoroCacheNode(){
437    int i;
438    for(i=0;i<branches_len;i++){
439      delete branches[i];
440    }
441    omfree(branches);
442  }
443  NoroCacheNode* getOrInsertBranch(int branch){
444    if ((branch<branches_len)&&(branches[branch]))
445      return branches[branch];
446    else{
447      return setNode(branch,new NoroCacheNode());
448    }
449  }
450};
451class DenseRow{
452public:
453  number* array;
454  int begin;
455  int end;
456  DenseRow(){
457    array=NULL;
458  }
459  ~DenseRow(){
460    omfree(array);
461  }
462};
463class SparseRow{
464public:
465  int* idx_array;
466  number* coef_array;
467  int len;
468  SparseRow(){
469    len=0;
470    idx_array=NULL;
471    coef_array=NULL;
472  }
473  SparseRow(int n){
474    len=n;
475    idx_array=(int*) omalloc(n*sizeof(int));
476    coef_array=(number*) omalloc(n*sizeof(number));
477  }
478  ~SparseRow(){
479    omfree(idx_array);
480    omfree(coef_array);
481  }
482};
483
484class DataNoroCacheNode:public NoroCacheNode{
485public:
486 
487  int value_len;
488  poly value_poly;
489  #ifdef NORO_SPARSE_ROWS_PRE
490  SparseRow* row;
491  #else
492  DenseRow* row;
493  #endif
494  int term_index;
495  DataNoroCacheNode(poly p, int len){
496    value_len=len;
497    value_poly=p;
498    row=NULL;
499    term_index=-1;
500  }
501  #ifdef NORO_SPARSE_ROWS_PRE
502  DataNoroCacheNode(SparseRow* row){
503    if (row!=NULL)
504      value_len=row->len;
505    else
506      value_len=0;
507    value_poly=NULL;
508    this->row=row;
509    term_index=-1;
510  }
511  #endif
512  ~DataNoroCacheNode(
513  ){
514    //p_Delete(&value_poly,currRing);
515    if (row) delete row;
516  }
517};
518class NoroCache{
519public:
520  poly temp_term;
521  void evaluatePlaceHolder(number* row,std::vector<NoroPlaceHolder>& place_holders);
522  void collectIrreducibleMonomials( std::vector<DataNoroCacheNode*>& res);
523  void collectIrreducibleMonomials(int level,  NoroCacheNode* node, std::vector<DataNoroCacheNode*>& res);
524  void evaluateRows();
525  void evaluateRows(int level, NoroCacheNode* node);
526#ifdef NORO_RED_ARRAY_RESERVER
527  int reserved;
528  poly* recursionPolyBuffer;
529#endif
530  static const int backLinkCode=-222;
531  DataNoroCacheNode* insert(poly term, poly nf, int len){
532    //assume(impl.find(p_Copy(term,currRing))==impl.end());
533    //assume(len==pLength(nf));
534    assume(npIsOne(p_GetCoeff(term,currRing)));
535    if (term==nf){
536      term=p_Copy(term,currRing);
537
538      ressources.push_back(term);
539      nIrreducibleMonomials++;
540      return treeInsertBackLink(term);
541     
542    } else{
543     
544      if (nf){
545        //nf=p_Copy(nf,currRing);
546        assume(p_LmCmp(nf,term,currRing)==-1);
547        ressources.push_back(nf);
548      }
549      return treeInsert(term,nf,len);
550     
551    }
552   
553    //impl[term]=std::pair<PolySimple,int> (nf,len);
554  }
555  #ifdef NORO_SPARSE_ROWS_PRE
556  DataNoroCacheNode* insert(poly term, SparseRow* srow){
557    //assume(impl.find(p_Copy(term,currRing))==impl.end());
558    //assume(len==pLength(nf));
559
560      return treeInsert(term,srow);
561     
562 
563    //impl[term]=std::pair<PolySimple,int> (nf,len);
564  }
565  #endif
566  DataNoroCacheNode* insertAndTransferOwnerShip(poly t, ring r){
567   
568    ressources.push_back(t);
569    DataNoroCacheNode* res=treeInsertBackLink(t);
570    res->term_index=nIrreducibleMonomials;
571    nIrreducibleMonomials++;
572    return res;
573  }
574  poly lookup(poly term, BOOLEAN& succ, int & len);
575  DataNoroCacheNode* getCacheReference(poly term);
576  NoroCache(){
577    buffer=NULL;
578#ifdef NORO_RED_ARRAY_RESERVER
579    reserved=0;
580    recursionPolyBuffer=(poly*)omalloc(1000000*sizeof(poly));
581#endif
582    nIrreducibleMonomials=0;
583    nReducibleMonomials=0;
584    temp_term=pOne();
585  }
586#ifdef NORO_RED_ARRAY_RESERVER
587  poly* reserve(int n){
588    poly* res=recursionPolyBuffer+reserved;
589    reserved+=n;
590    return res;
591  }
592  void free(int n){
593    reserved-=n;
594  }
595#endif
596  ~NoroCache(){
597    int s=ressources.size();
598    int i;
599    for(i=0;i<s;i++){
600      p_Delete(&ressources[i].impl,currRing);
601    }
602    p_Delete(&temp_term,currRing);
603#ifdef NORO_RED_ARRAY_RESERVER
604    omfree(recursionPolyBuffer);
605#endif
606  }
607 
608  int nIrreducibleMonomials;
609  int nReducibleMonomials;
610protected:
611  DataNoroCacheNode* treeInsert(poly term,poly nf,int len){
612    int i;
613    nReducibleMonomials++;
614    int nvars=pVariables;
615    NoroCacheNode* parent=&root;
616    for(i=1;i<nvars;i++){
617      parent=parent->getOrInsertBranch(p_GetExp(term,i,currRing));
618    }
619    return (DataNoroCacheNode*) parent->setNode(p_GetExp(term,nvars,currRing),new DataNoroCacheNode(nf,len));
620  }
621  #ifdef NORO_SPARSE_ROWS_PRE
622  DataNoroCacheNode* treeInsert(poly term,SparseRow* srow){
623    int i;
624    nReducibleMonomials++;
625    int nvars=pVariables;
626    NoroCacheNode* parent=&root;
627    for(i=1;i<nvars;i++){
628      parent=parent->getOrInsertBranch(p_GetExp(term,i,currRing));
629    }
630    return (DataNoroCacheNode*) parent->setNode(p_GetExp(term,nvars,currRing),new DataNoroCacheNode(srow));
631  }
632  #endif
633  DataNoroCacheNode* treeInsertBackLink(poly term){
634    int i;
635    int nvars=pVariables;
636    NoroCacheNode* parent=&root;
637    for(i=1;i<nvars;i++){
638      parent=parent->getOrInsertBranch(p_GetExp(term,i,currRing));
639    }
640    return (DataNoroCacheNode*) parent->setNode(p_GetExp(term,nvars,currRing),new DataNoroCacheNode(term,backLinkCode));
641  }
642 
643  //@TODO descruct nodes;
644  typedef std::vector<PolySimple> poly_vec;
645  poly_vec ressources;
646  //typedef std::map<PolySimple,std::pair<PolySimple,int> > cache_map;
647  //cache_map impl;
648  NoroCacheNode root;
649  number* buffer;
650};
651MonRedResNP noro_red_mon_to_non_poly(poly t,  NoroCache* cache,slimgb_alg* c);
652template<class storage_type> SparseRow* noro_red_to_non_poly_t(poly p, int &len, NoroCache* cache,slimgb_alg* c){
653  assume(len==pLength(p));
654  poly orig_p=p;
655  if (p==NULL) {
656    len=0;
657    return NULL;
658  }
659 
660  number zero=npInit(0);
661  MonRedResNP* mon=(MonRedResNP*) omalloc(len*sizeof(MonRedResNP));
662  int i=0;
663
664  while(p){
665
666    poly t=p;
667    pIter(p);
668    pNext(t)=NULL;
669   
670#ifndef NDEBUG
671    number coef_debug=p_GetCoeff(t,currRing);
672#endif
673    MonRedResNP red=noro_red_mon_to_non_poly(t,cache,c);
674    mon[i]=red;
675    i++;
676  }
677 
678  assume(i==len);
679  len=i;
680  //in the loop before nIrreducibleMonomials increases, so position here is important
681  storage_type* temp_array=(storage_type*) omalloc(cache->nIrreducibleMonomials*sizeof(storage_type));
682  int temp_size=cache->nIrreducibleMonomials;
683  memset(temp_array,0,sizeof(storage_type)*cache->nIrreducibleMonomials);
684  for(i=0;i<len;i++){
685    MonRedResNP red=mon[i];
686    if ((red.ref)){
687      if (red.ref->row){
688        SparseRow* row=red.ref->row;
689        number coef=red.coef;
690        int j;
691        if (!(npIsOne(coef))){
692        for(j=0;j<row->len;j++){
693          int idx=row->idx_array[j];
694          assume(!(npIsZero(coef)));
695          assume(!(npIsZero(row->coef_array[j])));
696          temp_array[idx]=(storage_type) (unsigned int) npAddM((number) temp_array[idx],npMultM(row->coef_array[j],coef));
697          assume(idx<temp_size);
698        }}else{
699          for(j=0;j<row->len;j++){
700            int idx=row->idx_array[j];
701            temp_array[idx]=(storage_type) (unsigned int) npAddM((number) temp_array[idx],row->coef_array[j]);
702            assume(idx<temp_size);
703          }
704        }
705      }
706      else{
707        if (red.ref->value_len==NoroCache::backLinkCode){
708          temp_array[red.ref->term_index]=(storage_type) (unsigned int) npAddM((number) temp_array[red.ref->term_index],red.coef);
709        } else {
710          //PrintS("third case\n");
711        }
712      }
713    }
714  }
715  int non_zeros=0;
716  for(i=0;i<cache->nIrreducibleMonomials;i++){
717    if (!(temp_array[i]==0)){
718      non_zeros++;
719    }
720  }
721  SparseRow* res=new SparseRow(non_zeros);
722  int pos=0;
723  for(i=0;i<cache->nIrreducibleMonomials;i++){
724    if (!(0==temp_array[i])){
725   
726      res->idx_array[pos]=i;
727      res->coef_array[pos]=(number) temp_array[i];
728
729      pos++; 
730    }
731   
732  }
733  omfree(temp_array);
734
735  omfree(mon);
736  return res;
737}
738#endif
739static wlen_type pair_weighted_length(int i, int j, slimgb_alg* c);
740wlen_type pELength(poly p, ring r);
741void simplest_gauss_modp(number* a, int nrows,int ncols);
742
743// a: a[0,0],a[0,1]....a[nrows-1,ncols-1]
744// assume: field is Zp
745#endif
Note: See TracBrowser for help on using the repository browser.