| 231 | |
| 232 | |
| 233 | static BOOLEAN build_ring(leftv result, leftv arg) |
| 234 | { |
| 235 | nforder *o; |
| 236 | if (arg->Typ() == LIST_CMD) { |
| 237 | lists L = (lists)arg->Data(); |
| 238 | int n = lSize(L)+1; |
| 239 | bigintmat **multtable = (bigintmat**)omAlloc(n*sizeof(bigintmat*)); |
| 240 | for(int i=0; i<n; i++) { |
| 241 | multtable[i] = (bigintmat*)(L->m[i].Data()); |
| 242 | } |
| 243 | o = new nforder(n, multtable, nInitChar(n_Z, 0)); |
| 244 | omFree(multtable); |
| 245 | } else { |
| 246 | assume(arg->Typ() == INT_CMD); |
| 247 | int dimension = (int)(long)arg->Data(); |
| 248 | |
| 249 | bigintmat **multtable = (bigintmat**)omAlloc(dimension*sizeof(bigintmat*)); |
| 250 | arg = arg->next; |
| 251 | for (int i=0; i<dimension; i++) { |
| 252 | multtable[i] = new bigintmat((bigintmat*)arg->Data()); |
| 253 | arg = arg->next; |
| 254 | } |
| 255 | o = new nforder(dimension, multtable, nInitChar(n_Z, 0)); |
| 256 | for (int i=0; i<dimension; i++) { |
| 257 | delete multtable[i]; |
| 258 | } |
| 259 | omFree(multtable); |
| 260 | } |
| 261 | result->rtyp=CRING_CMD; // set the result type |
| 262 | result->data=(char*)nInitChar(nforder_type, o);// set the result data |
| 263 | |
| 264 | return FALSE; |
| 265 | } |
| 266 | |
| 267 | static BOOLEAN ideal_from_mat(leftv result, leftv arg) |
| 268 | { |