Re: [Lapackpp-devel] Updated display for lapackpp to display matrices in MATLAB and MAPLE formats
Status: Beta
Brought to you by:
cstim
From: Christian S. <sti...@tu...> - 2005-03-17 08:23:51
|
Dear Jacob, ok, thanks f=FCr adding this. It looks quite nice. Just some small=20 nitpicking from my side: - Could you please move the enum pFormat into the LaPreference class=20 instead of having it as a global type? Currently, the symbols NORMAL,=20 MATLAB, MAPLE are global values of the enum and might very well collide=20 with some defines or whatever in some application. If they are inside=20 the LaPreference class, they can be used as LaPreference::NORMAL=20 everywhere and will avoid any collisions. - Right now the code of the LaGenMatDouble class is copied into=20 LaGenMatFloat. Since printing of matrices is not at all time-critical, I=20 was wondering whether you can get rid of this code duplication by=20 calling the LaGenMatDouble::operator<< from the=20 LaGenMatFloar::operator<< with a locally converted copy of the Float=20 matrix? That way, the actual implementation of the output code would=20 only exist once for doubles, and once for complex, but not more than that. - Your explanation is quite nice. Can you add that to laprefs.h in=20 doxygen format? That way, other people would immediately find this, too. Thanks for this contribution. If you are satisfied with the result, I=20 would prepare a new release (2.1.3 or 2.2.0). Christian Jacob (Jack) Gryn schrieb: > Ok. >=20 > =20 >=20 > So I=92ve committed the addition of an LaPreferences class, along with=20 > modified LaGenMatDouble, LaGenMatFloat, and LaGenMatComplex classes to=20 > support the new output formats (only operator<< has changed, along with= =20 > the additional include of LA_PREFS_H).=20 >=20 > =20 >=20 > The following is how one would modify the output display format to be=20 > compatible with their favourite math program: >=20 > =20 >=20 > Place >=20 > #include LA_PREFS_H=20 >=20 > In the include statements, somewhere after =93lafnames.h=94 >=20 > =20 >=20 > At the beginning of your code, call >=20 > =20 >=20 > LaPreferences::setPrintFormat(pFormat p, bool newlines); >=20 > =20 >=20 > Where pFormat is an enum type, that can be one of the following {NORMAL= ,=20 > MATLAB, MAPLE}, >=20 > and bool newlines toggles multiline matrix output (true =3D places a=20 > newline after each matrix row, false uses only the appropriate=20 > MATLAB/MAPLE delimiter) =96 this option is ignored if pFormat =3D=3D NO= RMAL >=20 > =20 >=20 > Enjoy! J >=20 > =20 >=20 > BTW, I only did those 3 classes for now, it would take a while for me t= o=20 > implement and test all the classes, many of which I=92ve never used=20 > before; but if anyone wants, feel free to make appropriate changes base= d=20 > on what=92s been done to gmc.cc, gmd.cc, gmf.cc. =20 >=20 > =20 >=20 > I really think it would be simpler to do if the matrix classes were=20 > derived from a single base class, so only one version of the operator<<= =20 > would be needed (except for the ones with complex #=92s). >=20 > =20 >=20 > Jack >=20 |