Mr. Roman Pearce

## 1678 Reputation

19 years, 99 days
CECM/SFU
Research Associate

I am a research associate at Simon Fraser University and a member of the Computer Algebra Group at the CECM.

## map...

map(a->`if`(a::realcons,a,0),a);

It sounds like you want a breadth first search.

## post code...

You'll have to post your code or worksheet.

## set infolevel...

I got an answer but it took 340 seconds on a midrange machine.  You can set infolevel[all] := 5: to see what Maple is doing.  It looks like it spends a lot of time in gcd, but this is misleading.  A profile reveals the culprit is simplify.  The output is large.  This may be a nice benchmark problem.  Here is the result:

res.zip

## code available...

@Dave09 For the benefit of anyone who finds this later, I have posted some code here:

http://www.mapleprimes.com/posts/203049-Sparse-Matrix-Products-In-Maple

## large plots (use lists)...

Lists are probably just as good as arrays, but the GUI will choke on higher resolutions, e.g. 1000 x 1000.

`n,m := 100,100:`
`PLOT(`
`POLYGONS(seq(seq( [[i,j],[i+1,j],[i+1,j+1],[i,j+1]], j=0..m), i=0..n)),`
`COLOR(RGB,seq(seq( op([(j+1)/(i+1),(i+1)/(j+1),i+j+1]), j=0..m), i=0..n)),`
`STYLE(PATCHNOGRID) );`

I suggest using the ImageTools package. Create a high resolution image, write your data into that, normalize it if needed, and export to a TIFF or something. That's what I do to plot large sparse matrices for example.

## computed it...

@marekszpak I assembled the result using a network of machines at the CECM.  You can download the file here, warning it is 100 MB: http://www.cecm.sfu.ca/~rpearcea/CT.zip

## tried running this...

@marekszpak I tried running this on a huge machine but it kept not returning.  Because the systems are small, I modified the code to compute univariate polynomials using one call to Groebner:-Basis in an elimination ordering.

`Q := map(parse, readdata("dataQ.txt",string)): nops(Q);ct := [seq(seq(seq([Q[i],Q[j],Q[k]], k=j+1..nops(Q)), j=i+1..nops(Q)), i=1..nops(Q))]:nops(ct);sp := proc(sys) local var, bad, pol, sol; var := [op(indets(sys))]; var, bad := var[1], var[2..-1]; pol := Groebner:-Basis(sys,lexdeg(bad,[var]),method=direct)[1]; if has(pol,bad) then return NULL; end if; sol := RootFinding:-Isolate(pol,var); sol := nops(select(e -> rhs(e) > 0, sol)); if sol > 0 then return [pol,sol,sys]; else return NULL; end if;end proc:TIMER := time[real]():ct := Grid:-Map(sp, ct):time[real]() - TIMER;nops(ct);`

To answer your questions, the CodeTools:-Usage measure of real time should be accurate.  It can't figure out CPU time because the Grid package launches separate Maple processes and CPU time is accumulated per process.  The UnivariatePolynomial command is Maple code which uses a lot of memory in proportion to the result, so it certainly generates a lot of garbage, but in theory it should be collected.  Other possible culprits are the FGb C library used to compute Groebner bases or the RS library used by Isolate, either of which could hoard memory.

I'll see if I can get your example to work.  It's a good benchmark for some of the stuff we are currently working on at SFU.

## member is fast, uses binary search on se...

member on a list does a linear search comparing pointers.  It's coded in C in the kernel, so it is fast.  If you want something faster you can use sets, i.e. A:={[2,1],[1,2],[3,5],[7,6]}; and member will do a binary search.

Can you upload Q?  UnivariatePolynomial could be the culprit, it does exact linear algebra over the rationals with coefficient blow up.  343 million calls to that are going to hurt.  I'm not sure about RootFinding:-Isolate.

We also happen to be working on some code that might help.

## Sparse linear systems in Maple...

Maple uses a combination of structured Gaussian elimination and Markowitz pivoting to solve sparse equations.  You can read more about it here:

http://www.mapleprimes.com/posts/41191-Solving-Sparse-Linear-Systems-In-Maple

## input needed...

It's a problem in Groebner:-Basis, but I'm not sure why it would be generated.  Can you please post the input?

## Groebner:-Basis...

I think you want to make the second argument to Groebner:-Basis  tdeg(r,u,v)  which is grevlex order with r > u > v.  The way you've written it, it will choose an order, probably grevlex, in all the variables and assign it to the name 'tord'.  The argument degrevlex(r,u,v) is not recognized.

## organize posts by year...

I think old posts should be organized by year.  I.e. when you search, have it give you "recent results" from the last 5 years, followed by "older results" from way back.

## margins...

I get a left margin that is about half the width of the right margin in the pdf.  Here is the preview:

maple_margins.pdf

Looking at this, the left margin looks too narrow and the right margin looks too wide.  The text should wrap later, so that the equation number is left of the text boundary.  Is this showing the problem?

 1 2 3 4 5 6 7 Last Page 3 of 39
﻿