Items tagged with compiler

Why won't this procedure Compile? All I get is a cryptic and ungrammatical error message.

    step:= proc(
          XYZ::Matrix(datatype= float[8]),
          E::Vector(datatype=integer[4]), F::Vector(datatype=integer[4]),
          W::Matrix(datatype= float[8]), #3x2 scratch matrix
     option autocompile;
          i::integer[4], j::integer[4],
          p::float[8], t::float[8]       
          to mu do
               for i to n do
                    ed:= 0;  fd:= 0;
                    for j to 3 do
                          p:= XYZ[i,j];
                          t:= XYZ[E[i],j] - p;
                          ed:= ed+t^2;
                          W[j,1]:= t;
                          t:= XYZ[F[i],j] - p;
                          fd:= fd+t^2;
                          W[j,2]:= t
                    ed:= sqrt(ed) + .01;  fd:= sqrt(fd) + .01;
                    for j to 3 do
                         XYZ[i,j]:= 0.995*XYZ[i,j] - 0.01*W[j,1]/ed + 0.02*W[j,2]/fd
     end proc;

Error, (in Compiler:-Compile1) In memory compilation failed

I am trying to use Compiler:-Compile with a generated function having a Vector as an argument. My function is (in a simplified form)

Mapt:=proc (pv) options operator, arrow; rtable(1 .. 6, {1 = .998026692438229*pv[1]-.605526643146912*pv[2]+0.154549004943741e-1*pv[6]+0.140818440886566e-5*pv[5], 2 = 0.651134546344795e-2*pv[1]+.998026692438228*pv[2]-0.510903331894809e-1*pv[6]+0.229399145141077e-8*pv[5], 3 = -.500000000000002*pv[3]-5.95856898901206*pv[4], 4 = .125869147673385*pv[3]-.499999999999996*pv[4], 5 = 0.510903331894806e-1*pv[1]-0.154549004943901e-1*pv[2]-40.6778361021594*pv[6]+.999998210424947*pv[5], 6 = .999998210424947*pv[6]-0.229399145141220e-8*pv[1]-0.140818440886565e-5*pv[2]+0.897571581395136e-7*pv[5]}, datatype = anything, subtype = Vector[column], storage = rectangular, order = Fortran_order) end proc;

Since this returns a Vector it cannot be compiled as is. So I split off the first output element (with the idea to later on do this with the others as well):

f1(<0.001,0.001,0,0,0,0>); # test f1: works

sf1:=Compiler:-Compile(f1); # this works, too

sf1(<0.001,0.001,0,0,0,0>); # but this fails
Error, (in sf1) invalid input: expecting a hardware float[8] rtable, but received 1

The examples in the Helpfile run so I think my installation is ok (my old Maple 15 won't even run the examples, but that is a different story). I have been banging my head against the wall here, trying many different ways, but none of them successfull. Worse, I do not understand the error message at all. Test program attached.

Mac OS X 10.10.5

Thanks for any hint,


What is the correct mode of using dsolve/numeric/compile with Grid package?

I've tried a lot of different, but only one turned out to be working is by using Grid:-Seq(dsolve..., i=1).

For example:


dsol := Grid:-Seq(dsolve(dsys, numeric, parameters = [bb, qq, prf0, `p&theta;f0`], compile = true, optimize = true, output = listprocedure, maxfun = 0), i = 1):

dsol3 := proc (tt) try dsol[3](tt) catch "cannot evaluate the solution further": tt = 0. end try end proc:

st := time[real]():

A := Array([Grid:-Seq([seq(op(2, [dsol[1](parameters = [b[i, j], q[i, j], pr[i, j], `p&theta;`[i, j]]), rhs(dsol3(-10^6))]), j = 1 .. sz[2])], i = 1 .. sz[1])]);


But this mode not stable and causing to this error very often:

Error, (in dsolve/numeric/SC/preproc) unable to post-link (rc=31), please try again, and if that fails check that your Windows SDK installation is up to date, and compatible with your Windows compiler

How I can fix this problem?

Dear all,

I want to use the Maple Compiler to improve the performance of some of my codes. To get used to it, I tried doing the examples from the ?Compiler help-page, but everytime I run the compiler, I get the error message:

"Error, (in Compiler:-Compile) compiler exited with nonzero status 1: 

Do some of you know a possible reason for this?

Thank you all.


The following (downsized) images of Lyapunov fractals were each generated in a few seconds, in Maple 16.


I may make an interface for this with embedded components, or submit it in some form on the Application Center. But I thought that I'd share this version here first.

I'm just re-using the techniques in the code behind an earlier Post on Mandelbrot and Julia fractals. But I've only used one simple coloring scheme here, so far. I'll probably try the so-called burning ship escape-time fractal next.





Here below is the contents of the worksheet attached at the end of this Post.



The procedures are defined in the Startup code region of this worksheet.


It should run in Maple 15 and 16, but may not work in earlier versions since it relies on a properly functioning Threads:-Task.


The procedure `Lyapunov` can be called as


          Lyapunov(W, xa, xb, ya, yb, xresolution)

          Lyapunov(W, xa, xb, ya, yb, xresolution, numterms=N)


where those parameters are,


 - W, a Vector or list whose entries should be only 0 or 1

 - xa, the leftmost x-point (a float, usually greater than 2.0)

 - xb, the rightmost x-point (a float, usually less than or equal to 4.0)

 - ya, the lowest y-point (a float, usually greater than 2.0)

 - yb, the highest y-point (a float, usually less than or equal to 4.0)

 - xresolution, the width in pixels of the returned image (Array)

 - numterms=N, (optional) where positive integer N is the number of terms added for the approx. Lyapunov exponent



The speed of calculation depends on whether the Compiler  is functional and how many cores are detected. On a 4-core Intel i7 under Windows 7 the first example below had approximately the following performce in 64bit Maple 16.





serial (1 core)

20 seconds

240 seconds

parallel (4 cores)

5 seconds

60 seconds





res1:=CodeTools:-Usage( Lyapunov(W, 2.01, 4.0, 2.01, 4.0, 500) ):

memory used=46.36MiB, alloc change=65.73MiB, cpu time=33.87s, real time=5.17s


res2:=CodeTools:-Usage( Lyapunov(W, 2.5, 3.4, 3.4, 4.0, 500) ):

memory used=30.94MiB, alloc change=0 bytes, cpu time=21.32s, real time=3.54s


res3:=CodeTools:-Usage( Lyapunov(W, 2.1, 3.7, 3.1, 4.0, 500) ):

memory used=26.18MiB, alloc change=15.09MiB, cpu time=18.44s, real time=2.95s


res4:=CodeTools:-Usage( Lyapunov(W, 2.01, 4.0, 2.01, 4.0, 500) ):

memory used=46.25MiB, alloc change=15.09MiB, cpu time=33.52s, real time=5.18s





Does maple 16  work with Visual studio 2012?

I installed M16 32 Bit on my new machine with Win7 64 Bit.

But the following results in crushing mserver.exe:

  tmp := proc( x :: float ) :: float; 2.3 * x end proc:

with system info below.

Do I have to set certain rights for the compiler or define a specific working directory?

The FAQ does not help me.

Dito http://www.maplesoft...

I have a compiled function and want to integrate it numerically.  The integration procedure first tries to evaluate the integrand with symbolic values and return a error, since the compiled function accepts only real values.  So I have to write a STUPID workaround  for manual typechecking:

integrand2 := proc (kF1, kF2, m, k, omega, q) if type(kF1, numeric) and type(q, numeric) and type(kF2, numeric) and type(omega, numeric) and type(m, numeric) and type(k, numeric...

Using techniques previously used for generating color images of logistic maps and complex argument, attached is a first draft of a new Mandelbrot set fractal image applet.

A key motive behind this is the need for a faster fractal generator than is currently available on the Application Center as the older Fractal Fun! and Mandelbrot Mania with Maple entries. Those older apps warn against being run with too high a resolution for the final image, as it would take too long. In fact, even at a modest size such as 800x800 the plain black and white images can take up to 40 seconds to generate on a fast Intel i7 machine when running those older applications.

The attached worksheet can produce the basic 800x800 black and white image in approximately 0.5 seconds on the same machine. I used 64bit Maple 15.01 on Windows 7 for the timings. The attached implementration uses the Maple Compiler to attain that speed, but should fall back to Maple's quick evalhf mode in the case that the Compiler is not properly configured or enabled.

The other main difference is that this new version is more interactive: using sliders and other Components. It also inlines the image directly (using a Label), instead of as a (slow and resource intensive) density plot.

Run the Code Edit region, to begin. Make sure your GUI window is shown large enough for you to see the sides of the GUI Table conveniently.

The update image appearing in the worksheet is stored in a file, the name of which is currently set to whatever the following evaluates to in your Maple,


You can copy the current image file aside in your OS while experimenting with the applet, if you want to save it at any step. See the start of the Code Edit region, to change this filename setting.

Here's the attachment. Comments are welcome, as I'd like to make corrections before submitting to the Application Center. Some examples of images (reduced in size for inclusion here) created with the applet are below.


I just downloaded Maple 15 and am trying to install on a 64-bit Windows 7 machine.


About halfway through the installation, there is a step where you are either supposed to supply the path to a batch file that will supply the environment variables that will locate Microsoft Visual C compiler, or supply them later as an option. The instructions say that Maple has a default batch file that will do this, but when that option is chosen, nothing shows up in...

Dear Maple lovers,

As a classical worksheet user from the past years, now I'd like to be a "modern" Maple user, using the 2D Input in the modern worksheet mode (I will call it mwm from now on). But, alas, I cannot even solve a simple equation!

To describe my situation let me state the following:

1. I use 64 bit Maple 14 Student Edition (single user) under 64 bit Windows 7.


There are two pieces of extended functionality that I quite often want from the Maple Compiler. The first (task A) is to be able to link in and use an arbitrary function from some other external ("3rd party") shared library, within my Compile'd Maple procedure. The second (task B) is to directly call the compiled Maple procedure from within some computational routine in a 3rd party shared library (which I would then access using define_external). This post is about the first of those, task A.

Page 1 of 1