Dear gemm users,
I think that I found a bug in the gmm and a way to fix it. Here is an example which produces the bug. I only changed one line and "I think" that I fixed it. Please let me know if I should not have done it or there is a better solution:
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <exception>
#include <math.h>
#include <sstream>
#include <cstdlib>
#define GMM_USES_LAPACK
#include <gmm/gmm.h>
int main(int argc, char *argv[])
{
std::vector<double> X(3);
std::vector<double> Y(3);
gmm::dense_matrix<double> M(3,3);
M(0,0) = M(1,1) = M(2,2) = 2.0 ;
M(1,2) = 1.0 ;
X[0] = 1.0 ; X[1] = 2.0 ; X[1] = 3.0 ;
gmm::mult(M,X,Y) ;
std::cout << M << " times " << X << "is equal to " << Y << std::endl ;
}
and here is what I got when i tried to compile it :
address@hidden/gmmBugTest1$ g++ Ex1.cpp -o Ex1 -I/home/kayhan/Src/gmmSource/tmpInstall/include -llapack -lblas -lg2c
In file included from /home/kayhan/Src/gmmSource/tmpInstall/include/gmm/gmm.h:47,
from Ex1.cpp:11:
/home/kayhan/Src/gmmSource/tmpInstall/include/gmm/gmm_lapack_interface.h:
In function ‘void gmm::svd(gmm::dense_matrix<std::complex<float> >&, gmm::dense_matrix<std::complex<float> >&, gmm::dense_matrix<std::complex<float> >&, std::vector<float, std::allocator<float> >&)’:
/home/kayhan/Src/gmmSource/tmpInstall/include/gmm/gmm_lapack_interface.h:412: error: ‘cgesvd_’ was not declared in this scope
/home/kayhan/Src/gmmSource/tmpInstall/include/gmm/gmm_lapack_interface.h: In function ‘void gmm::svd(gmm::dense_matrix<std::complex<double> >&, gmm::dense_matrix<std::complex<double> >&, gmm::dense_matrix<std::complex<double> >&, std::vector<double, std::allocator<double> >&)’:
/home/kayhan/Src/gmmSource/tmpInstall/include/gmm/gmm_lapack_interface.h:413: error: ‘zgesvd_’ was not declared in this scope
To fix it, I changed the line 366 on the gmm_lapack_interface.h and
changed it to :
void sgesvd_(...); void dgesvd_(...); void cgesvd_(...); void zgesvd_(...) ;
and it fixes the problem.
I am using Ubuntu8.10, 64bit system, gcc4.3.2,gmm3.1 . Please let me know if more information is required.
Regards,
Kayhan