From 140fb358006c101ff10d8410bcaef3c30dab6fcf Mon Sep 17 00:00:00 2001 From: Chenxin Zhong Date: Fri, 1 May 2026 00:13:02 +0800 Subject: [PATCH] Add Hadamard bound include and update determinant function --- linbox/solutions/det.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/linbox/solutions/det.h b/linbox/solutions/det.h index 4eda50517..7a591db96 100644 --- a/linbox/solutions/det.h +++ b/linbox/solutions/det.h @@ -34,6 +34,7 @@ #include "linbox/blackbox/compose.h" #include "linbox/solutions/methods.h" #include "linbox/solutions/getentry.h" +#include "linbox/solutions/hadamard-bound.h" #include "linbox/vector/blas-vector.h" #include "linbox/matrix/dense-matrix.h" @@ -47,6 +48,8 @@ #include "linbox/util/debug.h" #include "linbox/util/mpicpp.h" +#include + // Namespace in which all LinBox library code resides namespace LinBox @@ -607,6 +610,29 @@ namespace LinBox namespace LinBox { + template + Integer &det (Integer &d, + const BlasMatrix, Rep> &A, + const RingCategories::IntegerTag &, + const MyMethod &Meth) + { + if (A.coldim() != A.rowdim()) + throw LinboxError("LinBox ERROR: matrix must be square for determinant computation\n"); + + if (A.coldim() == 0) + return d = 1; + + size_t det_bound_bits = static_cast(std::ceil(HadamardBound(A) + 1.0)); + + typedef Givaro::ModularBalanced Field; + IntegerModularDet, Rep>, MyMethod> iteration(A, Meth); + PrimeIterator genprime(FieldTraits::bestBitSize(A.coldim())); + ChineseRemainder< CRABuilderFullSingle< Field > > cra(det_bound_bits); + cra(d, iteration, genprime); + + return d; + } + template typename Blackbox::Field::Element &det (typename Blackbox::Field::Element &d, const Blackbox &A,