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

◆ rawLinAlgMinPoly()

Definition at line 1040 of file mutable-matrix.cpp.

1043{
1044 (void) A;
1045#if 1
1046#if 0
1047 const Ring *R = A->get_ring();
1050 if (B == 0)
1051 {
1052 ERROR("expected a dense mutable matrix over the ffpack finite field");
1053 return 0;
1054 }
1055 typedef M2::ARingZZpFFPACK::ElementType Element;
1056 typedef std::vector<Element> Polynomial;
1057
1058 Element *elemsA = B->get_Mat()->array();
1059 size_t n = B->n_rows();
1060 Polynomial minpoly(n);
1061
1062 // the following are uninitialized! This is scratch space for use in the
1063 // algorithm, apparently...
1064 Element *X = new Element[n * (n + 1)];
1065 size_t *P = new size_t[n];
1066
1067 // this is in ffpack 2.3 but not in 2.2, and it might be the wrong name now, was MinPoly before
1068 FFPACK::Protected::Hybrid_KGF_LUK_MinPoly(
1069 B->get_Mat()->ring().field(), minpoly, n, elemsA, n, X, n, P);
1070
1071 delete[] P;
1072 delete[] X;
1073
1074 for (size_t i = 0; i < minpoly.size(); i++) std::cout << minpoly[i] << " ";
1075 std::cout << std::endl;
1076 return convertRingelemsToArray(R, minpoly);
1077#else
1078 return nullptr;
1079#endif
1080#else
1081 ERROR("not implemented: configure M2 with --enable-ffpack-fflas");
1082 return 0;
1083#endif
1084}
Definition dmat.hpp:62
FieldType::Element ElementType
virtual size_t n_rows() const
MutableMat< MatType > * cast_to_MutableMat()
Definition mat.hpp:139
virtual const Ring * get_ring() const =0
xxx xxx xxx
Definition ring.hpp:102
DMat< M2::ARingZZp > DMatZZp
const int ERROR
Definition m2-mem.cpp:55
engine_RawRingElementArray convertRingelemsToArray(const Ring *R, std::vector< M2::ARingZZpFFPACK::ElementType > &elems)

References MutableMatrix::cast_to_MutableMat(), convertRingelemsToArray(), ERROR, MutableMat< Mat >::get_Mat(), MutableMatrix::get_ring(), and MutableMat< Mat >::n_rows().