Lapack results with extended precision calculations.
Subject: Lapack results with extended precision calculations.
From: Douglas Crosher
Date: Thu, 17 Nov 2011 16:58:21 +1100
With patches to the Fortran libraries it is possible to build Maxima using extended precision float types (of the CL implementation)
for the 'flonum type, and below are some timing and accuracy results for a Lapack test across a range of CL implementations and
choices for the Maxima 'flonum type. The Scieneer CL 80 long-floats give a little extra precision without a significant performance
loss. The CMU CL 128 bit double-double floats roughly double the precision but slows the test by roughly 50 times. CLISP has
arbitrary precision long-floats and an example result at 1024 bits is given but slows the test over 500 times - some people have
requested this precision and this is one option. CLISP is a lot faster at lower precisions and to be fair a result is also given for
128 bit long-floats and it is only about three times slower than CMU CL's double-double float test but more accurate. So with this
approach there are a range of precisions and performances available if you are prepared to change the CL implementations to suit.
The test code is:
load(lapack);
load(diag);
display2d:false;
m:genmatrix(lambda([i,j],i + j),75,75)$
(showtime: all, [s, u, vt]: dgesvd(m,true,true))$
showtime: false$
err: u . diag(copylist(s)) . vt - m$
print("SVD maximum error: ", lmax(abs(list_matrix_entries(err))))$
m: u . diag(makelist (i,i,0,74)) . vt$
(showtime: all, [s, u, vt]: dgesvd(m,true,true))$
showtime: false$
err: u . diag(copylist(s)) . vt - m$
print("SVD maximum error: ", lmax(abs(list_matrix_entries(err))))$
Results sorted in order of accuracy.
Scieneer CL 64 bit double-float:
Evaluation took 0.0663 seconds (0.0667 elapsed) using 2.495 MB
SVD maximum error: 8.615330671091215e-14
CMU CL 64 bit double-float:
Evaluation took 0.1100 seconds (0.1100 elapsed) using 2.172 MB.
SVD maximum error: 7.499556531342932e-14
Scieneer CL 80 bit long-float:
Evaluation took 0.0857 seconds (0.0862 elapsed) using 4.149 MB.
SVD maximum error: 6.3317406873153458946e-17
CMU CL 128 bit double-double-float:
Evaluation took 3.7900 seconds (3.8200 elapsed) using 1197.207 MB.
SVD maximum error: 2.08160671365194490153019875164e-28
CLISP 128 bit long-float:
Evaluation took 9.2346 seconds (9.2966 elapsed) using 455.671 MB.
SVD maximum error: 2.72714689390770701848746876635560997254E-36
CLISP 1024 bit long-float:
Evaluation took 47.6238 seconds (47.8930 elapsed) using 2010.281 MB.
SVD maximum error: 7.1202363472230444258887446954636930055014...E-306