GiNaC-list
Threads by month
- ----- 2026 -----
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1999 -----
- December
March 2011
- 4 participants
- 4 discussions
Hello,
it seems the error was given by the explicit destructor I wrote for
the class rinterval,
which I didn't attach in my first mail.
Indeed, erasing from the code the destructor
rinterval::~rinterval()
{
min.~numeric();
max.~numeric();
error.~numeric();
}
the code works fine.
Thank you,
best regards
Isaia
On Wed, Mar 30, 2011 at 7:51 AM, <ginac-list-request(a)ginac.de> wrote:
> Send GiNaC-list mailing list submissions to
> ginac-list(a)ginac.de
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://www.cebix.net/mailman/listinfo/ginac-list
> or, via email, send a message with subject or body 'help' to
> ginac-list-request(a)ginac.de
>
> You can reach the person managing the list at
> ginac-list-owner(a)ginac.de
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of GiNaC-list digest..."
>
>
> Today's Topics:
>
> 1. Re: GiNaC-list Digest, Vol 69, Issue 3 (Nisoli Isaia)
> 2. Re: assignment (Alexei Sheplyakov)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 29 Mar 2011 12:23:46 +0200
> From: Nisoli Isaia <nisoli(a)mail.dm.unipi.it>
> To: ginac-list(a)ginac.de
> Subject: Re: [GiNaC-list] GiNaC-list Digest, Vol 69, Issue 3
> Message-ID: <BANLkTinJO+gc8FWFAJaDvghxQeExB7eUVQ(a)mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Dear Alexel,
> even with your suggested correction, it gives exactly the same error.
> I think the problem lies in some way in my assignment operator, when I use
> the overloaded operator= of numeric.
>
>
> rinterval& rinterval::operator=(const rinterval &rhs)
> {
> if (this == &rhs) return *this; // Same object?
> else
> {
> try
> {
> this->min=rhs.min;
> // I expect here the assignment operator of numeric to destroy the old
> instance of min and create a new one
> // but it seems like he simply slices rhs.min to fit into min, therefore
> losing some information about the precision
> // of rhs.min; I tried also this using the CLN library and, if I define min
> as a cl_R and rhs.min is a cl_LF, when I come to this point
> // it seems like the precision of min doesn't change, even if the precision
> of rhs.min is bigger;
> // I would like the assignment operator to destroy the former istance of min
> and build a new one, but it doesn't seem to work
> // I tried calling the destructors explictly, but it doesn't work either.
> this->max=rhs.max;
> error=rhs.error;
> }
> catch(std::exception & exc)
> {
> std:cerr << "Exception" << exc.what() << endl;
> }
> return *this;
> }
> }
>
> Best regards
> Isaia
>
> On Tue, Mar 29, 2011 at 12:00 PM, <ginac-list-request(a)ginac.de> wrote:
>
>> Send GiNaC-list mailing list submissions to
>> ginac-list(a)ginac.de
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>> https://www.cebix.net/mailman/listinfo/ginac-list
>> or, via email, send a message with subject or body 'help' to
>> ginac-list-request(a)ginac.de
>>
>> You can reach the person managing the list at
>> ginac-list-owner(a)ginac.de
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of GiNaC-list digest..."
>>
>>
>> Today's Topics:
>>
>> 1. assignment (Nisoli Isaia)
>> 2. Re: assignment (Alexei Sheplyakov)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Mon, 28 Mar 2011 11:33:53 +0200
>> From: Nisoli Isaia <nisoli(a)mail.dm.unipi.it>
>> To: ginac-list(a)ginac.de
>> Subject: [GiNaC-list] assignment
>> Message-ID: <BANLkTi=ebBvqzhPPdPiZGXfKatwgt64+fw(a)mail.gmail.com>
>> Content-Type: text/plain; charset="iso-8859-1"
>>
>> Dear all,
>> I have a problem with Ginac.
>> I'm sorry if my question seems stupid, but I cannot solve the issue.
>>
>> So, I define a new class:
>>
>> class rinterval
>> {
>> public:
>> numeric min;
>> numeric max;
>> numeric error;
>>
>> //Constructor
>> rinterval();
>> rinterval(const numeric &, const numeric &, const numeric &);
>> //Destructor
>> ~rinterval();
>> //Friend
>> friend const rinterval dynamic(const rinterval &);
>> friend std::ostream &operator<< (std::ostream &os, const rinterval
>> &inter)
>> {
>> return os << "[" << inter.min << "," << inter.max <<"], error = " <<
>> inter.error << endl;
>> };
>> rinterval& operator=(const rinterval &rhs);
>> };
>>
>> The involved functions are these
>>
>> rinterval::rinterval(const numeric &input1, const numeric &input2, const
>> numeric &miserr)
>> {
>> if (input1>input2)
>> {
>> min=input2;
>> max=input1;
>> }
>> else
>> {
>> min=input1;
>> max=input2;
>> }
>> error=miserr;
>> }
>>
>> const rinterval dynamic(const rinterval &domain)
>> {
>> numeric a="1.47777777777777777777777777779999";
>> rinterval temp(a*domain.min,a*domain.max,domain.error);
>> cout << temp;
>> return temp;
>> }
>>
>> rinterval& rinterval::operator=(const rinterval &rhs)
>> {
>> if (this == &rhs) return *this; // Same object?
>> else
>> {
>> try
>> {
>> this->min=rhs.min;
>> this->max=rhs.max;
>> error=rhs.error;
>> }
>> catch(std::exception & exc)
>> {
>> std:cerr << "Exception" << exc.what() << endl;
>> }
>> return *this;
>> }
>> }
>>
>> Now, if inside the main I do
>>
>> int main (void)
>> {
>> numeric a(1,10);
>> numeric b(2,10);
>> rinterval inter(a,b,(numeric)0.00001);
>> inter=dynamic(inter);
>> cout << inter << endl;
>> }
>>
>> I get the following error:
>> *** glibc detected *** ./invmeasure.exe: invalid fastbin entry (free):
>> 0x00000000008ec340 ***
>> ======= Backtrace: =========
>> /lib/libc.so.6(+0x774b6)[0x7f2c9b11a4b6]
>> /lib/libc.so.6(cfree+0x73)[0x7f2c9b120c83]
>> /usr/lib/libcln.so.6(+0x6fa0d)[0x7f2c9ad91a0d]
>>
>> /usr/lib/libcln.so.6(_ZN3cln11print_floatERSoRKNS_20cl_print_float_flagsERKNS_4cl_FE+0x29)[0x7f2c9ad92d39]
>> /usr/lib/libginac-1.5.so.0(+0x1ddb5b)[0x7f2c9bfbfb5b]
>>
>> /usr/lib/libginac-1.5.so.0(_ZNK5GiNaC7numeric13print_numericERKNS_13print_contextEPKcS5_S5_S5_j+0x97)[0x7f2c9bfc0857]
>>
>> /usr/lib/libginac-1.5.so.0(_ZNK5GiNaC7numeric8do_printERKNS_13print_contextEj+0x28)[0x7f2c9bfc0e48]
>>
>> /usr/lib/libginac-1.5.so.0(_ZNK5GiNaC5basic14print_dispatchERKNS_10class_infoINS_24registered_class_optionsEEERKNS_13print_contextEj+0x18b)[0x7f2c9be6c62b]
>> /usr/lib/libginac-1.5.so.0(_ZN5GiNaClsERSoRKNS_2exE+0x9e)[0x7f2c9bfe5c2e]
>> ./invmeasure.exe[0x404261]
>> ./invmeasure.exe[0x403808]
>> /lib/libc.so.6(__libc_start_main+0xfe)[0x7f2c9b0c1d8e]
>> ./invmeasure.exe[0x403439]
>> ======= Memory map: ========
>> 00400000-00407000 r-xp 00000000 08:07 66333
>> /home/isaia/Dropbox/HTGFL/GN-Comput_inv_1D/codice/invmeasure.exe
>> 00607000-00608000 r--p 00007000 08:07 66333
>> /home/isaia/Dropbox/HTGFL/GN-Comput_inv_1D/codice/invmeasure.exe
>> 00608000-00609000 rw-p 00008000 08:07 66333
>> /home/isaia/Dropbox/HTGFL/GN-Comput_inv_1D/codice/invmeasure.exe
>> 008c7000-00909000 rw-p 00000000 00:00 0
>> [heap]
>> 7f2c94000000-7f2c94021000 rw-p 00000000 00:00 0
>> 7f2c94021000-7f2c98000000 ---p 00000000 00:00 0
>> 7f2c9a8be000-7f2c9a91d000 r-xp 00000000 08:07 1523786
>> /usr/lib/libgmp.so.3.5.2
>> 7f2c9a91d000-7f2c9ab1c000 ---p 0005f000 08:07 1523786
>> /usr/lib/libgmp.so.3.5.2
>> 7f2c9ab1c000-7f2c9ab1d000 r--p 0005e000 08:07 1523786
>> /usr/lib/libgmp.so.3.5.2
>> 7f2c9ab1d000-7f2c9ab1e000 rw-p 0005f000 08:07 1523786
>> /usr/lib/libgmp.so.3.5.2
>> 7f2c9ab1e000-7f2c9ab20000 r-xp 00000000 08:07 262984
>> /lib/libdl-2.12.1.so
>> 7f2c9ab20000-7f2c9ad20000 ---p 00002000 08:07 262984
>> /lib/libdl-2.12.1.so
>> 7f2c9ad20000-7f2c9ad21000 r--p 00002000 08:07 262984
>> /lib/libdl-2.12.1.so
>> 7f2c9ad21000-7f2c9ad22000 rw-p 00003000 08:07 262984
>> /lib/libdl-2.12.1.so
>> 7f2c9ad22000-7f2c9ae98000 r-xp 00000000 08:07 1549774
>> /usr/lib/libcln.so.6.0.1
>> 7f2c9ae98000-7f2c9b097000 ---p 00176000 08:07 1549774
>> /usr/lib/libcln.so.6.0.1
>> 7f2c9b097000-7f2c9b09b000 r--p 00175000 08:07 1549774
>> /usr/lib/libcln.so.6.0.1
>> 7f2c9b09b000-7f2c9b0a1000 rw-p 00179000 08:07 1549774
>> /usr/lib/libcln.so.6.0.1
>> 7f2c9b0a1000-7f2c9b0a3000 rw-p 00000000 00:00 0
>> 7f2c9b0a3000-7f2c9b21d000 r-xp 00000000 08:07 262821
>> /lib/libc-2.12.1.so
>> 7f2c9b21d000-7f2c9b41c000 ---p 0017a000 08:07 262821
>> /lib/libc-2.12.1.so
>> 7f2c9b41c000-7f2c9b420000 r--p 00179000 08:07 262821
>> /lib/libc-2.12.1.so
>> 7f2c9b420000-7f2c9b421000 rw-p 0017d000 08:07 262821
>> /lib/libc-2.12.1.so
>> 7f2c9b421000-7f2c9b426000 rw-p 00000000 00:00 0
>> 7f2c9b426000-7f2c9b43b000 r-xp 00000000 08:07 262222
>> /lib/libgcc_s.so.1
>> 7f2c9b43b000-7f2c9b63a000 ---p 00015000 08:07 262222
>> /lib/libgcc_s.so.1
>> 7f2c9b63a000-7f2c9b63b000 r--p 00014000 08:07 262222
>> /lib/libgcc_s.so.1
>> 7f2c9b63b000-7f2c9b63c000 rw-p 00015000 08:07 262222
>> /lib/libgcc_s.so.1
>> 7f2c9b63c000-7f2c9b6be000 r-xp 00000000 08:07 262828
>> /lib/libm-2.12.1.so
>> 7f2c9b6be000-7f2c9b8bd000 ---p 00082000 08:07 262828
>> /lib/libm-2.12.1.so
>> 7f2c9b8bd000-7f2c9b8be000 r--p 00081000 08:07 262828
>> /lib/libm-2.12.1.so
>> 7f2c9b8be000-7f2c9b8bf000 rw-p 00082000 08:07 262828
>> /lib/libm-2.12.1.so
>> 7f2c9b8bf000-7f2c9b9a7000 r-xp 00000000 08:07 1523946
>> /usr/lib/libstdc++.so.6.0.14
>> 7f2c9b9a7000-7f2c9bba6000 ---p 000e8000 08:07 1523946
>> /usr/lib/libstdc++.so.6.0.14
>> 7f2c9bba6000-7f2c9bbae000 r--p 000e7000 08:07 1523946
>> /usr/lib/libstdc++.so.6.0.14
>> 7f2c9bbae000-7f2c9bbb0000 rw-p 000ef000 08:07 1523946
>> /usr/lib/libstdc++.so.6.0.14
>> 7f2c9bbb0000-7f2c9bbc5000 rw-p 00000000 00:00 0
>> 7f2c9bbc5000-7f2c9bbdd000 r-xp 00000000 08:07 262823
>> /lib/libpthread-2.12.1.so
>> 7f2c9bbdd000-7f2c9bddc000 ---p 00018000 08:07 262823
>> /lib/libpthread-2.12.1.so
>> 7f2c9bddc000-7f2c9bddd000 r--p 00017000 08:07 262823
>> /lib/libpthread-2.12.1.so
>> 7f2c9bddd000-7f2c9bdde000 rw-p 00018000 08:07 262823
>> /lib/libpthread-2.12.1.so
>> 7f2c9bdde000-7f2c9bde2000 rw-p 00000000 00:00 0
>> 7f2c9bde2000-7f2c9c0c1000 r-xp 00000000 08:07 1524595
>> /usr/lib/libginac-1.5.so.0.2.0
>> 7f2c9c0c1000-7f2c9c2c0000 ---p 002df000 08:07 1524595
>> /usr/lib/libginac-1.5.so.0.2.0
>> 7f2c9c2c0000-7f2c9c2cc000 r--p 002de000 08:07 1524595
>> /usr/lib/libginac-1.5.so.0.2.0
>> 7f2c9c2cc000-7f2c9c2cd000 rw-p 002ea000 08:07 1524595
>> /usr/lib/libginac-1.5.so.0.2.0
>> 7f2c9c2cd000-7f2c9c2cf000 rw-p 00000000 00:00 0
>> 7f2c9c2cf000-7f2c9c2ef000 r-xp 00000000 08:07 262975
>> /lib/ld-2.12.1.so
>> 7f2c9c4c3000-7f2c9c4ca000 rw-p 00000000 00:00 0
>> 7f2c9c4ec000-7f2c9c4ef000 rw-p 00000000 00:00 0
>> 7f2c9c4ef000-7f2c9c4f0000 r--p 00020000 08:07 262975
>> /lib/ld-2.12.1.so
>> 7f2c9c4f0000-7f2c9c4f1000 rw-p 00021000 08:07 262975
>> /lib/ld-2.12.1.so
>> 7f2c9c4f1000-7f2c9c4f2000 rw-p 00000000 00:00 0
>> 7fff794fd000-7fff7951e000 rw-p 00000000 00:00 0
>> [stack]
>> 7fff795c7000-7fff795c8000 r-xp 00000000 00:00 0
>> [vdso]
>> ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
>> [vsyscall]
>>
>> I don't understand why, isn't the destruction of the old instances of min
>> and max done by the assignment operator for the type numeric?
>>
>> Thank you in advance
>> Isaia
>>
1
0
Dear Alexel,
even with your suggested correction, it gives exactly the same error.
I think the problem lies in some way in my assignment operator, when I use
the overloaded operator= of numeric.
rinterval& rinterval::operator=(const rinterval &rhs)
{
if (this == &rhs) return *this; // Same object?
else
{
try
{
this->min=rhs.min;
// I expect here the assignment operator of numeric to destroy the old
instance of min and create a new one
// but it seems like he simply slices rhs.min to fit into min, therefore
losing some information about the precision
// of rhs.min; I tried also this using the CLN library and, if I define min
as a cl_R and rhs.min is a cl_LF, when I come to this point
// it seems like the precision of min doesn't change, even if the precision
of rhs.min is bigger;
// I would like the assignment operator to destroy the former istance of min
and build a new one, but it doesn't seem to work
// I tried calling the destructors explictly, but it doesn't work either.
this->max=rhs.max;
error=rhs.error;
}
catch(std::exception & exc)
{
std:cerr << "Exception" << exc.what() << endl;
}
return *this;
}
}
Best regards
Isaia
On Tue, Mar 29, 2011 at 12:00 PM, <ginac-list-request(a)ginac.de> wrote:
> Send GiNaC-list mailing list submissions to
> ginac-list(a)ginac.de
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://www.cebix.net/mailman/listinfo/ginac-list
> or, via email, send a message with subject or body 'help' to
> ginac-list-request(a)ginac.de
>
> You can reach the person managing the list at
> ginac-list-owner(a)ginac.de
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of GiNaC-list digest..."
>
>
> Today's Topics:
>
> 1. assignment (Nisoli Isaia)
> 2. Re: assignment (Alexei Sheplyakov)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 28 Mar 2011 11:33:53 +0200
> From: Nisoli Isaia <nisoli(a)mail.dm.unipi.it>
> To: ginac-list(a)ginac.de
> Subject: [GiNaC-list] assignment
> Message-ID: <BANLkTi=ebBvqzhPPdPiZGXfKatwgt64+fw(a)mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Dear all,
> I have a problem with Ginac.
> I'm sorry if my question seems stupid, but I cannot solve the issue.
>
> So, I define a new class:
>
> class rinterval
> {
> public:
> numeric min;
> numeric max;
> numeric error;
>
> //Constructor
> rinterval();
> rinterval(const numeric &, const numeric &, const numeric &);
> //Destructor
> ~rinterval();
> //Friend
> friend const rinterval dynamic(const rinterval &);
> friend std::ostream &operator<< (std::ostream &os, const rinterval
> &inter)
> {
> return os << "[" << inter.min << "," << inter.max <<"], error = " <<
> inter.error << endl;
> };
> rinterval& operator=(const rinterval &rhs);
> };
>
> The involved functions are these
>
> rinterval::rinterval(const numeric &input1, const numeric &input2, const
> numeric &miserr)
> {
> if (input1>input2)
> {
> min=input2;
> max=input1;
> }
> else
> {
> min=input1;
> max=input2;
> }
> error=miserr;
> }
>
> const rinterval dynamic(const rinterval &domain)
> {
> numeric a="1.47777777777777777777777777779999";
> rinterval temp(a*domain.min,a*domain.max,domain.error);
> cout << temp;
> return temp;
> }
>
> rinterval& rinterval::operator=(const rinterval &rhs)
> {
> if (this == &rhs) return *this; // Same object?
> else
> {
> try
> {
> this->min=rhs.min;
> this->max=rhs.max;
> error=rhs.error;
> }
> catch(std::exception & exc)
> {
> std:cerr << "Exception" << exc.what() << endl;
> }
> return *this;
> }
> }
>
> Now, if inside the main I do
>
> int main (void)
> {
> numeric a(1,10);
> numeric b(2,10);
> rinterval inter(a,b,(numeric)0.00001);
> inter=dynamic(inter);
> cout << inter << endl;
> }
>
> I get the following error:
> *** glibc detected *** ./invmeasure.exe: invalid fastbin entry (free):
> 0x00000000008ec340 ***
> ======= Backtrace: =========
> /lib/libc.so.6(+0x774b6)[0x7f2c9b11a4b6]
> /lib/libc.so.6(cfree+0x73)[0x7f2c9b120c83]
> /usr/lib/libcln.so.6(+0x6fa0d)[0x7f2c9ad91a0d]
>
> /usr/lib/libcln.so.6(_ZN3cln11print_floatERSoRKNS_20cl_print_float_flagsERKNS_4cl_FE+0x29)[0x7f2c9ad92d39]
> /usr/lib/libginac-1.5.so.0(+0x1ddb5b)[0x7f2c9bfbfb5b]
>
> /usr/lib/libginac-1.5.so.0(_ZNK5GiNaC7numeric13print_numericERKNS_13print_contextEPKcS5_S5_S5_j+0x97)[0x7f2c9bfc0857]
>
> /usr/lib/libginac-1.5.so.0(_ZNK5GiNaC7numeric8do_printERKNS_13print_contextEj+0x28)[0x7f2c9bfc0e48]
>
> /usr/lib/libginac-1.5.so.0(_ZNK5GiNaC5basic14print_dispatchERKNS_10class_infoINS_24registered_class_optionsEEERKNS_13print_contextEj+0x18b)[0x7f2c9be6c62b]
> /usr/lib/libginac-1.5.so.0(_ZN5GiNaClsERSoRKNS_2exE+0x9e)[0x7f2c9bfe5c2e]
> ./invmeasure.exe[0x404261]
> ./invmeasure.exe[0x403808]
> /lib/libc.so.6(__libc_start_main+0xfe)[0x7f2c9b0c1d8e]
> ./invmeasure.exe[0x403439]
> ======= Memory map: ========
> 00400000-00407000 r-xp 00000000 08:07 66333
> /home/isaia/Dropbox/HTGFL/GN-Comput_inv_1D/codice/invmeasure.exe
> 00607000-00608000 r--p 00007000 08:07 66333
> /home/isaia/Dropbox/HTGFL/GN-Comput_inv_1D/codice/invmeasure.exe
> 00608000-00609000 rw-p 00008000 08:07 66333
> /home/isaia/Dropbox/HTGFL/GN-Comput_inv_1D/codice/invmeasure.exe
> 008c7000-00909000 rw-p 00000000 00:00 0
> [heap]
> 7f2c94000000-7f2c94021000 rw-p 00000000 00:00 0
> 7f2c94021000-7f2c98000000 ---p 00000000 00:00 0
> 7f2c9a8be000-7f2c9a91d000 r-xp 00000000 08:07 1523786
> /usr/lib/libgmp.so.3.5.2
> 7f2c9a91d000-7f2c9ab1c000 ---p 0005f000 08:07 1523786
> /usr/lib/libgmp.so.3.5.2
> 7f2c9ab1c000-7f2c9ab1d000 r--p 0005e000 08:07 1523786
> /usr/lib/libgmp.so.3.5.2
> 7f2c9ab1d000-7f2c9ab1e000 rw-p 0005f000 08:07 1523786
> /usr/lib/libgmp.so.3.5.2
> 7f2c9ab1e000-7f2c9ab20000 r-xp 00000000 08:07 262984
> /lib/libdl-2.12.1.so
> 7f2c9ab20000-7f2c9ad20000 ---p 00002000 08:07 262984
> /lib/libdl-2.12.1.so
> 7f2c9ad20000-7f2c9ad21000 r--p 00002000 08:07 262984
> /lib/libdl-2.12.1.so
> 7f2c9ad21000-7f2c9ad22000 rw-p 00003000 08:07 262984
> /lib/libdl-2.12.1.so
> 7f2c9ad22000-7f2c9ae98000 r-xp 00000000 08:07 1549774
> /usr/lib/libcln.so.6.0.1
> 7f2c9ae98000-7f2c9b097000 ---p 00176000 08:07 1549774
> /usr/lib/libcln.so.6.0.1
> 7f2c9b097000-7f2c9b09b000 r--p 00175000 08:07 1549774
> /usr/lib/libcln.so.6.0.1
> 7f2c9b09b000-7f2c9b0a1000 rw-p 00179000 08:07 1549774
> /usr/lib/libcln.so.6.0.1
> 7f2c9b0a1000-7f2c9b0a3000 rw-p 00000000 00:00 0
> 7f2c9b0a3000-7f2c9b21d000 r-xp 00000000 08:07 262821
> /lib/libc-2.12.1.so
> 7f2c9b21d000-7f2c9b41c000 ---p 0017a000 08:07 262821
> /lib/libc-2.12.1.so
> 7f2c9b41c000-7f2c9b420000 r--p 00179000 08:07 262821
> /lib/libc-2.12.1.so
> 7f2c9b420000-7f2c9b421000 rw-p 0017d000 08:07 262821
> /lib/libc-2.12.1.so
> 7f2c9b421000-7f2c9b426000 rw-p 00000000 00:00 0
> 7f2c9b426000-7f2c9b43b000 r-xp 00000000 08:07 262222
> /lib/libgcc_s.so.1
> 7f2c9b43b000-7f2c9b63a000 ---p 00015000 08:07 262222
> /lib/libgcc_s.so.1
> 7f2c9b63a000-7f2c9b63b000 r--p 00014000 08:07 262222
> /lib/libgcc_s.so.1
> 7f2c9b63b000-7f2c9b63c000 rw-p 00015000 08:07 262222
> /lib/libgcc_s.so.1
> 7f2c9b63c000-7f2c9b6be000 r-xp 00000000 08:07 262828
> /lib/libm-2.12.1.so
> 7f2c9b6be000-7f2c9b8bd000 ---p 00082000 08:07 262828
> /lib/libm-2.12.1.so
> 7f2c9b8bd000-7f2c9b8be000 r--p 00081000 08:07 262828
> /lib/libm-2.12.1.so
> 7f2c9b8be000-7f2c9b8bf000 rw-p 00082000 08:07 262828
> /lib/libm-2.12.1.so
> 7f2c9b8bf000-7f2c9b9a7000 r-xp 00000000 08:07 1523946
> /usr/lib/libstdc++.so.6.0.14
> 7f2c9b9a7000-7f2c9bba6000 ---p 000e8000 08:07 1523946
> /usr/lib/libstdc++.so.6.0.14
> 7f2c9bba6000-7f2c9bbae000 r--p 000e7000 08:07 1523946
> /usr/lib/libstdc++.so.6.0.14
> 7f2c9bbae000-7f2c9bbb0000 rw-p 000ef000 08:07 1523946
> /usr/lib/libstdc++.so.6.0.14
> 7f2c9bbb0000-7f2c9bbc5000 rw-p 00000000 00:00 0
> 7f2c9bbc5000-7f2c9bbdd000 r-xp 00000000 08:07 262823
> /lib/libpthread-2.12.1.so
> 7f2c9bbdd000-7f2c9bddc000 ---p 00018000 08:07 262823
> /lib/libpthread-2.12.1.so
> 7f2c9bddc000-7f2c9bddd000 r--p 00017000 08:07 262823
> /lib/libpthread-2.12.1.so
> 7f2c9bddd000-7f2c9bdde000 rw-p 00018000 08:07 262823
> /lib/libpthread-2.12.1.so
> 7f2c9bdde000-7f2c9bde2000 rw-p 00000000 00:00 0
> 7f2c9bde2000-7f2c9c0c1000 r-xp 00000000 08:07 1524595
> /usr/lib/libginac-1.5.so.0.2.0
> 7f2c9c0c1000-7f2c9c2c0000 ---p 002df000 08:07 1524595
> /usr/lib/libginac-1.5.so.0.2.0
> 7f2c9c2c0000-7f2c9c2cc000 r--p 002de000 08:07 1524595
> /usr/lib/libginac-1.5.so.0.2.0
> 7f2c9c2cc000-7f2c9c2cd000 rw-p 002ea000 08:07 1524595
> /usr/lib/libginac-1.5.so.0.2.0
> 7f2c9c2cd000-7f2c9c2cf000 rw-p 00000000 00:00 0
> 7f2c9c2cf000-7f2c9c2ef000 r-xp 00000000 08:07 262975
> /lib/ld-2.12.1.so
> 7f2c9c4c3000-7f2c9c4ca000 rw-p 00000000 00:00 0
> 7f2c9c4ec000-7f2c9c4ef000 rw-p 00000000 00:00 0
> 7f2c9c4ef000-7f2c9c4f0000 r--p 00020000 08:07 262975
> /lib/ld-2.12.1.so
> 7f2c9c4f0000-7f2c9c4f1000 rw-p 00021000 08:07 262975
> /lib/ld-2.12.1.so
> 7f2c9c4f1000-7f2c9c4f2000 rw-p 00000000 00:00 0
> 7fff794fd000-7fff7951e000 rw-p 00000000 00:00 0
> [stack]
> 7fff795c7000-7fff795c8000 r-xp 00000000 00:00 0
> [vdso]
> ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
> [vsyscall]
>
> I don't understand why, isn't the destruction of the old instances of min
> and max done by the assignment operator for the type numeric?
>
> Thank you in advance
> Isaia
>
2
1
Dear all,
I have a problem with Ginac.
I'm sorry if my question seems stupid, but I cannot solve the issue.
So, I define a new class:
class rinterval
{
public:
numeric min;
numeric max;
numeric error;
//Constructor
rinterval();
rinterval(const numeric &, const numeric &, const numeric &);
//Destructor
~rinterval();
//Friend
friend const rinterval dynamic(const rinterval &);
friend std::ostream &operator<< (std::ostream &os, const rinterval
&inter)
{
return os << "[" << inter.min << "," << inter.max <<"], error = " <<
inter.error << endl;
};
rinterval& operator=(const rinterval &rhs);
};
The involved functions are these
rinterval::rinterval(const numeric &input1, const numeric &input2, const
numeric &miserr)
{
if (input1>input2)
{
min=input2;
max=input1;
}
else
{
min=input1;
max=input2;
}
error=miserr;
}
const rinterval dynamic(const rinterval &domain)
{
numeric a="1.47777777777777777777777777779999";
rinterval temp(a*domain.min,a*domain.max,domain.error);
cout << temp;
return temp;
}
rinterval& rinterval::operator=(const rinterval &rhs)
{
if (this == &rhs) return *this; // Same object?
else
{
try
{
this->min=rhs.min;
this->max=rhs.max;
error=rhs.error;
}
catch(std::exception & exc)
{
std:cerr << "Exception" << exc.what() << endl;
}
return *this;
}
}
Now, if inside the main I do
int main (void)
{
numeric a(1,10);
numeric b(2,10);
rinterval inter(a,b,(numeric)0.00001);
inter=dynamic(inter);
cout << inter << endl;
}
I get the following error:
*** glibc detected *** ./invmeasure.exe: invalid fastbin entry (free):
0x00000000008ec340 ***
======= Backtrace: =========
/lib/libc.so.6(+0x774b6)[0x7f2c9b11a4b6]
/lib/libc.so.6(cfree+0x73)[0x7f2c9b120c83]
/usr/lib/libcln.so.6(+0x6fa0d)[0x7f2c9ad91a0d]
/usr/lib/libcln.so.6(_ZN3cln11print_floatERSoRKNS_20cl_print_float_flagsERKNS_4cl_FE+0x29)[0x7f2c9ad92d39]
/usr/lib/libginac-1.5.so.0(+0x1ddb5b)[0x7f2c9bfbfb5b]
/usr/lib/libginac-1.5.so.0(_ZNK5GiNaC7numeric13print_numericERKNS_13print_contextEPKcS5_S5_S5_j+0x97)[0x7f2c9bfc0857]
/usr/lib/libginac-1.5.so.0(_ZNK5GiNaC7numeric8do_printERKNS_13print_contextEj+0x28)[0x7f2c9bfc0e48]
/usr/lib/libginac-1.5.so.0(_ZNK5GiNaC5basic14print_dispatchERKNS_10class_infoINS_24registered_class_optionsEEERKNS_13print_contextEj+0x18b)[0x7f2c9be6c62b]
/usr/lib/libginac-1.5.so.0(_ZN5GiNaClsERSoRKNS_2exE+0x9e)[0x7f2c9bfe5c2e]
./invmeasure.exe[0x404261]
./invmeasure.exe[0x403808]
/lib/libc.so.6(__libc_start_main+0xfe)[0x7f2c9b0c1d8e]
./invmeasure.exe[0x403439]
======= Memory map: ========
00400000-00407000 r-xp 00000000 08:07 66333
/home/isaia/Dropbox/HTGFL/GN-Comput_inv_1D/codice/invmeasure.exe
00607000-00608000 r--p 00007000 08:07 66333
/home/isaia/Dropbox/HTGFL/GN-Comput_inv_1D/codice/invmeasure.exe
00608000-00609000 rw-p 00008000 08:07 66333
/home/isaia/Dropbox/HTGFL/GN-Comput_inv_1D/codice/invmeasure.exe
008c7000-00909000 rw-p 00000000 00:00 0
[heap]
7f2c94000000-7f2c94021000 rw-p 00000000 00:00 0
7f2c94021000-7f2c98000000 ---p 00000000 00:00 0
7f2c9a8be000-7f2c9a91d000 r-xp 00000000 08:07 1523786
/usr/lib/libgmp.so.3.5.2
7f2c9a91d000-7f2c9ab1c000 ---p 0005f000 08:07 1523786
/usr/lib/libgmp.so.3.5.2
7f2c9ab1c000-7f2c9ab1d000 r--p 0005e000 08:07 1523786
/usr/lib/libgmp.so.3.5.2
7f2c9ab1d000-7f2c9ab1e000 rw-p 0005f000 08:07 1523786
/usr/lib/libgmp.so.3.5.2
7f2c9ab1e000-7f2c9ab20000 r-xp 00000000 08:07 262984
/lib/libdl-2.12.1.so
7f2c9ab20000-7f2c9ad20000 ---p 00002000 08:07 262984
/lib/libdl-2.12.1.so
7f2c9ad20000-7f2c9ad21000 r--p 00002000 08:07 262984
/lib/libdl-2.12.1.so
7f2c9ad21000-7f2c9ad22000 rw-p 00003000 08:07 262984
/lib/libdl-2.12.1.so
7f2c9ad22000-7f2c9ae98000 r-xp 00000000 08:07 1549774
/usr/lib/libcln.so.6.0.1
7f2c9ae98000-7f2c9b097000 ---p 00176000 08:07 1549774
/usr/lib/libcln.so.6.0.1
7f2c9b097000-7f2c9b09b000 r--p 00175000 08:07 1549774
/usr/lib/libcln.so.6.0.1
7f2c9b09b000-7f2c9b0a1000 rw-p 00179000 08:07 1549774
/usr/lib/libcln.so.6.0.1
7f2c9b0a1000-7f2c9b0a3000 rw-p 00000000 00:00 0
7f2c9b0a3000-7f2c9b21d000 r-xp 00000000 08:07 262821
/lib/libc-2.12.1.so
7f2c9b21d000-7f2c9b41c000 ---p 0017a000 08:07 262821
/lib/libc-2.12.1.so
7f2c9b41c000-7f2c9b420000 r--p 00179000 08:07 262821
/lib/libc-2.12.1.so
7f2c9b420000-7f2c9b421000 rw-p 0017d000 08:07 262821
/lib/libc-2.12.1.so
7f2c9b421000-7f2c9b426000 rw-p 00000000 00:00 0
7f2c9b426000-7f2c9b43b000 r-xp 00000000 08:07 262222
/lib/libgcc_s.so.1
7f2c9b43b000-7f2c9b63a000 ---p 00015000 08:07 262222
/lib/libgcc_s.so.1
7f2c9b63a000-7f2c9b63b000 r--p 00014000 08:07 262222
/lib/libgcc_s.so.1
7f2c9b63b000-7f2c9b63c000 rw-p 00015000 08:07 262222
/lib/libgcc_s.so.1
7f2c9b63c000-7f2c9b6be000 r-xp 00000000 08:07 262828
/lib/libm-2.12.1.so
7f2c9b6be000-7f2c9b8bd000 ---p 00082000 08:07 262828
/lib/libm-2.12.1.so
7f2c9b8bd000-7f2c9b8be000 r--p 00081000 08:07 262828
/lib/libm-2.12.1.so
7f2c9b8be000-7f2c9b8bf000 rw-p 00082000 08:07 262828
/lib/libm-2.12.1.so
7f2c9b8bf000-7f2c9b9a7000 r-xp 00000000 08:07 1523946
/usr/lib/libstdc++.so.6.0.14
7f2c9b9a7000-7f2c9bba6000 ---p 000e8000 08:07 1523946
/usr/lib/libstdc++.so.6.0.14
7f2c9bba6000-7f2c9bbae000 r--p 000e7000 08:07 1523946
/usr/lib/libstdc++.so.6.0.14
7f2c9bbae000-7f2c9bbb0000 rw-p 000ef000 08:07 1523946
/usr/lib/libstdc++.so.6.0.14
7f2c9bbb0000-7f2c9bbc5000 rw-p 00000000 00:00 0
7f2c9bbc5000-7f2c9bbdd000 r-xp 00000000 08:07 262823
/lib/libpthread-2.12.1.so
7f2c9bbdd000-7f2c9bddc000 ---p 00018000 08:07 262823
/lib/libpthread-2.12.1.so
7f2c9bddc000-7f2c9bddd000 r--p 00017000 08:07 262823
/lib/libpthread-2.12.1.so
7f2c9bddd000-7f2c9bdde000 rw-p 00018000 08:07 262823
/lib/libpthread-2.12.1.so
7f2c9bdde000-7f2c9bde2000 rw-p 00000000 00:00 0
7f2c9bde2000-7f2c9c0c1000 r-xp 00000000 08:07 1524595
/usr/lib/libginac-1.5.so.0.2.0
7f2c9c0c1000-7f2c9c2c0000 ---p 002df000 08:07 1524595
/usr/lib/libginac-1.5.so.0.2.0
7f2c9c2c0000-7f2c9c2cc000 r--p 002de000 08:07 1524595
/usr/lib/libginac-1.5.so.0.2.0
7f2c9c2cc000-7f2c9c2cd000 rw-p 002ea000 08:07 1524595
/usr/lib/libginac-1.5.so.0.2.0
7f2c9c2cd000-7f2c9c2cf000 rw-p 00000000 00:00 0
7f2c9c2cf000-7f2c9c2ef000 r-xp 00000000 08:07 262975
/lib/ld-2.12.1.so
7f2c9c4c3000-7f2c9c4ca000 rw-p 00000000 00:00 0
7f2c9c4ec000-7f2c9c4ef000 rw-p 00000000 00:00 0
7f2c9c4ef000-7f2c9c4f0000 r--p 00020000 08:07 262975
/lib/ld-2.12.1.so
7f2c9c4f0000-7f2c9c4f1000 rw-p 00021000 08:07 262975
/lib/ld-2.12.1.so
7f2c9c4f1000-7f2c9c4f2000 rw-p 00000000 00:00 0
7fff794fd000-7fff7951e000 rw-p 00000000 00:00 0
[stack]
7fff795c7000-7fff795c8000 r-xp 00000000 00:00 0
[vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
[vsyscall]
I don't understand why, isn't the destruction of the old instances of min
and max done by the assignment operator for the type numeric?
Thank you in advance
Isaia
2
1
I am confused by the behavior of possymbols in relations. Consider the
following program:
------------------------------------------------
#include <ginac/ginac.h>
using namespace GiNaC;
int main() {
possymbol x("x");
if (x.info(info_flags::positive)) std::cout << "x is positive\n";
else std::cout << "x is _not_ positive\n";
if (x > 0) std::cout << "x is greater than zero\n";
else std::cout << "x is _not_ greater than zero\n";
}
------------------------------------------------
I would expect the output to be:
x is positive
x is greater than zero
But the output I get is:
x is positive
x is _not_ greater than zero
Am I misunderstanding the use of possymbol?
Thanks,
Michael Boyer
2
4