This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project. See the libstdc++ home page for more information.
>>>>> Breymann <Breymann@t-online.de> wrote: > Hello Benjamin Kosnik, > you wrote: >> I read and enjoyed your book--it's great to see that you're interested in >> helping the effort to get a ISO-conformant C++ Hello! I'm sorry for the delay in replying -- I was out for for days. Can you give your book refrences? >> library into the world. Have you checked out the libstdc++-v3 distribution? >> >> http://sourceware.cygnus.com/libstdc++ >> >> It has a valarray contributed by Gabriel Dos Reis (from >> comp.lang.c++-moderated.) --you might want to check it out, and post >> questions about it to the v-3 mailing list. I, for one, would be interested >> in seeing what you have to say. > I have no special questions. Here is what I have to say: > I compared the valarray implementations of Dos Reis > and mine, as of 17th Feb 98, libstdc++2.90.2. > I use the abbreviations UB = Ulrich Breymann, GDB = Gabriel Dos Reis > General impression: > =================== > UBs valarray is much more readable than GDB. It is only > one file which uses only standard includes. Template meta > programming is suggested for improving the performance, but not > implemented. > GDB valarray uses template-optimization techniques in order > to remove temporaries, which lead to a little bit slower compilation, > but faster programs (se below). > It consists of several files which rely on an implementation > dependent directory structure for other include files. > Details: > ======= > In UBs implementation the sample programs > main_matrix.cc > main_indirect.cc > main_basics.cc > main_mask.cc > main_slices.cc > main_gslices.cc > are provided. Test results follow: > There are no differences in the results of the sample programs > main_matrix.cc > main_indirect.cc > main_basics.cc > main_slices: > =========== > UB: all is ok > GDB: > Compilation fails, becaus slice_array<T>.operator[]() is not > provided. Admittedly operator[]() is not not standard C++, but > used in an example of Stroustrup, C++ PL3, sec.22.4.6) > So this is not regarded as a problem. Without using [], > all is ok. Thanks, I'll check this and discuss the matter with Bjarne. I admit that my primarly effort is to implement ISO 14882 specifications. The implementation is not yet complete. Extensions will be offered once conformance is done. Extensions will be based on discussions with numerics experts (in order to avoid to retstart the story...) > main_gslices: > ============ > UB: all is ok > GDB: > compilation fails. Look at: > gslice G4(submatrix_gslice(G, 6,2,3)); > printIndizes(G4); > cout << "\nshow 2x3 submatrix in position 6:\n"; > valarray<double> sub1 = v[G4]; > It must be possible to create a submatrix from a gslices > but the last line cannot be compiled because of a tried > access to the private variables _M_index and _M_index_size > of class gslice. Yes, this is a known problem I'll fix in the near future. The story of this problem is tied to the compiler' limitation in the past regarding template friends. It is easly fixed. [...] > Runtime tests: > Consider the operation v = v1+v2; v,v1,v2 are valarrays > The results of runtime measurements are that GDBs implementation > is faster than UBs(as expected) by a ratio of about 1:1.4. > After having partially changed my valarray by introducing helper classes for > the results of operator + and deferring the actual computation which then > is carried out in valarray::op=(helperklass), I get the same results. > Because Dos Reis has done a lot of work on optimization already, > I suggest that cygnus makes further use of his valarray implementation. > Of course, the errors have to be corrected and the implementation > has to be tested thoroughly. For the information of GDB, I send him > a copy of this mail. > Best regards > Uli I'm glad to see C++ users interested in my contribution. Don't hesitate to ask clarifications. Thanks for your interests. -- Gaby