mirror of https://github.com/CGAL/cgal
Merge changes from 'releases/CGAL-4.8-branch'
- Merge pull request #1023 from mglisse/NewKernel_d-solve_check-glisse - Merge pull request #1025 from CGAL/Stream_support-Fix_io.h-lrineau
This commit is contained in:
commit
9ea630eeb1
|
|
@ -135,7 +135,12 @@ template<class NT_,class Dim_,class Max_dim_=Dim_> struct LA_eigen {
|
||||||
|
|
||||||
// m*a==b
|
// m*a==b
|
||||||
template<class DV, class DM, class V>
|
template<class DV, class DM, class V>
|
||||||
static bool solve(DV&a, DM const&m, V const& b){
|
static void solve(DV&a, DM const&m, V const& b){
|
||||||
|
//a = m.colPivHouseholderQr().solve(b);
|
||||||
|
a = m.fullPivLu().solve(b);
|
||||||
|
}
|
||||||
|
template<class DV, class DM, class V>
|
||||||
|
static bool solve_and_check(DV&a, DM const&m, V const& b){
|
||||||
//a = m.colPivHouseholderQr().solve(b);
|
//a = m.colPivHouseholderQr().solve(b);
|
||||||
a = m.fullPivLu().solve(b);
|
a = m.fullPivLu().solve(b);
|
||||||
return b.isApprox(m*a);
|
return b.isApprox(m*a);
|
||||||
|
|
|
||||||
|
|
@ -425,7 +425,11 @@ template<class R_> struct Contained_in_simplex : private Store_kernel<R_> {
|
||||||
}
|
}
|
||||||
m(d,i)=1;
|
m(d,i)=1;
|
||||||
}
|
}
|
||||||
if (!LA::solve(a,CGAL_MOVE(m),CGAL_MOVE(b))) return false;
|
// If the simplex has full dimension, there must be a solution, only the signs need to be checked.
|
||||||
|
if (n == d+1)
|
||||||
|
LA::solve(a,CGAL_MOVE(m),CGAL_MOVE(b));
|
||||||
|
else if (!LA::solve_and_check(a,CGAL_MOVE(m),CGAL_MOVE(b)))
|
||||||
|
return false;
|
||||||
for(int i=0;i<n;++i){
|
for(int i=0;i<n;++i){
|
||||||
if (a[i]<0) return false;
|
if (a[i]<0) return false;
|
||||||
}
|
}
|
||||||
|
|
@ -683,7 +687,6 @@ template <class R_> struct Construct_circumcenter : Store_kernel<R_> {
|
||||||
typedef typename LAd::Vector Vec;
|
typedef typename LAd::Vector Vec;
|
||||||
typename Get_functor<R_, Scalar_product_tag>::type sp(this->kernel());
|
typename Get_functor<R_, Scalar_product_tag>::type sp(this->kernel());
|
||||||
int k=static_cast<int>(std::distance(f,e));
|
int k=static_cast<int>(std::distance(f,e));
|
||||||
int d=pd(p0);
|
|
||||||
Matrix m(k,k);
|
Matrix m(k,k);
|
||||||
Vec b(k);
|
Vec b(k);
|
||||||
Vec l(k);
|
Vec l(k);
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
#include <CGAL/tags.h>
|
#include <CGAL/tags.h>
|
||||||
#include <CGAL/IO/io_tags.h>
|
#include <CGAL/IO/io_tags.h>
|
||||||
#include <CGAL/IO/Color.h>
|
#include <CGAL/IO/Color.h>
|
||||||
|
#include <CGAL/assertions.h>
|
||||||
|
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue