Skip to content

Commit a4ff4b3

Browse files
committed
factor function zeromatrix
1 parent 7277fb2 commit a4ff4b3

File tree

3 files changed

+14
-43
lines changed

3 files changed

+14
-43
lines changed

linbox/algorithms/bbcharpoly.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ namespace LinBox
204204
FM* depend = NULL;
205205
for (size_t j = 1; j <= exp[i]; ++j){
206206
IntPoly * tmp2 = new IntPoly(*tmp);
207-
// FieldPoly *tmp2p = new FieldPoly(tmp2->size());
208-
// typename IntPoly::template rebind<Field>() (*tmp2p, *tmp2, F);
207+
// FieldPoly *tmp2p = new FieldPoly(tmp2->size());
208+
// typename IntPoly::template rebind<Field>() (*tmp2p, *tmp2, F);
209209
FieldPoly *tmp2p = new FieldPoly(*tmp2, F);
210210

211211
FFM = new FM (tmp2p, tmp2, 0, depend);
@@ -223,8 +223,8 @@ namespace LinBox
223223
leadingBlocks.insert (std::pair<FM*,bool>(FFM,false));
224224
}
225225
else {
226-
// FieldPoly* fp=new FieldPoly(intFactors[i].size());
227-
// typename IntPoly::template rebind<Field>() (*fp, (intFactors[i]), F);
226+
// FieldPoly* fp=new FieldPoly(intFactors[i].size());
227+
// typename IntPoly::template rebind<Field>() (*fp, (intFactors[i]), F);
228228
IntPoly * ip=new IntPoly(intFactors[i]);
229229
FieldPoly* fp=new FieldPoly(intFactors[i], F);
230230

@@ -285,15 +285,15 @@ namespace LinBox
285285

286286
/* Computation of the minimal polynomial */
287287
Polynomial minPoly(F);
288-
minpoly (minPoly, A, M);
288+
minpoly (minPoly, A, M);
289289
//PD.write(std::cerr<<"Minpoly = ",minPoly) << std::endl;
290290

291291
if (minPoly.size() == n+1){
292292
commentator().stop ("done", NULL, "MbbCharpoly");
293293
return P = minPoly;
294294
}
295295

296-
296+
297297

298298
Polynomial charPoly (F);
299299

linbox/algorithms/massey-domain.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,6 @@ namespace LinBox
348348

349349
commentator().stop ("done", NULL, "masseyd");
350350
// commentator().stop ("Done", "Done", "LinBox::MasseyDomain::massey");
351-
std::cerr<<"SEQ: "<<S<<std::endl;
352351
return L;
353352
}
354353

tests/test-regression.C

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,8 @@ bool testDixonSmallFat() {
570570
return success = ZZ.areEqual(r[0], b[0]);
571571
}
572572

573-
bool testZeroMatrixCharPoly() {
573+
template<typename CMethod=Method::Blackbox>
574+
bool testZeroMatrixCharPoly(const CMethod& cMeth=CMethod()) {
574575
bool success;
575576
using Ring = Givaro::Modular<double>;
576577
using Matrix = SparseMatrix<Ring>;
@@ -581,7 +582,7 @@ bool testZeroMatrixCharPoly() {
581582

582583
PolynomialRing<Ring>::Element c_A, Ex;
583584

584-
charpoly(c_A, A);
585+
charpoly(c_A, A, RingCategories::ModularTag(), cMeth );
585586

586587
PolynomialRing<Ring> PZ(R,'X'); PZ.assign(Ex, Givaro::Degree(1), R.one);
587588

@@ -596,38 +597,7 @@ bool testZeroMatrixCharPoly() {
596597
}
597598
return false;
598599
} else
599-
if (writing) std::cout << "ZMCP: PASSED" << std::endl;
600-
601-
return success;
602-
}
603-
bool testZeroSymmetricMatrixCharPoly() {
604-
bool success;
605-
using Ring = Givaro::Modular<double>;
606-
using Matrix = SparseMatrix<Ring>;
607-
Ring R(3);
608-
609-
Matrix A(R, 1, 1);
610-
A.setEntry(0, 0, R.zero);
611-
612-
PolynomialRing<Ring>::Element c_A, Ex;
613-
614-
615-
charpoly(c_A, A, RingCategories::ModularTag(), Method::Blackbox(Shape::Symmetric));
616-
617-
PolynomialRing<Ring> PZ(R,'X'); PZ.assign(Ex, Givaro::Degree(1), R.one);
618-
619-
success = PZ.areEqual(c_A, Ex);
620-
621-
if (!success) {
622-
if (writing) {
623-
std::clog<<"**** ERROR **** Fail ZSMCP " <<std::endl;
624-
625-
PZ.write(std::clog << "Ex: ", Ex) << std::endl;
626-
PZ.write(std::clog << "cA: ", c_A) << std::endl;
627-
}
628-
return false;
629-
} else
630-
if (writing) std::cout << "ZSMCP: PASSED" << std::endl;
600+
if (writing) std::cout << "ZMCP" << cMeth.name() << cMeth.shapeFlags.flags << " : PASSED" << std::endl;
631601

632602
return success;
633603
}
@@ -706,8 +676,10 @@ int main (int argc, char **argv)
706676
pass &= testSparseDiagDet(46);
707677
pass &= testZeroDimensionalCharPoly ();
708678
pass &= testZeroDimensionalMinPoly ();
709-
pass &= testZeroMatrixCharPoly();
710-
pass &= testZeroSymmetricMatrixCharPoly();
679+
pass &= testZeroMatrixCharPoly<>();
680+
pass &= testZeroMatrixCharPoly(Method::Blackbox(Shape::Symmetric));
681+
pass &= testZeroMatrixCharPoly(Method::DenseElimination());
682+
// pass &= testZeroMatrixCharPoly(Method::SparseElimination());
711683
pass &= testBigScalarCharPoly ();
712684
pass &= testLocalSmith ();
713685
pass &= testInconsistent<DenseMatrix<ZRingInts>> (Method::DenseElimination());

0 commit comments

Comments
 (0)