init again

Skip to first unread message

B Saunders

Jun 17, 2015, 2:31:51 PM6/17/15
I'll make a proposal about init/convert in a following post.  Here I just bring up my current obstacle.

I'm getting ambiguity concerning these init definitions in gf2.h.  In the case of the first one, I show my workaround.  (I observe that no specification or policy statement guides me whether use of uint32_t is a good fix or not.).  The last two are causing  ambiguity errors during "make install".

        Element &init (Element &x, const integer &y) const


            //return x = static_cast<long>(y) & 1;

            return x = y & (uint32_t)1;


        Element &init(Element&x) const


            return x = false;


        BitVector::reference init (BitVector::reference x, const integer &y = 0) const


            return x = long (y) & 1;


        stdBitReference init (stdBitReference x, const integer &y = 0) const


            return x = long (y) & 1;


Here is a sample of the error message:

make[3]: Entering directory `/usa/saunders/software/linbox/linbox/algorithms'

/bin/bash ../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..

/..    -O2   -Wall -g -DNDEBUG -U_LB_DEBUG -DDISABLE_COMMENTATOR         -fopenm

p -I/usa/saunders/software/include -D__FFLASFFPACK_HAVE_CBLAS -msse4.1 -mavx -fa

bi-version=6 -I/usa/saunders/software/include  -std=gnu++11  -c -o diophantine-s

olver.lo diophantine-solver.C

libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -O2 -Wall -g -DNDEBUG -U_LB_D

EBUG -DDISABLE_COMMENTATOR -fopenmp -I/usa/saunders/software/include -D__FFLASFF

PACK_HAVE_CBLAS -msse4.1 -mavx -fabi-version=6 -I/usa/saunders/software/include 

-std=gnu++11 -c diophantine-solver.C  -fPIC -DPIC -o .libs/diophantine-solver.o

In file included from ../../linbox/vector/stream-gf2.h:77:0,

                 from ../../linbox/vector/stream.h:911,

                 from ../../linbox/matrix/DenseMatrix/blas-matrix.h:41,

                 from ../../linbox/matrix/dense-matrix.h:69,

                 from ../../linbox/algorithms/rational-solver.h:43,

                 from ../../linbox/algorithms/diophantine-solver.h:29,

                 from diophantine-solver.C:25:

../../linbox/field/gf2.h: In member function 'LinBox::GF2::Element& LinBox::GF2:

:init(LinBox::GF2::Element&, const integer&) const':

../../linbox/field/gf2.h:169:34: error: conversion from 'const integer {aka cons

t Givaro::Integer}' to 'long int' is ambiguous

    return x = static_cast<long>(y) & 1;


../../linbox/field/gf2.h:169:34: note: candidates are:

In file included from /usa/saunders/software/include/gmp++/gmp++.h:52:0,

                 from ../../linbox/integer.h:46,

                 from ../../linbox/randiter/abstract.h:31,

                 from ../../linbox/field/abstract.h:33,

                 from ../../linbox/field/archetype.h:51,

                 from ../../linbox/vector/vector-traits.h:57,

                 from ../../linbox/matrix/dense-matrix.h:36,

                 from ../../linbox/algorithms/rational-solver.h:43,

                 from ../../linbox/algorithms/diophantine-solver.h:29,

                 from diophantine-solver.C:25:

/usa/saunders/software/include/gmp++/gmp++_int.h:1555:19: note: Givaro::Integer:

:operator double() const

   giv_all_inlined operator double() const ;


/usa/saunders/software/include/gmp++/gmp++_int.h:1554:19: note: Givaro::Integer:

:operator float() const

   giv_all_inlined operator float() const ;


/usa/saunders/software/include/gmp++/gmp++_int.h:1552:19: note: Givaro::Integer:

:operator int64_t() const

   giv_all_inlined operator int64_t() const ;


/usa/saunders/software/include/gmp++/gmp++_int.h:1551:19: note: Givaro::Integer:

:operator uint64_t() const

   giv_all_inlined operator uint64_t() const ;


/usa/saunders/software/include/gmp++/gmp++_int.h:1547:3: note: Givaro::Integer::

operator signed char() const

   operator signed char() const


/usa/saunders/software/include/gmp++/gmp++_int.h:1546:19: note: Givaro::Integer:

:operator int32_t() const

   giv_all_inlined operator int32_t() const ;


/usa/saunders/software/include/gmp++/gmp++_int.h:1545:19: note: Givaro::Integer:

:operator uint32_t() const

   giv_all_inlined operator uint32_t() const ;



Alexis Breust

Jun 18, 2015, 6:11:59 AM6/18/15
There has been a interface breaking update with Givaro::Integer in version 4.0.0.
The programmer should only use standard types (u)intXX_t and no long or long long.
LinBox has not been fully updated to this change yet.

Here the cast to "long" is ambiguous because of that.
As a temporary fix, you can check the value of __LINBOX_SIZEOF_LONG
and change the cast accordingly to "int32_t" (if 
or "int64_t" (if 
Reply all
Reply to author
0 new messages