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

ublas::matrix broken with compiler error with build 1.80 but not 1.63 #179

Open
carljwhite3 opened this issue Oct 25, 2022 · 2 comments
Open

Comments

@carljwhite3
Copy link

carljwhite3 commented Oct 25, 2022

Was trying to compile the following code and received the following error information.

Code:

#include <boost/numeric/ublas/matrix.hpp>

int main()
{
    boost::numeric::ublas::matrix<double> u;

    u = u / norm_frobenius(u);  // u /= norm_frobenius(u) works

    return 0;
}

Error:

In file included from /opt/boost/boost/typeof/typeof.hpp:216,
                 from /opt/boost/boost/numeric/ublas/traits.hpp:29,
                 from /opt/boost/boost/numeric/ublas/storage.hpp:27,
                 from /opt/boost/boost/numeric/ublas/vector.hpp:21,
                 from /opt/boost/boost/numeric/ublas/matrix.hpp:18,
                 from example.cpp:1:
/opt/boost/boost/numeric/ublas/traits.hpp: In instantiation of ‘struct boost::numeric::ublas::promote_traits<double, boost::numeric::ublas::matrix_scalar_unary<boost::numeric::ublas::matrix<double>, boost::numeric::ublas::matrix_norm_frobenius<boost::numeric::ublas::matrix<double> > > >’:
/opt/boost/boost/numeric/ublas/functional.hpp:126:63:   required from ‘struct boost::numeric::ublas::scalar_binary_functor<double, boost::numeric::ublas::matrix_scalar_unary<boost::numeric::ublas::matrix<double>, boost::numeric::ublas::matrix_norm_frobenius<boost::numeric::ublas::matrix<double> > > >’
/opt/boost/boost/numeric/ublas/functional.hpp:166:12:   required from ‘struct boost::numeric::ublas::scalar_divides<double, boost::numeric::ublas::matrix_scalar_unary<boost::numeric::ublas::matrix<double>, boost::numeric::ublas::matrix_norm_frobenius<boost::numeric::ublas::matrix<double> > > >’
/opt/boost/boost/numeric/ublas/matrix_expression.hpp:3491:34:   required from ‘class boost::numeric::ublas::matrix_binary_scalar2<boost::numeric::ublas::matrix<double>, const boost::numeric::ublas::matrix_scalar_unary<boost::numeric::ublas::matrix<double>, boost::numeric::ublas::matrix_norm_frobenius<boost::numeric::ublas::matrix<double> > >, boost::numeric::ublas::scalar_divides<double, boost::numeric::ublas::matrix_scalar_unary<boost::numeric::ublas::matrix<double>, boost::numeric::ublas::matrix_norm_frobenius<boost::numeric::ublas::matrix<double> > > > >’
example.cpp:7:29:   required from here
/opt/boost/boost/numeric/ublas/traits.hpp:154:40: error: no matching function for call to ‘boost::numeric::ublas::matrix_scalar_unary<boost::numeric::ublas::matrix<double>, boost::numeric::ublas::matrix_norm_frobenius<boost::numeric::ublas::matrix<double> > >::matrix_scalar_unary()’
  154 |         typedef BOOST_TYPEOF_TPL(X() + Y()) promote_type;
      |                                        ^~~
/opt/boost/boost/typeof/decltype.hpp:17:69: note: in definition of macro ‘BOOST_TYPEOF’
   17 | #define BOOST_TYPEOF(expr) boost::type_of::remove_cv_ref_t<decltype(expr)>
      |                                                                     ^~~~
/opt/boost/boost/numeric/ublas/traits.hpp:154:17: note: in expansion of macro ‘BOOST_TYPEOF_TPL’
  154 |         typedef BOOST_TYPEOF_TPL(X() + Y()) promote_type;
      |                 ^~~~~~~~~~~~~~~~
In file included from /opt/boost/boost/numeric/ublas/matrix.hpp:19,
                 from example.cpp:1:
/opt/boost/boost/numeric/ublas/matrix_expression.hpp:5637:11: note: candidate: ‘boost::numeric::ublas::matrix_scalar_unary<E, F>::matrix_scalar_unary(const expression_type&) [with E = boost::numeric::ublas::matrix<double>; F = boost::numeric::ublas::matrix_norm_frobenius<boost::numeric::ublas::matrix<double> >; boost::numeric::ublas::matrix_scalar_unary<E, F>::expression_type = boost::numeric::ublas::matrix<double>]’
 5637 |  explicit matrix_scalar_unary (const expression_type &e):
      |           ^~~~~~~~~~~~~~~~~~~
/opt/boost/boost/numeric/ublas/matrix_expression.hpp:5637:11: note:   candidate expects 1 argument, 0 provided
/opt/boost/boost/numeric/ublas/matrix_expression.hpp:5627:7: note: candidate: ‘constexpr boost::numeric::ublas::matrix_scalar_unary<boost::numeric::ublas::matrix<double>, boost::numeric::ublas::matrix_norm_frobenius<boost::numeric::ublas::matrix<double> > >::matrix_scalar_unary(const boost::numeric::ublas::matrix_scalar_unary<boost::numeric::ublas::matrix<double>, boost::numeric::ublas::matrix_norm_frobenius<boost::numeric::ublas::matrix<double> > >&)’
 5627 | class matrix_scalar_unary:
      |       ^~~~~~~~~~~~~~~~~~~
/opt/boost/boost/numeric/ublas/matrix_expression.hpp:5627:7: note:   candidate expects 1 argument, 0 provided
/opt/boost/boost/numeric/ublas/matrix_expression.hpp:5627:7: note: candidate: ‘constexpr boost::numeric::ublas::matrix_scalar_unary<boost::numeric::ublas::matrix<double>, boost::numeric::ublas::matrix_norm_frobenius<boost::numeric::ublas::matrix<double> > >::matrix_scalar_unary(boost::numeric::ublas::matrix_scalar_unary<boost::numeric::ublas::matrix<double>, boost::numeric::ublas::matrix_norm_frobenius<boost::numeric::ublas::matrix<double> > >&&)’
/opt/boost/boost/numeric/ublas/matrix_expression.hpp:5627:7: note:   candidate expects 1 argument, 0 provided
@yihuajack
Copy link

This code also fails for boost 1.83.0 on MSVC

@carljwhite3
Copy link
Author

This code also fails boost 1.84.0, gnu g++

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