Discussion:
[eigen] Compiler error with stableNorm
Claas H. Köhler
2017-12-15 13:51:11 UTC
Permalink
Hi,

When compiling the code below, I get a compiler error (using gcc-7 on openSuse 13.2). The code
compiles fine when replacing stableNorm by blueNorm. Is this intendend ?

Here is a minimal example reproducing the issue:
#include <complex>
#include <iostream>
#include <Eigen/Core>

int main(void){
typedef std::complex<double> Scalar;
typedef typename Eigen::NumTraits<Scalar>::Real RealScalar;
typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1> Vector;
typedef Eigen::Matrix<RealScalar, Eigen::Dynamic, 1> RealVector;

Vector v;
Scalar s;

std::cout << (s*v).stableNorm() <<std::endl;

return 0;
}

The following error message seems to indicate the main problem:

eigen/3.3.4/include/eigen3/Eigen/src/Core/StableNorm.h:187:34:
error: no matching function for call to ‘Eigen::VectorBlock<const Eigen::Matrix<std::complex<double>,
-1, 1>, -1>::VectorBlock(Eigen::DenseBase<Eigen::Matrix<std::complex<double>, -1, 1>
::SegmentReturnType)’
internal::stable_norm_kernel(SegmentWrapper(copy.segment(bi,numext::mini(blockSize, n - bi))),
ssq, scale, invScale);
eigen3/Eigen/src/Core/VectorBlock.h:56:47: note:
no known conversion for argument 1 from ‘Eigen::DenseBase<Eigen::Matrix<std::complex<double>, -1, 1>
::SegmentReturnType {aka Eigen::VectorBlock<Eigen::Matrix<std::complex<double>, -1, 1>, -1>}’ to
‘const Eigen::VectorBlock<const Eigen::Matrix<std::complex<double>, -1, 1>, -1>&’

eigen/3.3.4/include/eigen3/Eigen/src/Core/VectorBlock.h:56:47: note: candidate:
Eigen::VectorBlock<const Eigen::Matrix<std::complex<double>, -1, 1>,
-1>::VectorBlock(Eigen::VectorBlock<const Eigen::Matrix<std::complex<double>, -1, 1>, -1>&&)
/home/opairs01/tools/eigen/3.3.4/include/eigen3/Eigen/src/Core/VectorBlock.h:56:47:
note: no known conversion for argument 1 from
‘Eigen::DenseBase<Eigen::Matrix<std::complex<double>, -1, 1> >::SegmentReturnType {aka
Eigen::VectorBlock<Eigen::Matrix<std::complex<double>, -1, 1>, -1>}’ to ‘Eigen::VectorBlock<const
Eigen::Matrix<std::complex<double>, -1, 1>, -1>&&’


Any help would be appreciated.

Regards
Claas
Gael Guennebaud
2017-12-15 14:17:38 UTC
Permalink
thank you for the report,

fixed:
https://bitbucket.org/eigen/eigen/commits/c2947c341c68/
https://bitbucket.org/eigen/eigen/commits/499e982b9281/

you can either update to the head of 3.3, or workaround by evaluating the
subexpression: (s*v).eval().stableNorm().

cheers,
gael
Post by Claas H. Köhler
Hi,
When compiling the code below, I get a compiler error (using gcc-7 on
openSuse 13.2). The code
compiles fine when replacing stableNorm by blueNorm. Is this intendend ?
#include <complex>
#include <iostream>
#include <Eigen/Core>
int main(void){
typedef std::complex<double> Scalar;
typedef typename Eigen::NumTraits<Scalar>::Real RealScalar;
typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1> Vector;
typedef Eigen::Matrix<RealScalar, Eigen::Dynamic, 1> RealVector;
Vector v;
Scalar s;
std::cout << (s*v).stableNorm() <<std::endl;
return 0;
}
error: no matching function for call to ‘Eigen::VectorBlock<const
Eigen::Matrix<std::complex<double>,
-1, 1>, -1>::VectorBlock(Eigen::DenseBase<Eigen::Matrix<std::complex<double>, -1, 1>
::SegmentReturnType)’
internal::stable_norm_kernel(SegmentWrapper(copy.segment(bi,numext::mini(blockSize,
n - bi))),
ssq, scale, invScale);
no known conversion for argument 1 from ‘Eigen::DenseBase<Eigen::Matrix<std::complex<double>,
-1, 1>
::SegmentReturnType {aka Eigen::VectorBlock<Eigen::Matrix<std::complex<double>,
-1, 1>, -1>}’ to
‘const Eigen::VectorBlock<const Eigen::Matrix<std::complex<double>, -1,
1>, -1>&’
Eigen::VectorBlock<const Eigen::Matrix<std::complex<double>, -1, 1>,
-1>::VectorBlock(Eigen::VectorBlock<const Eigen::Matrix<std::complex<double>,
-1, 1>, -1>&&)
/home/opairs01/tools/eigen/3.3.4/include/eigen3/Eigen/src/
note: no known conversion for argument 1 from
‘Eigen::DenseBase<Eigen::Matrix<std::complex<double>, -1, 1>
::SegmentReturnType {aka
Eigen::VectorBlock<Eigen::Matrix<std::complex<double>, -1, 1>, -1>}’ to
‘Eigen::VectorBlock<const
Eigen::Matrix<std::complex<double>, -1, 1>, -1>&&’
Any help would be appreciated.
Regards
Claas
Claas H. Köhler
2017-12-15 15:06:07 UTC
Permalink
Wow, that was fast. Thanks!
Post by Gael Guennebaud
thank you for the report,
https://bitbucket.org/eigen/eigen/commits/c2947c341c68/
https://bitbucket.org/eigen/eigen/commits/499e982b9281/
(s*v).eval().stableNorm().
cheers,
gael
Hi,
When compiling the code below, I get a compiler error (using gcc-7 on openSuse 13.2). The code
compiles fine when replacing stableNorm by blueNorm. Is this intendend ?
#include <complex>
#include <iostream>
#include <Eigen/Core>
int main(void){
  typedef std::complex<double>                             Scalar;
  typedef typename Eigen::NumTraits<Scalar>::Real          RealScalar;
  typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1>         Vector;
  typedef Eigen::Matrix<RealScalar, Eigen::Dynamic, 1>     RealVector;
  Vector v;
  Scalar s;
  std::cout << (s*v).stableNorm() <<std::endl;
  return 0;
}
error: no matching function for call to ‘Eigen::VectorBlock<const Eigen::Matrix<std::complex<double>,
-1, 1>, -1>::VectorBlock(Eigen::DenseBase<Eigen::Matrix<std::complex<double>, -1, 1>
::SegmentReturnType)’
     internal::stable_norm_kernel(SegmentWrapper(copy.segment(bi,numext::mini(blockSize, n - bi))),
ssq, scale, invScale);
 no known conversion for argument 1 from ‘Eigen::DenseBase<Eigen::Matrix<std::complex<double>, -1, 1>
::SegmentReturnType {aka Eigen::VectorBlock<Eigen::Matrix<std::complex<double>, -1, 1>, -1>}’ to
‘const Eigen::VectorBlock<const Eigen::Matrix<std::complex<double>, -1, 1>, -1>&’
Eigen::VectorBlock<const Eigen::Matrix<std::complex<double>, -1, 1>,
-1>::VectorBlock(Eigen::VectorBlock<const Eigen::Matrix<std::complex<double>, -1, 1>, -1>&&)
 note:   no known conversion for argument 1 from
‘Eigen::DenseBase<Eigen::Matrix<std::complex<double>, -1, 1> >::SegmentReturnType {aka
Eigen::VectorBlock<Eigen::Matrix<std::complex<double>, -1, 1>, -1>}’ to ‘Eigen::VectorBlock<const
Eigen::Matrix<std::complex<double>, -1, 1>, -1>&&’
Any help would be appreciated.
Regards
Claas
--
Deutsches Zentrum für Luft- und Raumfahrt e.V. (DLR)
Institut für Methodik der Fernerkundung | Experimentelle Verfahren | Münchener Str 20| 82234 Weßling

Dr. Claas H. Köhler
Telefon 08153 28-1274 | Telefax 08153 28-1337 | ***@dlr.de

www.DLR.de/EOC
Loading...