Macaulay2 Engine
Loading...
Searching...
No Matches

◆ DetComputation()

DetComputation::DetComputation ( const Matrix * M,
int p,
bool do_exterior,
int strategy )

Definition at line 8 of file det.cpp.

12 : R(M0->get_ring()),
13 M(M0),
14 done(false),
15 p(p0),
16 do_exterior(do_exterior0),
17 strategy(strategy0),
18 row_set(nullptr),
19 col_set(nullptr),
20 this_row(0),
21 this_col(0),
22 D(nullptr),
24{
25 if (do_exterior)
26 {
27 F = M->rows()->exterior(p);
28 FreeModule *G = M->cols()->exterior(p);
29 int *deg = R->degree_monoid()->make_new(M->degree_shift());
30 R->degree_monoid()->power(deg, p, deg);
31 result = MatrixConstructor(F, G, deg);
32 R->degree_monoid()->remove(deg);
33 }
34 else
35 {
36 F = R->make_FreeModule(1);
37 result = MatrixConstructor(F, 0);
38 }
39
40 // Handle trivial cases
41 if (p < 0)
42 {
43 // In either case, want a zero matrix
44 done = true;
45 return;
46 }
47 if (p == 0)
48 {
49 // We want a single element which is '1'
50 if (do_exterior)
51 result.set_entry(0, 0, R->one());
52 else
53 result.append(R->make_vec(0, R->one()));
54 done = true;
55 return;
56 }
57 if (p > M->n_rows() || p > M->n_cols())
58 {
59 // Zero matrix in either case
60 done = true;
61 return;
62 }
63 done = false;
64
65 row_set = newarray_atomic(size_t, p);
66 col_set = newarray_atomic(size_t, p);
67
68 for (size_t i = 0; i < p; i++)
69 {
70 row_set[i] = i;
71 col_set[i] = i;
72 }
73
74 D = newarray(ring_elem *, p);
75 for (size_t i = 0; i < p; i++)
76 {
77 D[i] = newarray(ring_elem, p);
78 for (size_t j = 0; j < p; j++) D[i][j] = ZERO_RINGELEM;
79 }
80}
MinorsCache dynamic_cache
Definition det.hpp:99
const Ring * R
Definition det.hpp:56
size_t * row_set
Definition det.hpp:75
size_t * col_set
Definition det.hpp:76
ring_elem ** D
Definition det.hpp:80
MatrixConstructor result
Definition det.hpp:62
const FreeModule * F
Definition det.hpp:58
int strategy
Definition det.hpp:72
int this_col
Definition det.hpp:78
bool done
Definition det.hpp:66
bool do_exterior
Definition det.hpp:69
int this_row
Definition det.hpp:77
const Matrix * M
Definition det.hpp:57
#define newarray(T, len)
Definition newdelete.hpp:82
#define newarray_atomic(T, len)
Definition newdelete.hpp:91
tbb::flow::graph G
#define ZERO_RINGELEM
Definition ring.hpp:677

References col_set, D, do_exterior, done, dynamic_cache, F, G, M, Matrix, newarray, newarray_atomic, p, R, result, row_set, strategy, this_col, this_row, and ZERO_RINGELEM.