From: Gehua Yang <yangg2@rp...>  20050412 18:36:05

In your class vnl_numeric_traits< mp_complex >, I believe you forgot to change the type of maxval. In vnl_numeric_traits.cxx, could you add: const mp_complex vnl_numeric_traits<mp_complex >::zero(0.0); const mp_complex vnl_numeric_traits<mp_complex >::one(1.0); const mp_complex vnl_numeric_traits<mp_complex >::maxval(1E+308); // let's not worry about this value for now const mp_real vnl_numeric_traits<mp_real >::zero(0.0); const mp_real vnl_numeric_traits<mp_real >::one(1.0); const mp_real vnl_numeric_traits<mp_real >::maxval(1E+308); // let's not worry about this value for now All these are just to make it complete. I do not know what construtors are available for mp_real and mp_complex. Please change them accordingly. At this point, you should be able to compile vnl_numeric_traits.cxx without errors. Looking at the errors you attached, they happened when compling vnl_unary_function+double.vnl_vector+double.cxx, which has nothing to do with mp_real or mp_complex. If you haven't had problems with this file before, then it is quite likely your changes to vnl_matrix or vnl_vector caused these errors. Let's focus on vnl_matrix.txx. member functions, such as normalize_rows, normalize_columns, and operator_one_norm, are all templated on types. As far as I can see, vnl_matrix+mp_complex.cxx instantiation is likely to compile without any modifications to vnl_matrix. The errors you encountered may cause by: 1. the vcl_complex<double> typo in class vnl_numeric_traits< mp_complex >. 2. Missing the definition of mp_real and/or mp_complex. In your vnl_matrix+mp_complex.cxx, please try the following: #include <mp_complex.h> #include <vnl/vnl_matrix.txx> VNL_MATRIX_INSTANTIATE(mp_complex); The order of header files does matter. Gehua Riccardo Lattanzi wrote: >Hi, > >Thanks for your suggestion. >I added the specialization on vnl_numeric_traits but that caused >new error to arise. >I did the vnl_numeric_traits<mp_complex> and vnl_numeric_traits<mp_real> >adding the following to vnl_numeric_traits.h (AND NOTHING TO >vnl_numeric_traits.cxx): > >class vnl_numeric_traits< mp_complex > >{ > public: > //: Additive identity > static const mp_complex zero; > //: Multiplicative identity > static const mp_complex one; > // Maximum value which this type can assume; makes no sense for this type > //static const vcl_complex<double> maxval; > > //: Return value of abs() > typedef mp_real abs_t; > //: Name of a type twice as long as this one for accumulators and products. > typedef mp_complex double_t; > //: Name of type which results from multiplying this type with a double > typedef mp_complex real_t; >}; > >class vnl_numeric_traits< mp_real > >{ > public: > //: Additive identity > static const mp_real zero; > //: Multiplicative identity > static const mp_real one; > //: Maximum value which this type can assume > static const mp_real maxval; > //: Return value of abs() > typedef mp_real abs_t; > //: Name of a type twice as long as this one for accumulators and products. > typedef mp_real double_t; > //: Name of type which results from multiplying this type with a double > typedef mp_real real_t; >}; > >That seemed to work per se but lead to many errors when I rebuilt vnl. >There are some member functions in vnl_matrix.txx (i.e. normalize_rows, >normalize_columns, operator_one,_norm,....) that use some functions which are >not templated and expect vcl_complex<double> (i.e. vnl_math_squared_magnitude, >vnl_math_abs, vnl_matlab_isfinite,...). >I tried to work around that commenting out the member functions of vnl_matrix >which were causing problems (not very elegant, but if I can build at least I >could try to write examples with vnl_matrix<mp_complex>). >Using such "cheating" I got rid of most of the errors. >The remaining ones are related to the file vnl_unary_function_h which I think >doesn't work because it searches for the limits of mp_complex and mp_real in >vcl_numeric_limits. (at the end of the email I'm attaching the error message) > >Is something I did wrong when adding the specialization on vnl_numeric_traits.h >? >I don't think I'm ready to solve that problem without the guide of some Vxl >devoloper. >Can you please help me with this? > >Thanks a lot, >Riccardo Lattanzi > > >Error Message: > >Configuration: vnl  Win32 Release >Compiling... >vnl_unary_function+double.vnl_vector+double.cxx >D:\Vxl\vxl1.1.0\core\vnl/vnl_unary_function.txx(32) : warning C4003: not enough >actual parameters for macro 'min' >D:\Vxl\vxl1.1.0\core\vnl/vnl_unary_function.txx(39) : warning C4003: not enough >actual parameters for macro 'max' >D:\Vxl\vxl1.1.0\core\vnl/vnl_unary_function.txx(32) : error C2589: '(' : >illegal token on right side of '::' > C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xstring(583) : >while compiling classtemplate member function 'double __thiscall >vnl_unary_function<double,class vnl_vector<double> >::get_range_min(void) >const' >D:\Vxl\vxl1.1.0\core\vnl/vnl_unary_function.txx(32) : error C2059: syntax error >: '::' > C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xstring(583) : >while compiling classtemplate member function 'double __thiscall >vnl_unary_function<double,class vnl_vector<double> >::get_range_min(void) >const' >D:\Vxl\vxl1.1.0\core\vnl/vnl_unary_function.txx(39) : error C2589: '(' : >illegal token on right side of '::' > C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xstring(583) : >while compiling classtemplate member function 'double __thiscall >vnl_unary_function<double,class vnl_vector<double> >::get_range_max(void) >const' >D:\Vxl\vxl1.1.0\core\vnl/vnl_unary_function.txx(39) : error C2059: syntax error >: '::' > C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xstring(583) : >while compiling classtemplate member function 'double __thiscall >vnl_unary_function<double,class vnl_vector<double> >::get_range_max(void) >const' >Error executing cl.exe. > >vnl.lib  4 error(s), 2 warning(s) > > > 