From: Steven Riley <steven.riley@we...>  19991028 12:50:18

I have been using blitz for a while (19990504) and its has been a great help. I have never really worried about the fact that it takes minutes to compile on a DEC Alpha es40 with 2 gig of memory, but recently some others in the department who still have away with plain C have been making fun of me... I have looked at the example makefiles a couple of times and done a few experiments, but I can't seem to stop all the blitz source code being recompiled each time. Is this just a necessary consequence of the header files containing the object definitions, rather than having them as separate files, or am I missing some little trick that would allow me to link in a precompiled library file at the loading stage? I will spare you all the source code at this stage, but if anyone thinks they can help I'd be happy to send over a couple of files. TIA Steven Linacre College Oxford OX1 3JA 01865  (2)81229 (W) 01865  209295 (H) http://www.linacre.ox.ac.uk/student_pages/steven_riley On 27 October 1999 12:31, Todd Veldhuizen [SMTP:tveldhui@...] wrote: > John Hunter wrote: > > Hi, thanks for Blitz! After a bit of struggle, I installed > > blitz19991025 today and have been testing out some features. I'm a > > bit puzzled by one feature of the random number generator and am > > hoping you can enlighten me. > > > > Why does instantiation with 'double' produce the same number of digits > > of output as instantiation with 'float'? > > > > Is this the correct behavior? Sample code and output below. > > Hi John, the problem is that iostream is only outputting > 6 digits after the decimal place, regardless of whether you are > using float/double. If you use setprecision to set an appropriate > field width, you'll see more decimal places. The random generator > does fill the entire mantissa with random bits. Here is a small > example: > > > Some random float: > 0.763513 > 0.152969 > 0.19657 > 0.772266 > 0.97808 > > Some random doubles: > 0.152969142599849 > 0.772265646419621 > 0.769383702189215 > 0.0532872396994775 > 0.792558591879241 > > Some random long doubles: > 0.772265646419620588325471999269212 > 0.0532872396994774621958868010551669 > 0.965086563738034808324073310359381 > 0.546947016984752121260271451319568 > 0.0360279279708157831874082432932482 > > > Source code: > > #include <random/uniform.h> > #include <blitz/numinquire.h> > #include <time.h> > #include <iostream> > #include <iomanip> > > using namespace ranlib; > using namespace blitz; > > template<class T> > void printRandoms() > { > Uniform<T> x; > //x.seed((unsigned int)time(0)); > x.seed(5); > int N=5; > for (int i = 0; i < N; ++i) > cout << setprecision(digits10(T())) << x.random() << endl; > > cout << endl; > } > > int main() > { > cout << "Some random float: " << endl; > printRandoms<float>(); > > cout << "Some random doubles: " << endl; > printRandoms<double>(); > > cout << "Some random long doubles: " << endl; > printRandoms<long double>(); > > return 0; > } > > > John Hunter wrote: > > > > Hi, thanks for Blitz! After a bit of struggle, I installed > > blitz19991025 today and have been testing out some features. I'm a > > bit puzzled by one feature of the random number generator and am > > hoping you can enlighten me. > > > > Why does instantiation with 'double' produce the same number of digits > > of output as instantiation with 'float'? > > > > Is this the correct behavior? Sample code and output below. > > > > Thanks again, > > John Hunter > > > >  > > > > #include <random/uniform.h> > > #include <time.h> > > #include <iostream> > > > > > > using namespace ranlib; > > > > int main() > > { > > Uniform<float> x; > > //x.seed((unsigned int)time(0)); > > x.seed(5); > > int N=5; > > cout << "<T> is float" << endl; > > for (int i = 0; i < N; ++i) > > cout << x.random() << endl; > > } > > > > /* > > ace:~/c/examples/blitz> g++ random.cpp lblitz > > ace:~/c/examples/blitz> a.out > > <T> is double > > 0.152969 > > 0.772266 > > 0.769384 > > 0.0532872 > > 0.792559 > > ace:~/c/examples/blitz> g++ random.cpp lblitz > > ace:~/c/examples/blitz> a.out > > <T> is float > > 0.763513 > > 0.152969 > > 0.19657 > > 0.772266 > > 0.97808 > > */ > > > > > > > > > > > > >  > Todd Veldhuizen tveldhui@... > Indiana Univ. Comp. Sci. http://extreme.indiana.edu/~tveldhui/ > >  blitzsupport list  > * To subscribe/unsubscribe: use the handy web form at > http://oonumerics.org/blitz/lists.html  blitzsupport list  * To subscribe/unsubscribe: use the handy web form at http://oonumerics.org/blitz/lists.html 
From: Todd Veldhuizen <tveldhui@ex...>  20000312 20:38:14

Hi Steven, Memory and compile time are a longstanding complaint about blitz. There have been some improvements in gcc with regard to memory usage (it turned out their inlining algorithm was exponential..). Separate compilation and templates do not mix very well, because template instantiation chains cross compilation unit boundaries. There are some improvements which could be made to blitz to reduce compile times (namely, breaking it up into smaller, explicitly included chunks instead of #include <blitz/array.h> pulling in a hundred thousand lines of source code). This would require more time than I can spare just now. Todd Steven Riley wrote: > > I have been using blitz for a while (19990504) and its has been a great help. > I have never really worried about the fact that it takes minutes to compile on > a DEC Alpha es40 with 2 gig of memory, but recently some others in the > department who still have away with plain C have been making fun of me... > > I have looked at the example makefiles a couple of times and done a few > experiments, but I can't seem to stop all the blitz source code being > recompiled each time. Is this just a necessary consequence of the header files > containing the object definitions, rather than having them as separate files, > or am I missing some little trick that would allow me to link in a precompiled > library file at the loading stage? > > I will spare you all the source code at this stage, but if anyone thinks they > can help I'd be happy to send over a couple of files. > > TIA > > Steven > > Linacre College > Oxford > OX1 3JA > > 01865  (2)81229 (W) > 01865  209295 (H) > > http://www.linacre.ox.ac.uk/student_pages/steven_riley > > On 27 October 1999 12:31, Todd Veldhuizen [SMTP:tveldhui@...] > wrote: > > John Hunter wrote: > > > Hi, thanks for Blitz! After a bit of struggle, I installed > > > blitz19991025 today and have been testing out some features. I'm a > > > bit puzzled by one feature of the random number generator and am > > > hoping you can enlighten me. > > > > > > Why does instantiation with 'double' produce the same number of digits > > > of output as instantiation with 'float'? > > > > > > Is this the correct behavior? Sample code and output below. > > > > Hi John, the problem is that iostream is only outputting > > 6 digits after the decimal place, regardless of whether you are > > using float/double. If you use setprecision to set an appropriate > > field width, you'll see more decimal places. The random generator > > does fill the entire mantissa with random bits. Here is a small > > example: > > > > > > Some random float: > > 0.763513 > > 0.152969 > > 0.19657 > > 0.772266 > > 0.97808 > > > > Some random doubles: > > 0.152969142599849 > > 0.772265646419621 > > 0.769383702189215 > > 0.0532872396994775 > > 0.792558591879241 > > > > Some random long doubles: > > 0.772265646419620588325471999269212 > > 0.0532872396994774621958868010551669 > > 0.965086563738034808324073310359381 > > 0.546947016984752121260271451319568 > > 0.0360279279708157831874082432932482 > > > > > > Source code: > > > > #include <random/uniform.h> > > #include <blitz/numinquire.h> > > #include <time.h> > > #include <iostream> > > #include <iomanip> > > > > using namespace ranlib; > > using namespace blitz; > > > > template<class T> > > void printRandoms() > > { > > Uniform<T> x; > > //x.seed((unsigned int)time(0)); > > x.seed(5); > > int N=5; > > for (int i = 0; i < N; ++i) > > cout << setprecision(digits10(T())) << x.random() << endl; > > > > cout << endl; > > } > > > > int main() > > { > > cout << "Some random float: " << endl; > > printRandoms<float>(); > > > > cout << "Some random doubles: " << endl; > > printRandoms<double>(); > > > > cout << "Some random long doubles: " << endl; > > printRandoms<long double>(); > > > > return 0; > > } > > > > > > John Hunter wrote: > > > > > > Hi, thanks for Blitz! After a bit of struggle, I installed > > > blitz19991025 today and have been testing out some features. I'm a > > > bit puzzled by one feature of the random number generator and am > > > hoping you can enlighten me. > > > > > > Why does instantiation with 'double' produce the same number of digits > > > of output as instantiation with 'float'? > > > > > > Is this the correct behavior? Sample code and output below. > > > > > > Thanks again, > > > John Hunter > > > > > >  > > > > > > #include <random/uniform.h> > > > #include <time.h> > > > #include <iostream> > > > > > > > > > using namespace ranlib; > > > > > > int main() > > > { > > > Uniform<float> x; > > > //x.seed((unsigned int)time(0)); > > > x.seed(5); > > > int N=5; > > > cout << "<T> is float" << endl; > > > for (int i = 0; i < N; ++i) > > > cout << x.random() << endl; > > > } > > > > > > /* > > > ace:~/c/examples/blitz> g++ random.cpp lblitz > > > ace:~/c/examples/blitz> a.out > > > <T> is double > > > 0.152969 > > > 0.772266 > > > 0.769384 > > > 0.0532872 > > > 0.792559 > > > ace:~/c/examples/blitz> g++ random.cpp lblitz > > > ace:~/c/examples/blitz> a.out > > > <T> is float > > > 0.763513 > > > 0.152969 > > > 0.19657 > > > 0.772266 > > > 0.97808 > > > */ > > > > > > > > > > > > > > > > > > > > >  > > Todd Veldhuizen tveldhui@... > > Indiana Univ. Comp. Sci. http://extreme.indiana.edu/~tveldhui/ > > > >  blitzsupport list  > > * To subscribe/unsubscribe: use the handy web form at > > http://oonumerics.org/blitz/lists.html > >  blitzsupport list  > * To subscribe/unsubscribe: use the handy web form at > http://oonumerics.org/blitz/lists.html > >  Todd Veldhuizen tveldhui@... Indiana Univ. Comp. Sci. http://extreme.indiana.edu/~tveldhui/  blitzsupport list  * To subscribe/unsubscribe: use the handy web form at http://oonumerics.org/blitz/lists.html 