File: matrix-con.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 (62 lines) | stat: -rw-r--r-- 1,539 bytes parent folder | download
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
#ifndef matrixcon_hpp_
#define matrixcon_hpp_

#include <vector>
#include "ring.hpp"
#include <utility>

class MatrixGenerator;

/**
 * \ingroup matrices
 */
class MatrixConstructor
{
  const Ring *R;
  VECTOR(vec) entries;
  const FreeModule *rows;
  const FreeModule *cols;  // If cols is given at the beginning, this is used.
  // If this is immutable, no changes are allowed, other than to replace the
  // entire thing.

  bool cols_frozen;  // Once this is set, no more modifications to the 'cols'
                     // are allowed.  In particular, if the 'source' is set at
  // the beginning via the constructor, and that free module is
  // immutable, then no more changes are allowed.

  const int *deg;

  void compute_column_degree(int i);

 public:
  MatrixConstructor();
  MatrixConstructor(const FreeModule *target, int ncols);
  MatrixConstructor(const FreeModule *target,
                    const FreeModule *source,
                    const int *deg = 0);

  // The copy constructor just does the default thing: copy over all items.

  void append(vec v);
  void append(vec v, const int *deg);

  void set_entry(int r, int c, ring_elem a);
  void set_column(int c, vec v);

  void compute_column_degrees(); /* Takes into account the matrix degree */

  void set_column_degree(int i, const int *deg);

  void set_matrix_degree(const int *deg);

  Matrix *to_matrix();

  void debugDisplay() const;
};

#endif

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