Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dixon (dense) refacto #194

Merged
merged 23 commits into from
Jun 12, 2019
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ae40d1a
Renamed RationalSolver -> DixonSolver
Breush Apr 2, 2019
96f91c6
Put TAS_factors into its own structure
Breush Apr 2, 2019
c4c9b2f
Merge remote-tracking branch 'origin/benchmark-dense-solve' into dixo…
Breush Apr 2, 2019
2d026d9
Factorized TAS_LQUP into TAS structure
Breush Apr 3, 2019
0d64553
Refactored special case A == 0 into certifyEmpty function
Breush Apr 3, 2019
51120f9
Merge remote-tracking branch 'origin/benchmark-dense-solve' into dixo…
Breush Apr 8, 2019
380f77e
Factored out monolithicSolve inconsistency check.
Breush Apr 8, 2019
1734aeb
[WIP] Split dixon dense into separate files and factored out precondi…
Breush Apr 10, 2019
592f3e1
Merge remote-tracking branch 'origin/benchmark-dense-solve' into dixo…
Breush Apr 10, 2019
609012f
Fixed compilation since makeConditioner
Breush Apr 10, 2019
27a27af
Added dixon-solver files to make install
Breush Apr 12, 2019
9963a31
Cleaning a bit more
Breush Apr 12, 2019
5f46332
Annotated monolithic code
Breush Apr 12, 2019
0ddaa18
Started to use method as an input for dixon-solver
Breush Apr 12, 2019
3a82a5c
Dixon monolithicSolve -> use Method::Dixon as input parameter
Breush Apr 15, 2019
c878b1f
Now using DixonSolver<Method::DenseElimination> instead of DixonSolve…
Breush Apr 17, 2019
ebe7525
Factored out certifyMinimalDenominator
Breush May 2, 2019
a334b7f
Merge remote-tracking branch 'origin/master' into dixon-refacto
Breush May 22, 2019
8e01b28
Renamed rational-solver2 file to dixon-solver-symbolic-numeric. + Oth…
Breush May 22, 2019
1b00559
Tweaking comments
Breush May 22, 2019
a9754d0
Merge remote-tracking branch 'origin/master' into dixon-refacto
Breush Jun 4, 2019
91c21b0
Fixed issue with null matrices from test-regression, removed checkBla…
Breush Jun 4, 2019
ee0df76
Now using LAPACKPermToMathPerm
Breush Jun 4, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ examples/data/Makefile
doc/Makefile
linbox/Makefile
linbox/algorithms/Makefile
linbox/algorithms/dixon-solver/Makefile
linbox/algorithms/gauss/Makefile
linbox/algorithms/matrix-blas3/Makefile
linbox/algorithms/opencl-kernels/Makefile
Expand Down
2 changes: 1 addition & 1 deletion examples/solver/t-rdisolve.C
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ int test()
cout<<"' and Z/pZ of type '";
F.write(cout)<<"'"<<endl;

typedef RationalSolver<Ring, Field, class RandomPrime, Method::Dixon> QSolver;
typedef DixonSolver<Ring, Field, class RandomPrime, Method::DenseElimination> QSolver;
typedef DiophantineSolver<QSolver> ZSolver;

//typedef std::vector<std::pair<RingElement, RingElement> > FractionVector;
Expand Down
2 changes: 1 addition & 1 deletion linbox/algorithms/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

pkgincludesubdir=$(pkgincludedir)/algorithms

SUBDIRS=gauss opencl-kernels matrix-blas3 polynomial-matrix
SUBDIRS=dixon-solver gauss opencl-kernels matrix-blas3 polynomial-matrix
# IML

noinst_LTLIBRARIES=libalgorithms.la
Expand Down
4 changes: 2 additions & 2 deletions linbox/algorithms/det-rational.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ namespace LinBox
Integer lif = 1;
if ((s1 > 4*s2) && (!term)){
//cout << "lif " << std::flush;
RationalSolver < Givaro::IntegerDom , Givaro::Modular<double>, PrimeIterator<IteratorCategories::HeuristicTag>, Method::Dixon > RSolver;
LastInvariantFactor < Givaro::IntegerDom ,RationalSolver < Givaro::IntegerDom, Givaro::Modular<double>, PrimeIterator<IteratorCategories::HeuristicTag>, Method::Dixon > > LIF(RSolver);
DixonSolver < Givaro::IntegerDom , Givaro::Modular<double>, PrimeIterator<IteratorCategories::HeuristicTag>, Method::DenseElimination > RSolver;
LastInvariantFactor < Givaro::IntegerDom ,DixonSolver < Givaro::IntegerDom, Givaro::Modular<double>, PrimeIterator<IteratorCategories::HeuristicTag>, Method::DenseElimination > > LIF(RSolver);
IVect r_num2 (Z,Atilde. coldim());
t1.clear();
t1.start();
Expand Down
17 changes: 15 additions & 2 deletions linbox/algorithms/diophantine-solver.inl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,13 @@ namespace LinBox
SolverReturnStatus status;

//this should eliminate all inconsistent systems; when level == SL_MONTECARLO maybe not.
status = _rationalSolver.monolithicSolve(x, den, A, b, (level >= SL_LASVEGAS), true, maxPrimes, level);
Method::Dixon method;
method.certifyMinimalDenominator = (level >= SL_LASVEGAS);
method.certifyInconsistency = (level >= SL_LASVEGAS);
method.singularSolutionType = SingularSolutionType::Random;
method.trialsBeforeFailure = maxPrimes;

status = _rationalSolver.monolithicSolve(x, den, A, b, method);
if (status != SS_OK) {
if (status == SS_FAILED && maxPrimes > 2)
std::cout << "ERROR, failed to find original solution and maxPrimes is not too small!" << std::endl;
Expand Down Expand Up @@ -113,7 +119,14 @@ namespace LinBox
int boredom = 0; //used in monte carlo, when we assume there's a diophantine solution
while (! _ring.areEqual(upperDenBound, lowerDenBound)) {
_rationalSolver.chooseNewPrime();
status = _rationalSolver.monolithicSolve(x, den, A, b, (level >= SL_LASVEGAS), true, 1, level);

Method::Dixon method;
method.certifyMinimalDenominator = (level >= SL_LASVEGAS);
method.certifyInconsistency = (level >= SL_LASVEGAS);
method.singularSolutionType = SingularSolutionType::Random;
method.trialsBeforeFailure = 1;

status = _rationalSolver.monolithicSolve(x, den, A, b, method);
numSolutionsNeeded++;
#ifdef DEBUG_DIO
std::cout << '.' ;
Expand Down
26 changes: 26 additions & 0 deletions linbox/algorithms/dixon-solver/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright (c) 2010 the LinBox group
# written by Brice Boyer <boyer.brice@gmail.com>
# ========LICENCE========
# This file is part of the library LinBox.
#
# LinBox is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# ========LICENCE========

pkgincludesubdir=$(pkgincludedir)/algorithms/dixon-solver

pkgincludesub_HEADERS = \
dixon-solver-common.inl \
dixon-solver-dense.h \
dixon-solver-dense.inl
46 changes: 46 additions & 0 deletions linbox/algorithms/dixon-solver/dixon-solver-common.inl
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (C) LinBox Team
*
* ========LICENCE========
* This file is part of the library LinBox.
*
* LinBox is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* ========LICENCE========
*/
#pragma once

namespace LinBox {
/*! @brief NO DOC !
* @bug why is this hard coded ?
*/
template <class Prime>
inline bool checkBlasPrime(const Prime& p)
{
return p < Prime(67108863);
}

template<>
inline bool checkBlasPrime(const BlasVector<Givaro::ZRing<Integer>>& p)
{
bool tmp=true;
for (size_t i=0;i<p.size();++i)
if (p[i] >= integer(67108863)) {
Breush marked this conversation as resolved.
Show resolved Hide resolved
tmp=false;
break;
}

return tmp;
}
}
Loading