acer

32298 Reputation

29 Badges

19 years, 301 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are Posts that have been published by acer

This is one sort of Maple inconsistency that interests me. Why should the first example behave like evalf(Int(...)) and call `evalf/int` while the second example does not?

I was looking at the timelimit command in Maple, and wonder about whether it might be improved .

The help-page ?timelimit says that it suspends its checks while within builtin functions. It says that, inside builtins, the time limit is "ignored".

But Maple has a lot of builtins. And significant portions of the work may go on within them. Does this make the timelimit() function not useful, from a practical point of view?

What if timelimit were to make checks whenever garbage collection (gc) ocurred? That's a safe point, no? And gc can happen within some builtins? Or what if time checks were made at the same frequency that interrupt requests were checked? Those can happen within some builtins, at safe points.

Those were my thoughts, until I tried it. The command anames(builtin) shows that rtable() is a builtin. But I have found that timelimit will function within at least some rtable() calls.

I was reminded of this by another thread.

It is faster to add in-place a large size storage=sparse float[8] Matrix into a new empty storage=rectangular float[8] Matrix than it is to convert it that way using the Matrix() or rtable() constructors.

Here's an example. First I'll do it with in-place Matrix addition. And then after that with a call to Matrix(). I measure the time to execute as well as the increase in bytes-allocated and bytes-used.

> with(LinearAlgebra):

> N := 500:
> A := RandomMatrix(N,'density'=0.1,
>                   'outputoptions'=['storage'='sparse',
>                                    'datatype'=float[8]]):

> st,ba,bu := time(),kernelopts(bytesalloc),kernelopts(bytesused):

> B := Matrix(N,'datatype'=float[8]):
> MatrixAdd(B,A,'inplace'=true):

> time()-st,kernelopts(bytesalloc)-ba,kernelopts(bytesused)-bu;
                            0.022, 2489912, 357907

As Demmel and others have noted, SVD is both more reliable and more expensive than QR as a method of solving rank-deficient least squares problems.

SVD is the method that LinearAlgebra:-LeastSquares will choose when the Matrix has more columns than rows (n>m), unless instructed otherwise using the optional 'method' parameter.

LinearAlgebra:-SingularValues always computes a full U and Vt. But for least squares computations, such as when n>m, this is not necessary. Including the smaller singular values may just be (re-)introducing noise. See here for more detail.

Here's a 20x2000 example, using wrapperless external calling and the SVD routine dgesvd in the CLAPACK library. The effective speedup by using the Thin SVD for that 20x2000 least squares example is about a factor of 100 (ie, 2000/20), with a similar reduction in additional memory allocation.

I have been wondering about the reception of an independent patch Library for Maple.

I'll lay out a few ideas, and then maybe some criticism (or indifference) might follow.

I'm a bullet-point sort of person:

  • sourceforge project with a few willing experts for vetting and gatekeeping of submissions.
  • Patch .mla Library archive, going into /toolbox/Patch/lib/ so as to get picked up automatically by libname.
  • Self-building, with...
First 20 21 22 23 24 25 26 Page 22 of 29