97{
101 {
102 ERROR(
"expected free modules over the same ring");
103 return nullptr;
104 }
105 if (D->n_vars() != static_cast<int>(deg->len))
106 {
107 ERROR(
"expected degree of matrix to have %d entries", D->n_vars());
108 return nullptr;
109 }
110
111 if (M != nullptr)
112 {
113 for (unsigned int i = 0; i < M->len; i++)
114 {
115 if (R != M->array[i]->get_ring())
116 {
117 ERROR(
"expected vectors in the same ring");
118 return nullptr;
119 }
120 }
121 }
122
124 D->from_expvector(deg->array, degshift);
126
127 if (M != nullptr)
128 {
129 unsigned int next = 0;
130 for (
int r = 0; r < target->
rank(); r++)
131 {
132 for (
int c = 0; c < source->
rank(); c++)
133 {
134 mat.set_entry(r, c, M->array[next]->get_value());
135 next++;
136 if (next >= M->len) break;
137 }
138 }
139 }
140 return mat.to_matrix();
141}
const Ring * get_ring() const
friend class MatrixConstructor
monomial make_one() const
const Monoid * degree_monoid() const