## vxl-maintainers

 [Vxl-maintainers] Problem: cos_angle(a,b) sometimes greater than 1. From: Ian Scott - 2002-02-08 17:41:55 ```Hi, I've noticed a problem with T cos_angle(vnl_vector a, vnl_vector b) occasionally (when a&b point in the same direction) rounding errors cause cos_angle to return (1+eps). vcl_acos(1+eps) returns NaN. So this makes double angle(vnl_vector a, vnl_vector b) fail. Now I could fix the problem by simply limiting the value returned by cos_angle to [+1,-1], Unfortunately this is hard to do with the complex type templating in these functions.. Alternatives 1. rewrite cos_angle so that it is immune to this problem, However, we can't see how - any suggestions welcome. 2. Test the vnl_math_abs of the output of cos_angle, and if it is greater than 1, then divide the output by its magnitude. (Note this might not always work, since playing around with values close to 1 seems to be what caused the problem in the first place) 3. Get a better math unit for my processor :-) 4. Any other suggestions? Ian. ```
 Re: [Vxl-maintainers] Problem: cos_angle(a,b) sometimes greater than 1. From: Peter Vanroose - 2002-02-08 20:05:57 ```> cos_angle to return (1+eps). vcl_acos(1+eps) returns NaN. > > Alternatives > 1. rewrite cos_angle so that it is immune to this problem, However, we can't > see how - any suggestions welcome. Maybe re-implement vcl_acos such that it always returns 0 when its argument is > 1 (and Pi when its argument is < -1) ? Or replace the line return vcl_acos( abs_r( cos_angle(a, b) ) ); in vcl_vector.txx by abs_r c = abs_r( cos_angle(a, b) ); return c<1 ? vcl_acos(c) : vcl_acos(1.0); I've tried out the latter and it seems to work fine. Peter. ```
 [Vxl-maintainers] Borland compile error From: William A. Hoffman - 2002-02-11 17:50:25 ```I am getting the following error with the borland compiler: C:/Hoffman/vnl/vnl/Templates/vnl_c_vector+vnl_rational-.cxx: Error E2015 C:/Hoffman/vnl\vnl/vnl_c_vector.txx 246: Ambiguity between 'vnl_rati onal::vnl_rational(long,long)' and 'vnl_rational::vnl_rational(int,int)' in func tion vnl_c_vector_rms_norm(const vnl_rational *,unsig ned int,vnl_rational *) Error E2015 C:/Hoffman/vnl\vnl/vnl_c_vector.txx 262: Ambiguity between 'vnl_rati onal::vnl_rational(long,long)' and 'vnl_rational::vnl_rational(int,int)' in func tion vnl_c_vector_two_norm(const vnl_rational *,unsig ned int,vnl_rational *) Error E2015 C:/Hoffman/vnl\vnl/vnl_c_vector.txx 37: Ambiguity between 'vnl_ratio nal::vnl_rational(long,long)' and 'vnl_rational::vnl_rational(int,int)' in funct ion vnl_c_vector::normalize(vnl_rational *,unsigned int) *** 3 errors in Compile *** Any ideas for a fix? -Bill ```
 Re: [Vxl-maintainers] Borland compile error From: William A. Hoffman - 2002-02-11 18:02:58 ```If I remove the explicit from here: //: Creates a rational from a double. // This is done by computing the continued fraction approximation for d. // Note that this is explicitly *not* an automatic type conversion. explicit vnl_rational (double d); Then this compiles: template void vnl_c_vector_rms_norm(T const *p, unsigned n, S *out) { vnl_c_vector_two_norm_squared(p, n, out); *out /= n; typedef typename vnl_numeric_traits::real_t real_t; *out = (S)(vcl_sqrt(real_t(*out))); // trouble is here } It would seem that for vnl_c_vector to work you need a type coversion from double here. -Bill At 12:49 PM 2/11/2002 -0500, William A. Hoffman wrote: >I am getting the following error with the borland compiler: > > >C:/Hoffman/vnl/vnl/Templates/vnl_c_vector+vnl_rational-.cxx: >Error E2015 C:/Hoffman/vnl\vnl/vnl_c_vector.txx 246: Ambiguity between 'vnl_rati >onal::vnl_rational(long,long)' and 'vnl_rational::vnl_rational(int,int)' in func >tion vnl_c_vector_rms_norm(const vnl_rational *,unsig >ned int,vnl_rational *) >Error E2015 C:/Hoffman/vnl\vnl/vnl_c_vector.txx 262: Ambiguity between 'vnl_rati >onal::vnl_rational(long,long)' and 'vnl_rational::vnl_rational(int,int)' in func >tion vnl_c_vector_two_norm(const vnl_rational *,unsig >ned int,vnl_rational *) >Error E2015 C:/Hoffman/vnl\vnl/vnl_c_vector.txx 37: Ambiguity between 'vnl_ratio >nal::vnl_rational(long,long)' and 'vnl_rational::vnl_rational(int,int)' in funct >ion vnl_c_vector::normalize(vnl_rational *,unsigned int) >*** 3 errors in Compile *** > >Any ideas for a fix? > >-Bill > > >_______________________________________________ >Vxl-maintainers mailing list >Vxl-maintainers@... >https://lists.sourceforge.net/lists/listinfo/vxl-maintainers ```
 Re: [Vxl-maintainers] Borland compile error From: William A. Hoffman - 2002-02-11 18:12:25 ```In vnl_levenberg_marquardt.cxx, there are calls to fprintf and not vcl_fprintf. This does not work on Borland because it adds std::fprintf for The problem is that vcl does not seem to have a vcl_stderr, so it can not be fixed. -Bill ```
 [Vxl-maintainers] vcl_ios_cur on sgi 730 From: William A. Hoffman - 2002-02-11 21:48:03 ```With the sgi 730 compiler I get this error: cc-3168 CC: ERROR File = /rolle/insight/Insight/vnl/vnl/vnl_matlab_read.cxx, Line = 118 A name followed by "::" must be a class or namespace name. s.seekg(n, vcl_ios_cur); ^ The problem is that the configure scripts determine the compiler does not need std::ios::cur but rather ::ios::cur. This is because sqrt is not in std::, however ios is. There may be a need for the configure script to look for: VCL_IOS_STD_NAMESPACE VCL_STL_STD_NAMESPACE VCL_CSTD_STD_NAMESPACE instead of the one flag that exists now. -Bill ```
 Re: [Vxl-maintainers] Borland compile error From: Peter Vanroose - 2002-02-15 14:35:24 ```> template > void vnl_c_vector_rms_norm(T const *p, unsigned n, S *out) > { > vnl_c_vector_two_norm_squared(p, n, out); > *out /= n; > typedef typename vnl_numeric_traits::real_t real_t; > *out = (S)(vcl_sqrt(real_t(*out))); // trouble is here > } Try replacing that last line with *out = S(vcl_sqrt(real_t(*out))); Probably, (vnl_rational)(x) with x of type double is not seen as an "explicit" call of the "double" constructor, while vnl_rational(x) is. (It is used that way a few lines further down.) Peter. ```
 Re: [Vxl-maintainers] Borland compile error From: William A. Hoffman - 2002-02-15 14:43:07 ```There is a larger borland problem that is a bit more of a show stopper. The names of the template files with the + and - stuff in the names confuse the linker that uses those as separators and special symbols. -Bill At 03:35 PM 2/15/2002 +0100, Peter Vanroose wrote: > > template > > void vnl_c_vector_rms_norm(T const *p, unsigned n, S *out) > > { > > vnl_c_vector_two_norm_squared(p, n, out); > > *out /= n; > > typedef typename vnl_numeric_traits::real_t real_t; > > *out = (S)(vcl_sqrt(real_t(*out))); // trouble is here > > } > >Try replacing that last line with > > *out = S(vcl_sqrt(real_t(*out))); > > >Probably, > (vnl_rational)(x) >with x of type double is not seen as an "explicit" call of the "double" >constructor, while > vnl_rational(x) >is. (It is used that way a few lines further down.) > > > Peter. > > >_______________________________________________ >Vxl-maintainers mailing list >Vxl-maintainers@... >https://lists.sourceforge.net/lists/listinfo/vxl-maintainers ```
 Re: [Vxl-maintainers] Borland compile error From: Peter Vanroose - 2002-02-15 14:55:52 ```> There is a larger borland problem that is a bit more of a show stopper. > The names of the template files with the + and - stuff in the names confuse the > linker that uses those as separators and special symbols. Does that mean Borland-C cannot work with files that have dashes in their name? Peter. ```
 Re: [Vxl-maintainers] Borland compile error From: William A. Hoffman - 2002-02-15 15:47:26 ```Yes. \$ tlib /a foobar.lib foo-bar.obj TLIB 4.5 Copyright (c) 1987, 1999 Inprise Corporation Warning: 'foo.OBJ' file not found Warning: 'bar' not found in library There is no way to escape the dash or plus. -Bill At 03:55 PM 2/15/2002 +0100, Peter Vanroose wrote: > > There is a larger borland problem that is a bit more of a show stopper. > > The names of the template files with the + and - stuff in the names > confuse the > > linker that uses those as separators and special symbols. > >Does that mean Borland-C cannot work with files that have dashes in their >name? > > > Peter. > > >_______________________________________________ >Vxl-maintainers mailing list >Vxl-maintainers@... >https://lists.sourceforge.net/lists/listinfo/vxl-maintainers ```
 Re: [Vxl-maintainers] Borland compile error From: William A. Hoffman - 2002-02-18 14:18:42 ```So, if the borland compiler is to ever be supported, the template file names must be changed. -Bill At 10:42 AM 2/15/2002 -0500, William A. Hoffman wrote: >Yes. > >\$ tlib /a foobar.lib foo-bar.obj >TLIB 4.5 Copyright (c) 1987, 1999 Inprise Corporation >Warning: 'foo.OBJ' file not found >Warning: 'bar' not found in library > >There is no way to escape the dash or plus. > > >-Bill > > >At 03:55 PM 2/15/2002 +0100, Peter Vanroose wrote: >>> There is a larger borland problem that is a bit more of a show stopper. >>> The names of the template files with the + and - stuff in the names confuse the >>> linker that uses those as separators and special symbols. >> >>Does that mean Borland-C cannot work with files that have dashes in their name? >> >> >> Peter. >> >> >>_______________________________________________ >>Vxl-maintainers mailing list >>Vxl-maintainers@... >>https://lists.sourceforge.net/lists/listinfo/vxl-maintainers > > > >_______________________________________________ >Vxl-maintainers mailing list >Vxl-maintainers@... >https://lists.sourceforge.net/lists/listinfo/vxl-maintainers ```

JavaScript is required for this form.

No, thanks