Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Re: Precondition_exception in Sign_Sturm_sequence.h

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Re: Precondition_exception in Sign_Sturm_sequence.h


Chronological Thread 
  • From: Daniel Russel <>
  • To:
  • Subject: Re: [cgal-discuss] Re: Precondition_exception in Sign_Sturm_sequence.h
  • Date: Tue, 29 Apr 2008 15:19:37 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:in-reply-to:content-type:content-transfer-encoding:mime-version:subject:date:references:x-mailer; b=bHkh0mn7auGipHeEZ3asbhaL4GUPrNCxFFHBItQ1i/fRr8BgnvJsJ/e/gBsIM7OTayfXJa7ZNg8VgF8aSTtceL79D7hXHuEyRcBtKx8Kw8WOjcAuNxoF2HuqLEXO4YIigpjX9HitPxoosoyu/sgpXYqvOjIt7nKrJirF4552DYE=

Try replacing
typedef CGAL::Exact_predicates_exact_constructions_kernel Static_kernel;
with
typedef CGAL::Cartesian<CGAL::Gmpq> Static_kernel;

That should shift things to use the Gmpq number type rather than the Lazy_exact_nt. The latter doesn't ever print the exact representation (as it might be quite complicated). If you can't reproduce the problem with Gmpq. there may be an issue with Laxy_exact_nt and if you can reproduce it, it should be clearer what is going on.

Sorry about the slow response, I have been at a meeting.


On Apr 25, 2008, at 6:15 AM, Mathieu Brédif wrote:

If it can help, I get an other problem that seems related in :
-----------------
template<class K, class Time>
unsigned int get_multiplicity(const typename K::Function& f, const K&
k, const Time& t) {
if(f.degree() == -1) return (unsigned int) -1; // null function
typename K::Function h=f;
unsigned int deg=0;
typename K::Sign_at sign= k.sign_at_object();
typename K::Differentiate diff=k.differentiate_object();
while (sign(h, t)==CGAL::ZERO) { <---------------- throws exception
++deg;
h=diff(h);
}
return deg;
};
------------------------

the exception is :

--------------------------------------------------
CGAL error: assertion violation!
Expr: p_(v) == 0
File: /usr/include/CGAL/Polynomial/Sturm_root_stack.h
Line: 167
-----------------------------------------
the corresponding code is:

if (p_.degree() == 1) {
NT v= -p_[0]/p_[1];
CGAL_assertion(p_(v) == 0);
....
}
so it does not seem related to the particular root t but rather to the
polynom p_ and the exactness of p_[0]-p_[1]*p_[0]/p_[1]==CGAL::ZERO.

The values ouput by "std::cout <<" that cause the problem are :
f=-0.894427191-0.105572809*t
t=0

The roots that cause the problem in the previous mail were both output as :
-0.12132034356+0.192388155425*t+0.100505063388*t^2 in [0,1] = 0.5...0.5

Is there a way to backup exactly the value of a Function to be able to
reproduce my problem with a small piece of code ?

Thanks,
Mathieu

On Fri, Apr 25, 2008 at 2:17 PM, Mathieu Brédif
<>
wrote:
Hi,
I have some trouble tracking done the cause of this precondition_exception :

----------------------
Expr: s0 != CGAL::ZERO
File: /usr/include/CGAL/Polynomial/internal/Rational/ Sign_Sturm_sequence.h
Line: 57
Explanation:
terminate called after throwing an instance of 'CGAL::Precondition_exception'
what(): CGAL ERROR: precondition violation!
Expr: s0 != CGAL::ZERO
File: /usr/include/CGAL/Polynomial/internal/Rational/ Sign_Sturm_sequence.h
Line: 57
-----------------

This exception is triggered when i am comparing 2 roots for equality.
The traits i use are :

typedef CGAL::Exact_predicates_exact_constructions_kernel Static_kernel;
typedef CGAL::POLYNOMIAL::Polynomial<Static_kernel::FT> Function;
typedef CGAL::POLYNOMIAL::Sturm_root_stack_traits<Function> Root_stack_traits;
typedef CGAL::POLYNOMIAL::Sturm_root_stack<Root_stack_traits> Root_stack;
typedef CGAL::POLYNOMIAL::Kernel<Function, Root_stack> Function_kernel;

Am i doing something wrong ?

thanks
Mathieu Bredif


--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss





Archive powered by MHonArc 2.6.16.

Top of Page