heev

Chris Rodgers <[email protected]>
Newsgroups gmane.comp.lib.boost.ublas
Message-ID <[email protected]>
Dear All,

I am trying to update some code from v1 to the latest numeric bindings, 
but cannot see how to make heev() work.

I attach a small test program, which I attempted to compile with Visual 
Studio 2010 SP1 on Windows XP 32-bit, with boost 1.51 and the last 
revision in the boost SVN repository for the numeric bindings.

Compilation fails with the error message below.

Please could someone advise me how to get this running?

Any help would be much appreciated.

Best wishes,

Chris.

> 1>------ Build started: Project: testBoostJan2014, Configuration: 
> Debug Win32 ------
> 1>Build started 23/01/2014 16:25:02.
> 1>InitializeBuildStatus:
> 1>  Touching "Debug\testBoostJan2014.unsuccessfulbuild".
> 1>ClCompile:
> 1>  testBoostJan2014.cpp
> 1>c:\program 
> files\boost\numeric_bindings\boost\numeric\bindings\uplo_tag.hpp(56): 
> error C2039: 'type' : is not a member of 
> 'boost::numeric::bindings::detail::uplo_tag_impl<DataSide,TransTag>'
> 1>          with
> 1>          [
> 1>              DataSide=boost::mpl::void_,
> 1> TransTag=boost::numeric::bindings::tag::no_transpose
> 1>          ]
> 1>          c:\program 
> files\boost\numeric_bindings\boost\numeric\bindings\lapack\driver\heev.hpp(282) 
> : see reference to class template instantiation 
> 'boost::numeric::bindings::result_of::uplo_tag<T>' being compiled
> 1>          with
> 1>          [
> 1>              T=cmat
> 1>          ]
> 1>          c:\program 
> files\boost\numeric_bindings\boost\numeric\bindings\lapack\driver\heev.hpp(331) 
> : see reference to function template instantiation 'ptrdiff_t 
> boost::numeric::bindings::lapack::heev_impl<Value>::invoke<MatrixA,VectorW>(const 
> char,MatrixA &,VectorW 
> &,boost::numeric::bindings::lapack::optimal_workspace)' being compiled
> 1>          with
> 1>          [
> 1>              Value=std::complex<double>,
> 1>              MatrixA=cmat,
> 1>              VectorW=vec
> 1>          ]
> 1> 
> c:\midea\n4_vb17a_latest_20090307\n4\pkg\mrservers\mrspecacq\ice\icespectro_wsvd_v4\testboostjan2014\testboostjan2014.cpp(64) 
> : see reference to function template instantiation '__w64 int 
> boost::numeric::bindings::lapack::heev<cmat,vec,boost::numeric::bindings::lapack::optimal_workspace>(const 
> char,MatrixA &,VectorW &,Workspace)' being compiled
> 1>          with
> 1>          [
> 1>              MatrixA=cmat,
> 1>              VectorW=vec,
> 1> Workspace=boost::numeric::bindings::lapack::optimal_workspace
> 1>          ]
> 1>c:\program 
> files\boost\numeric_bindings\boost\numeric\bindings\lapack\driver\heev.hpp(286): 
> error C2955: 'boost::type' : use of class template requires template 
> argument list
> 1>          c:\program files\boost\boost_1_51\boost\type.hpp(14) : see 
> declaration of 'boost::type'
> 1>c:\program 
> files\boost\numeric_bindings\boost\numeric\bindings\lapack\driver\heev.hpp(289): 
> error C2780: 'ptrdiff_t 
> boost::numeric::bindings::lapack::detail::heev(const char,const 
> UpLo,const fortran_int_t,double *,const fortran_int_t,double *,double 
> *,const fortran_int_t)' : expects 8 arguments - 9 provided
> 1>          c:\program 
> files\boost\numeric_bindings\boost\numeric\bindings\lapack\driver\heev.hpp(74) 
> : see declaration of 'boost::numeric::bindings::lapack::detail::heev'
> 1>c:\program 
> files\boost\numeric_bindings\boost\numeric\bindings\lapack\driver\heev.hpp(289): 
> error C2780: 'ptrdiff_t 
> boost::numeric::bindings::lapack::detail::heev(const char,const 
> UpLo,const fortran_int_t,float *,const fortran_int_t,float *,float 
> *,const fortran_int_t)' : expects 8 arguments - 9 provided
> 1>          c:\program 
> files\boost\numeric_bindings\boost\numeric\bindings\lapack\driver\heev.hpp(59) 
> : see declaration of 'boost::numeric::bindings::lapack::detail::heev'
> 1>
> 1>Build FAILED.
> 1>
> 1>Time Elapsed 00:00:08.50
> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped 
> ==========
testBoostJan2014.cpp (text/plain, 2 KB)
// testBoostJan2014.cpp : Defines the entry point for the console application.
//

#include "targetver.h"

#include <stdio.h>
#include <tchar.h>

#include <fstream>
#include <iostream>
#include <iomanip>
#include <cmath>

#include <stdio.h>
#include <string.h>

#include <boost/format.hpp>

#define BIND_FORTRAN_LOWERCASE_UNDERSCORE
#define BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS

#include <boost/numeric/bindings/lapack/workspace.hpp>
#include <boost/numeric/bindings/ublas/matrix.hpp> 
#include <boost/numeric/bindings/ublas/vector.hpp> 
#include <boost/numeric/ublas/matrix.hpp> 
#include <boost/numeric/ublas/matrix_proxy.hpp>
#include <boost/numeric/ublas/vector.hpp> 
#include <boost/numeric/ublas/io.hpp>
//#include <boost/numeric/bindings/lapack/geev.hpp>
#include <boost/numeric/bindings/lapack/driver/heev.hpp>
#include <boost/numeric/bindings/lapack/driver/gesdd.hpp>
// New options to test:
#include <boost/numeric/bindings/lapack/driver/gesvd.hpp>
// #include <boost/numeric/bindings/lapack/driver/heevr.hpp> // We would like this, but it isn't in the version of the numeric bindings in Boost 1.36.


using namespace boost::numeric::bindings::lapack; 
using namespace boost::numeric::ublas; 

typedef matrix<std::complex<double>, column_major> cmat;
typedef vector< std::complex<double> > cvec; // Must be > > within a nested template so as not to be confused with >> operator.
typedef vector<double> vec;
typedef std::complex<double> cdouble;


int _tmain(int argc, _TCHAR* argv[])
{
	using namespace std;

	cout << "TESTING..." << endl;
	
	cmat eigVec (4,4);
	vec eigVal (4); 

	int idx,jdx;

	for (idx=0;idx<4;++idx)
		for (jdx=0;jdx<4;++jdx)
			eigVec(idx,jdx) = 10-idx-jdx; // Make this a Hermitian matrix.

	cout << "eigVec input = " << eigVec << endl;

	// Try using heev or heev because this is a Hermitian matrix:
	heev('V',eigVec,eigVal,boost::numeric::bindings::lapack::optimal_workspace());

	cout << "eigVec output = " << eigVec << endl;

	// Prompt before return.
	cout << "Type a letter and press return to finish..." << endl;
	string tmp;
	cin >> tmp;

	return 0;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.