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

Issues compiling tests #2

Open
reynoldscem opened this issue Sep 26, 2022 · 2 comments
Open

Issues compiling tests #2

reynoldscem opened this issue Sep 26, 2022 · 2 comments

Comments

@reynoldscem
Copy link

Hi,

I'm having difficulty compiling the tests for the project. I've tried a few different versions of boost, but none earlier than 1.55.

I cannot compile CMakeFiles/GrassmannAveragesPCA_test.dir/test/test_row_proxy.cpp.o which fails with the following:

In file included from /usr/include/boost/iterator/iterator_adaptor.hpp:15,
                 from /home/creynolds/Grassmann-Averages-PCA/include/private/boost_ublas_row_iterator.hpp:14,
                 from /home/creynolds/Grassmann-Averages-PCA/test/test_row_proxy.cpp:16:
/usr/include/boost/iterator/iterator_facade.hpp: In instantiation of ‘static void boost::iterators::iterator_core_access::decrement(Facade&) [with Facade = grassmann_averages_pca::details::ublas_helpers::row_iter<boost::numeric::ublas::matrix<double> >]’:
/usr/include/boost/iterator/iterator_facade.hpp:699:44:   required from ‘Derived& boost::iterators::detail::iterator_facade_base<Derived, Value, CategoryOrTraversal, Reference, Difference, true, false>::operator--() [with Derived = grassmann_averages_pca::details::ublas_helpers::row_iter<boost::numeric::ublas::matrix<double> >; Value = boost::numeric::ublas::matrix_row<boost::numeric::ublas::matrix<double> >; CategoryOrTraversal = std::random_access_iterator_tag; Reference = boost::numeric::ublas::matrix_row<boost::numeric::ublas::matrix<double> >; Difference = long int]’
/usr/include/c++/11/bits/stl_iterator_base_funcs.h:183:2:   required from ‘void std::__advance(_RandomAccessIterator&, _Distance, std::random_access_iterator_tag) [with _RandomAccessIterator = grassmann_averages_pca::details::ublas_helpers::row_iter<boost::numeric::ublas::matrix<double> >; _Distance = long int]’
/usr/include/c++/11/bits/stl_iterator_base_funcs.h:206:21:   required from ‘void std::advance(_InputIterator&, _Distance) [with _InputIterator = grassmann_averages_pca::details::ublas_helpers::row_iter<boost::numeric::ublas::matrix<double> >; _Distance = int]’
/home/creynolds/Grassmann-Averages-PCA/test/test_row_proxy.cpp:73:15:   required from here
/usr/include/boost/iterator/iterator_facade.hpp:562:13: error: ‘class grassmann_averages_pca::details::ublas_helpers::row_iter<boost::numeric::ublas::matrix<double> >’ has no member named ‘decrement’; did you mean ‘increment’?
  562 |           f.decrement();
      |           ~~^~~~~~~~~
      |           increment
make[2]: *** [CMakeFiles/GrassmannAveragesPCA_test.dir/build.make:132: CMakeFiles/GrassmannAveragesPCA_test.dir/test/test_row_proxy.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:951: CMakeFiles/GrassmannAveragesPCA_test.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

Any advice would be greatly appreciated.

@raffienficiaud
Copy link
Member

Thanks for the report. Would you please try adding those lines to the file include/private/boost_ublas_row_iterator.hpp? eg. ~after increment and report here?

        void decrement()
        {
          assert(matrix);
          assert(index < matrix->size1() && index >= 0);
          index--;
        }

(disclaimer: I have not tested this at all, but you get the idea.)

@reynoldscem
Copy link
Author

Funnily enough I tried (essentially) this just after putting the report in, and it seems to compile and run all tests just fine.

I am unsure whether I understand correctly what the assert is meant to ensure, I'd presumed keeping the index in bounds? If so is index < matrix->size1() && index >= 0 the right boundary condition? It seems to let index go to -1 which I'd have thought out of bounds?

Anyway thank you for the reply, especially so swift and on an older project! I will see if your assert instead of what I added breaks the tests or not.

Out of curiosity, do you have any insight on why this error has come about? Has boosts API changed? Something else?

Thanks for the report. Would you please try adding those lines to the file include/private/boost_ublas_row_iterator.hpp? eg. ~after increment and report here?


        void decrement()

        {

          assert(matrix);

          assert(index < matrix->size1() && index >= 0);

          index--;

        }

(disclaimer: I have not tested this at all, but you get the idea.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants