Re: [eigen] Tensor: Assert ( TensorRef< Tensor<Vector2d> > )

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Ok, the following obviously triggers the assert:
Is that intended?

PlainObjectBase<Eigen::Matrix<double, 2, 1, 0, 2, 1> > f;
f.resize(0);

And thanks for all your effort :)

BR Gabriel!


On 10/09/2015 09:51 PM, Gabriel wrote:
When using TensorRef there is the following strange assert in debug mode (release seems to work, without memory problems, address sanitizer is shotted)

Maybe this is a false positive because the following with matrices works:

          using S = Vector2d;
         using T = Matrix<S, Eigen::Dynamic, Eigen::Dynamic>;
         using TRef = Ref<T>;

         //using T = Tensor<S, 2>;  
         //using TRef = TensorRef<T>;

         T t(3,3);
         t.resize(2,2);
         TRef ref(t);

         ref.coeffRef(1,1) = S();  ///< CRASH here

       
Using the other typedefs for Tensor and TensorRef,
raises the following assert:

/usr/local/include/eigen3/Eigen/src/Core/PlainObjectBase.h:286: void Eigen::PlainObjectBase<Derived>::resize(Eigen::Index) [with Derived = Eigen::Matrix<double, 2, 1>; Eigen::Index = long int]: Assertion `((SizeAtCompileTime == Dynamic && (MaxSizeAtCompileTime==Dynamic || size<=MaxSizeAtCompileTime)) || SizeAtCompileTime == size) && size>=0' failed.

Somebody has any idea?

Gabriel

p.S: I use a static fixe size vector inside tensor because it is conceptually extremely handy in my use case ;-)

Traceback:

#0 0x7ffff65d5267    __GI_raise(sig=sig@entry=6) (../sysdeps/unix/sysv/linux/raise.c:55)
#1 0x7ffff65d6eca    __GI_abort() (abort.c:89)
#2 ??    0x00007ffff65ce03d in __assert_fail_base (fmt=0x7ffff6730028 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x40b860 "((SizeAtCompileTime == Dynamic && (MaxSizeAtCompileTime==Dynamic || size<=MaxSizeAtCompileTime)) || SizeAtCompileTime == size) && size>=0", file=file@entry=0x40b7e0 "/home/zfmgpu/Desktop/Repository/eigenFork/Eigen/src/Core/PlainObjectBase.h", line=line@entry=286, function=function@entry=0x40ca80 <Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 1, 0, 2, 1> >::resize(long)::__PRETTY_FUNCTION__> "void Eigen::PlainObjectBase<Derived>::resize(Eigen::Index) [with Derived = Eigen::Matrix<double, 2, 1>; Eigen::Index = long int]") (assert.c:92)
#3 ??    0x00007ffff65ce0f2 in __GI___assert_fail (assertion=0x40b860 "((SizeAtCompileTime == Dynamic && (MaxSizeAtCompileTime==Dynamic || size<=MaxSizeAtCompileTime)) || SizeAtCompileTime == size) && size>=0", file=0x40b7e0 "/home/zfmgpu/Desktop/Repository/eigenFork/Eigen/src/Core/PlainObjectBase.h", line=286, function=0x40ca80 <Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 1, 0, 2, 1> >::resize(long)::__PRETTY_FUNCTION__> "void Eigen::PlainObjectBase<Derived>::resize(Eigen::Index) [with Derived = Eigen::Matrix<double, 2, 1>; Eigen::Index = long int]") (assert.c:101)
#4 0x40a4a8    Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 1, 0, 2, 1> >::resize(this=0x60700000df80, size=0) (/home/zfmgpu/Desktop/Repository/eigenFork/Eigen/src/Core/PlainObjectBase.h:286)
#5 0x40a325    Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 1, 0, 2, 1> >::_init1<int>(long, Eigen::internal::enable_if<((((Eigen::DenseBase<Eigen::Matrix<double, 2, 1, 0, 2, 1> >::{unnamed type#1})2)!=(1))||(!Eigen::internal::is_convertible<int, double>::value))&&((!((Eigen::internal::is_same<Eigen::MatrixXpr, Eigen::ArrayXpr>::{unnamed type#1})0))||((({unnamed type#1})2)==Eigen::Dynamic)), Eigen::internal::is_convertible>::type*)(this=0x60700000df80, size=0) (/home/zfmgpu/Desktop/Repository/eigenFork/Eigen/src/Core/PlainObjectBase.h:742)
#6 0x409fb1    Eigen::Matrix<double, 2, 1, 0, 2, 1>::Matrix<int>(this=0x60700000df80, x=@0x7fffffffe074: 0) (/home/zfmgpu/Desktop/Repository/eigenFork/Eigen/src/Core/Matrix.h:296)
#7 0x409c3b    Eigen::internal::TensorLazyEvaluatorReadOnly<Eigen::DSizes<long, 2ul>, Eigen::Tensor<Eigen::Matrix<double, 2, 1, 0, 2, 1>, 2ul, 0, long>, Eigen::DefaultDevice>::TensorLazyEvaluatorReadOnly(this=0x60700000df40, expr=..., device=...) (/home/zfmgpu/Desktop/Repository/eigenFork/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h:48)
#8 0x409781    Eigen::internal::TensorLazyEvaluatorWritable<Eigen::DSizes<long, 2ul>, Eigen::Tensor<Eigen::Matrix<double, 2, 1, 0, 2, 1>, 2ul, 0, long>, Eigen::DefaultDevice>::TensorLazyEvaluatorWritable(this=0x60700000df40, expr=..., device=...) (/home/zfmgpu/Desktop/Repository/eigenFork/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h:83)
#9 0x409185    Eigen::internal::TensorLazyEvaluator<Eigen::DSizes<long, 2ul>, Eigen::Tensor<Eigen::Matrix<double, 2, 1, 0, 2, 1>, 2ul, 0, long>, Eigen::DefaultDevice>::TensorLazyEvaluator(this=0x60700000df40, expr=..., device=...) (/home/zfmgpu/Desktop/Repository/eigenFork/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h:103)
#10 0x408d7b    Eigen::TensorRef<Eigen::Tensor<Eigen::Matrix<double, 2, 1, 0, 2, 1>, 2ul, 0, long> >::TensorRef<Eigen::Tensor<Eigen::Matrix<double, 2, 1, 0, 2, 1>, 2ul, 0, long> >(this=0x7fffffffe170, expr=...) (/home/zfmgpu/Desktop/Repository/eigenFork/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h:148)
#11 0x40840e    eigenTensorTest() (/home/zfmgpu/Desktop/Repository/SimulationFramework/SourceCode/Projects/TestBench/Projects/EigenTest/include/EigenTensorTest.hpp:160)
#12 0x40851c    main() (/home/zfmgpu/Desktop/Repository/SimulationFramework/SourceCode/Projects/TestBench/Projects/EigenTest/src/main.cpp:14)




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/