Initial- and boundary-value problems in Maxima.



On Thu, Sep 15, 2011 at 11:42 AM, Richard Fateman <fateman at eecs.berkeley.edu
> wrote:

> On 9/15/2011 11:24 AM, Raymond Toy wrote:
> ...
>
>
>
>> Yes, but it probably won't be fast in colnew. :-(  From a quick grep of
>> the code, daxpy is called in 3 different places, and each place calls daxpy
>> with a slice of a larger array.  F2cl tries to be smart about this and
>> figures out the underlying array.  That could be expensive, depending on how
>> many intervening slices have been done.  It might be cheaper to just use the
>> normal displaced-array access.
>>
> The only other hack that comes to mind is to expand daxpy inline, perhaps
> as a macro, and that might not help either. Or call fortran.
>
>
The macro doesn't solve the array slicing issue.

Anyway, here is a partial profile, including maxima and colnew functions
from running prob4.mac using cmucl:

        Consed |       Calls |    Secs | Sec/Call |   Bytes/C. | Name:
-----------------------------------------------------------------------
  249,220,856 |      98,488 |  20.710 |  0.00021 |      2,530 | MEVALARGS
      888,872 |  16,444,225 |   9.440 |  0.00000 |          0 | ALIKE1
  213,018,152 |     443,364 |   8.240 |  0.00002 |        480 | SUBST1
   96,491,264 |   1,395,109 |   7.710 |  0.00001 |         69 | TIMESIN
   25,733,248 |   6,238,799 |   7.380 |  0.00000 |          4 | SIMPLIFYA
   55,725,752 |   3,575,248 |   7.280 |  0.00000 |         16 | ALIKE
   38,669,824 |   4,889,005 |   6.870 |  0.00000 |          8 | ZEROP1
   88,211,472 |   2,092,049 |   6.860 |  0.00000 |         42 | PLS
   68,157,344 |     381,477 |   6.620 |  0.00002 |        179 | MEMALIKE
  152,944,024 |      41,348 |   6.060 |  0.00015 |      3,699 |
COLNEW::DGESL
   37,519,816 |   3,145,210 |   5.910 |  0.00000 |         12 | SUBST0
   61,412,240 |   1,392,640 |   5.650 |  0.00000 |         44 | TMS
   40,780,056 |     849,577 |   4.780 |  0.00001 |         48 | KINDP
   42,017,976 |     644,313 |   4.730 |  0.00001 |         65 | SIMPTIMES
            0 |   7,257,154 |   4.480 |  0.00000 |          0 | MNUMP
   31,278,712 |     908,835 |   4.160 |  0.00000 |         34 | SIMPLUS
            0 |   5,529,289 |   3.730 |  0.00000 |          0 | GETL
   88,765,584 |       1,053 |   3.670 |  0.00349 |     84,298 |
COLNEW::LSYSLV
...

      121,144 |         120 |   0.000 |  0.00000 |      1,010 |
COLNEW:APPSLN
       13,504 |         303 |   0.000 |  0.00000 |         45 |
COLNEW::VMONDE
      336,128 |       1,652 |   0.000 |  0.00000 |        203 |
COLNEW::HORDER
-------------------------------------------------------------------
2,333,921,136 | 144,589,941 | 230.770 |          |            | Total


Adding up all of the time used by colnew functions, we get 21.02 sec.
Adding the times for all the other  functions, we get 209 sec for maxima.
(The sum doesn't equal 230.77 due to profiling overhead, I think.)

Hardly seems worth optimizing colnew since it represents just 10% of the
time.

Ray