Dear Torquil, I commited a fix that allows the operation "u*M(0,0)" or similar operations. The point is that the template implicit cast method are not considered by c++ name lookup (they are treated as explicit ones). So each operation that we want to support have to be overloaded explicitely. This is now done in gmm_vector.h.
Yves. Le 06/01/2016 12:52, Torquil Macdonald Sørensen a écrit : > Hi! > > I'm having some numerical problems using GMM. Consider the following > test program: > > ************************************* > gmm::row_matrix<gmm::rsvector<double> > M(1, 1); > M(0, 0) = 0.9; > > std::complex<double> u = 1.0; > > std::cout << M(0, 0) << std::endl; > std::cout << u << std::endl; > std::cout << u*M(0, 0) << std::endl; > std::cout << u*double(M(0, 0)) << std::endl; > ************************************* > > It prints: > > ************ > 0.9 > (1,0) > (0,0) > (0.9,0) > ************* > > But the third line should not be 0. For some reason, I have to > explicitly cast to double to get the correct result for the > multiplication, as I have done in the line corresponding to the fourth > printed line. > > I'm using the GetFEM SVN revision 5217, and my test program is compiled > with the following command: > > /usr/bin/mpicxx -DBOOST_SYSTEM_NO_DEPRECATED -I/usr/include/petsc > -I/home/tmac/usr/include -std=c++14 -Wfatal-errors -Wall > -Wno-unknown-pragmas -Wno-deprecated-declarations > -Wno-unused-local-typedefs -fdiagnostics-show-option -DGMM_USES_BLAS > -I/home/tmac/usr/stow/getfem/include -DGMM_USES_LAPACK > -I/home/tmac/usr/stow/getfem/include -ggdb -o > CMakeFiles/bug.exe.dir/bug.cpp.o -c /home/tmac/research/bug.cpp > > Some more info: > > $ getfem-config --configure-args > '--prefix=/home/tmac/usr/stow/getfem' '--enable-shared' '--with-pic' > '--disable-python' '--disable-matlab' '--disable-scilab' > '--disable-mumps' '--disable-par-mumps' 'MPICXX=mpicxx' > 'CXXFLAGS=-I/home/tmac/usr/include' 'LDFLAGS=-L/home/tmac/usr/lib > -L/home/tmac/usr/lib64' 'MPICC=mpicc' 'CFLAGS=-I/home/tmac/usr/include' > 'MPIFC=mpif90' > > $ gcc --version > gcc (Debian 5.3.1-5) 5.3.1 20160101 > > $ getfem-config --build-flags > -I/home/tmac/usr/include -O3 -Wall -W -fmessage-length=0 > -ftemplate-depth-100 -std=c++11 -fPIC -pedantic -Wshadow > -Wno-unknown-pragmas -Wno-variadic-macros -Wno-unused-but-set-variable > -Wpointer-arith -Wcast-qual -Wwrite-strings -Wconversion > -Wredundant-decls -Wno-long-long > > $ getfem-config --cflags > -DGMM_USES_BLAS -I/home/tmac/usr/stow/getfem/include -DGMM_USES_LAPACK > -I/home/tmac/usr/stow/getfem/include > > Torquil > > _______________________________________________ > Getfem-users mailing list > [email protected] > https://mail.gna.org/listinfo/getfem-users -- Yves Renard ([email protected]) tel : (33) 04.72.43.87.08 Pole de Mathematiques, INSA-Lyon fax : (33) 04.72.43.85.29 20, rue Albert Einstein 69621 Villeurbanne Cedex, FRANCE http://math.univ-lyon1.fr/~renard --------- _______________________________________________ Getfem-users mailing list [email protected] https://mail.gna.org/listinfo/getfem-users
