File: schorder.hpp

package info (click to toggle)
macaulay2 1.21%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 133,096 kB
  • sloc: cpp: 110,377; ansic: 16,306; javascript: 4,193; makefile: 3,821; sh: 3,580; lisp: 764; yacc: 590; xml: 177; python: 140; perl: 114; lex: 65; awk: 3
file content (82 lines) | stat: -rw-r--r-- 2,241 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Copyright 2002  Michael E. Stillman

#ifndef _schorder_hpp_
#define _schorder_hpp_

#include "buffer.hpp"
#include "intarray.hpp"
#include "monoid.hpp"

class GBMatrix;
class Matrix;

class SchreyerOrder : public our_new_delete
{
  const Monoid *M;

  intarray _order;  // Each 'entry' is an array of ints of length _nslots:
                    // compare_num, followed by the (encoded) monomial.
  int _nslots;
  int _rank;

  SchreyerOrder(const Monoid *m)
      : M(m), _nslots(m->monomial_size() + 1), _rank(0)
  {
  }
  ~SchreyerOrder() { abort(); }
 public:
  static SchreyerOrder *create(const Monoid *m);
  static SchreyerOrder *create(const Matrix *m);
  static SchreyerOrder *create(const GBMatrix *m);

  void remove();

  int rank() const { return _rank; }
  int compare_num(int i) const { return _order[i * _nslots]; }
  const int *base_monom(int i) const { return _order.raw() + i * _nslots + 1; }
  const Monoid *getMonoid() const { return M; }
  bool is_equal(const SchreyerOrder *G) const;
  SchreyerOrder *copy() const;
  SchreyerOrder *sub_space(int n) const;
  SchreyerOrder *sub_space(M2_arrayint a) const;
  void append_order(const SchreyerOrder *G);
  SchreyerOrder *direct_sum(const SchreyerOrder *G) const;
  SchreyerOrder *tensor(const SchreyerOrder *G) const;
  SchreyerOrder *exterior(int p) const;

  SchreyerOrder *symm(int n) const;

  void append(int compare_num, const int *base_monom);
  // Copies the monomial

  void schreyer_up(const int *m, int comp, int *result) const
  // 'result' is allowed to be 'm'.
  {
    M->mult(m, base_monom(comp), result);
  }

  void schreyer_down(const int *m, int comp, int *result) const
  // 'result' is allowed to be 'm'.
  {
    M->divide(m, base_monom(comp), result);
  }

  int schreyer_compare(const int *m,
                       int m_comp,
                       const int *n,
                       int n_comp) const;

  int schreyer_compare_encoded(const int *m,
                               int m_comp,
                               const int *n,
                               int n_comp) const;

  void text_out(buffer &o) const;
};

#endif

// Local Variables:
// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
// indent-tabs-mode: nil
// End: