Macaulay2 Engine
Loading...
Searching...
No Matches
dmat-lu-zzp-ffpack.hpp
Go to the documentation of this file.
1
32
34// ZZpFFPACK /////////
36namespace ffpackInterface {
37// Functions for DMatZZpFFPACK, in dmat.cpp
38size_t rank(const DMatZZpFFPACK& A);
39
40void determinant(const DMatZZpFFPACK& A, ZZpFFPACK::ElementType& result_det);
41
42M2_arrayintOrNull rankProfile(const DMatZZpFFPACK& A, bool row_profile);
43
44void rankProfile(const DMatZZpFFPACK& A,
45 bool row_profile,
46 std::vector<size_t>& result_profile);
47
48bool solveLinear(const DMatZZpFFPACK& A,
49 const DMatZZpFFPACK& B,
50 DMatZZpFFPACK& X);
51
52bool inverse(const DMatZZpFFPACK& A, DMatZZpFFPACK& result_inv);
53
54size_t nullSpace(const DMatZZpFFPACK& A, DMatZZpFFPACK& result_nullspace);
55
56}; // namespace ffpackInterface
57
72template <>
73class DMatLinAlg<M2::ARingZZpFFPACK>
74{
75 public:
79
80 public:
81 DMatLinAlg(const Mat& A) : mLU(A) {}
82 size_t rank() { return ffpackInterface::rank(mLU); }
87
88 void columnRankProfile(std::vector<size_t>& profile)
89 {
90 ffpackInterface::rankProfile(mLU, false, profile);
91 }
92
93 void matrixPLU(std::vector<size_t>& P, Mat& L, Mat& U)
94 {
95 // std::cout << "calling matrixPLU ffpack\n";
96
98
99 const Mat& LU = C.LUinPlace();
100
102 P = C.permutation();
103 }
104
105 bool solve(const Mat& B, Mat& X)
106 {
107 return ffpackInterface::solveLinear(mLU, B, X);
108 }
109
110 bool solveInvertible(const Mat& B, Mat& X)
111 {
112 return ffpackInterface::solveLinear(mLU, B, X);
113 }
114
115 bool inverse(Mat& X) { return ffpackInterface::inverse(mLU, X); }
116 size_t kernel(Mat& X) { return ffpackInterface::nullSpace(mLU, X); }
117 private:
118 const Mat& mLU; // reference to the original matrix
119};
120
121// Local Variables:
122// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
123// indent-tabs-mode: nil
124// End:
Definition dmat.hpp:62
const Mat & LUinPlace()
const std::vector< size_t > & permutation()
void columnRankProfile(std::vector< size_t > &profile)
bool solveInvertible(const Mat &B, Mat &X)
void determinant(ElementType &result)
void matrixPLU(std::vector< size_t > &P, Mat &L, Mat &U)
static void setUpperLower(const Mat &LU, Mat &lower, Mat &upper)
FieldType::Element ElementType
wrapper for the FFPACK::ModularBalanced<double> field implementation
VALGRIND_MAKE_MEM_DEFINED & result(result)
M2_arrayint M2_arrayintOrNull
Definition m2-types.h:99
#define DMatZZpFFPACK
Definition aring-CC.cpp:3
void determinant(const DMatZZpFFPACK &A, ZZpFFPACK::ElementType &result_det)
Definition dmat.cpp:92
bool inverse(const DMatZZpFFPACK &A, DMatZZpFFPACK &result_inv)
Definition dmat.cpp:113
size_t rank(const DMatZZpFFPACK &A)
Definition dmat.cpp:80
size_t nullSpace(const DMatZZpFFPACK &A, DMatZZpFFPACK &result_nullspace)
Definition dmat.cpp:136
M2_arrayintOrNull rankProfile(const DMatZZpFFPACK &A, bool row_profile)
Definition dmat.cpp:237
bool solveLinear(const DMatZZpFFPACK &A, const DMatZZpFFPACK &B, DMatZZpFFPACK &X)
Definition dmat.cpp:230