Performance - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : System : Information : Updates : Maple 2018 : updates/Maple2018/Performance

Performance

Maple 2018 improves the performance of many routines.

 

Gröbner Bases

Kernel Improvements

Logic

Graph Theory

Sparse Linear Equations mod p

Matrix Inverse with Trig Functions

timelimit

Gröbner Bases

Gröbner bases lie at the heart of many fundamental operations, including solving systems of equations and integration, so performance improvements in Gröbner bases results in faster calculations in other areas as well. Maple 2018 includes new optimizations to the F4 algorithm to increase parallel speedup when computing large total degree Gröbner bases.  On a quad core Core i7 with hyperthreading, the new implementation runs 33 percent faster and parallel speedup increases from 1.94x to 2.84x.

cyclic9x0+x1+x2+x3+x4+x5+x6+x7+x8,x0x1+x0x8+x1x2+x2x3+x3x4+x4x5+x5x6+x6x7+x7x8,x0x1x2+x0x1x8+x0x7x8+x1x2x3+x2x3x4+x3x4x5+x4x5x6+x5x6x7+x6x7x8,x0x1x2x3+x0x1x2x8+x0x1x7x8+x0x6x7x8+x1x2x3x4+x2x3x4x5+x3x4x5x6+x4x5x6x7+x5x6x7x8,x0x1x2x3x4+x0x1x2x3x8+x0x1x2x7x8+x0x1x6x7x8+x0x5x6x7x8+x1x2x3x4x5+x2x3x4x5x6+x3x4x5x6x7+x4x5x6x7x8,x0x1x2x3x4x5+x0x1x2x3x4x8+x0x1x2x3x7x8+x0x1x2x6x7x8+x0x1x5x6x7x8+x0x4x5x6x7x8+x1x2x3x4x5x6+x2x3x4x5x6x7+x3x4x5x6x7x8,x0x1x2x3x4x5x6+x0x1x2x3x4x5x8+x0x1x2x3x4x7x8+x0x1x2x3x6x7x8+x0x1x2x5x6x7x8+x0x1x4x5x6x7x8+x0x3x4x5x6x7x8+x1x2x3x4x5x6x7+x2x3x4x5x6x7x8,x0x1x2x3x4x5x6x7+x0x1x2x3x4x5x6x8+x0x1x2x3x4x5x7x8+x0x1x2x3x4x6x7x8+x0x1x2x3x5x6x7x8+x0x1x2x4x5x6x7x8+x0x1x3x4x5x6x7x8+x0x2x3x4x5x6x7x8+x1x2x3x4x5x6x7x8,x0x1x2x3x4x5x6x7x81:

GCodeTools:-UsageGroebner:-Basiscyclic9,tdegx0,x1,x2,x3,x4,x5,x6,x7,x8,characteristic=2311:

memory used=24.08MiB, alloc change=18.98MiB, cpu time=2.73m, real time=25.73s, gc time=0ns


Maple 2018 also includes a new implementation of the FGLM algorithm for converting total degree Gröbner bases to lexicographical order, with improved performance and lower memory requirements.  On this example, the FGLM algorithm runs about 3.5x faster.

katsura122x0x11+2x1x10+2x1x12+2x2x9+2x3x8+2x4x7+2x5x6x11,2x0x10+2x1x11+2x1x9+2x12x2+2x2x8+2x3x7+2x4x6+x52x10,2x0x9+2x1x10+2x1x8+2x11x2+2x12x3+2x2x7+2x3x6+2x4x5x9,2x0x8+2x1x7+2x1x9+2x10x2+2x11x3+2x12x4+2x2x6+2x3x5+x42x8,2x0x7+2x1x6+2x1x8+2x10x3+2x11x4+2x12x5+2x2x5+2x2x9+2x3x4x7,2x0x6+2x1x5+2x1x7+2x10x4+2x11x5+2x12x6+2x2x4+2x2x8+x32+2x3x9x6,2x0x5+2x1x4+2x1x6+2x10x5+2x11x6+2x12x7+2x2x3+2x2x7+2x3x8+2x4x9x5,2x0x4+2x1x3+2x1x5+2x10x6+2x11x7+2x12x8+x22+2x2x6+2x3x7+2x4x8+2x5x9x4,2x0x3+2x1x2+2x1x4+2x10x7+2x11x8+2x12x9+2x2x5+2x3x6+2x4x7+2x5x8+2x6x9x3,2x0x2+x12+2x1x3+2x10x12+2x10x8+2x11x9+2x2x4+2x3x5+2x4x6+2x5x7+2x6x8+2x7x9x2,2x0x1+2x1x2+2x10x11+2x10x9+2x11x12+2x2x3+2x3x4+2x4x5+2x5x6+2x6x7+2x7x8+2x8x9x1,x02+2x12+2x102+2x112+2x122+2x22+2x32+2x42+2x52+2x62+2x72+2x82+2x92x0,2x12+2x1+2x11+x0+2x10+2x9+2x2+2x8+2x3+2x7+2x4+2x6+2x51:

memory used=186.80MiB, alloc change=256.00MiB, cpu time=82.03s, real time=26.78s, gc time=93.75ms

Kernel Improvements

Fast code has been added to the subs command for the case of replacing variables in polynomials with products.  The following types of substitutions run significantly faster on large polynomials.

f  x8y4 + x4y4 + x2y2+1; subsx=yz, y=2z2,f; subsx=sqrtx, f; subsy=1x, f;

x4+3

(2.1)

Kernel code has been added to speed up tests for polynomials and rational functions using Maple library types.  The examples below run about 6x faster.

 f  randpolyx,y,z,t,u,v,w,sqrt2,sqrt3,degree=10,terms=10000:CodeTools:-Usagetypef, polynomalgfun, x,y,z,t,u,v,w;CodeTools:-Usagetypef,ratpolyalgfun,x,y,z,t,u,v,w;

true

(2.2)

Logic

The SAT solver used by the Satisfy and Satisfiable commands is now MapleSAT, a SAT solver based on MiniSat but with improvements to the variable branching heuristic.  The following example runs about 4x faster in Maple 2018 than Maple 2017.  It encodes an instance of the pigeonhole principle, the fact that n pigeons cannot fit in n1 holes if each hole can contain at most one pigeon.

n  11:# Every pigeon is in a holePositiveClauses  seqLogic:-`&or`seqxi, j, j = 1 .. n1, i = 1 .. n:# No hole contains two pigeonsNegativeClauses  seqseqseqLogic:-`&or`Logic:-`&not`xi, j, Logic:-`&not`xk, j, i = k+1 .. n, k = 1 .. n, j = 1 .. n1:PHP  Logic:-`&and`PositiveClauses, NegativeClauses:nopsPHP;

561

(3.1)

CodeTools:-UsageLogic:-SatisfiablePHP

false

(3.2)

Graph Theory

The ChromaticNumber command which computes the chromatic number of a graph now uses a hybrid algorithm by default.  This algorithm runs two separate implementations in parallel and returns the result of whichever method finishes first.  Consequently, some examples which could not be solved in Maple 2017 in a reasonable amount of time can be quickly solved in Maple 2018.  In the following example Maple 2017 is unable to determine the chromatic number after an hour of CPU time while Maple 2018 does so in seconds.  The example is a random graph which appears in the paper "Optimization by Simulated Annealing: An Experimental Evaluation; Part II, Graph Coloring and Number Partitioning" by D. Johnson, C. Aragon, L. McGeoch, and C. Schevon.

GImportexample/DSJC125.1.s6, base=datadir

GGraph 1: an undirected unweighted graph with 125 vertices and 736 edge(s)

(4.1)

CodeTools:-UsageGraphTheory:-ChromaticNumberG

memory used=266.60KiB, alloc change=10.94MiB, cpu time=48.00ms, real time=1.14s, gc time=0ns

5

(4.2)

Sparse Linear Equations mod p

The msolve command has been updated with a new solver for sparse linear equations for primes up to 2311.  It pivots for structure and sparsity and quickly detects redundant equations in overdetermined systems.  The example below runs over 100x faster.

memory used=1.03MiB, alloc change=0 bytes, cpu time=125.00ms, real time=19.00ms, gc time=0ns

 

Matrix Inverse with Trig Functions

The inverse of a matrix with trigonometric functions is faster.

x 1 + sina + cosb: AMatrix11x+a11,12x+a12,13x+a13,14x+a14,21x+a21,22x+a22,23x+a23,24x+a24,31x+a31,32x+a32,33x+a33,34x+a34,41x+a41,42x+a42,43x+a43,44x+a44:timeLinearAlgebra:-MatrixInverseA;

0.078

(6.1)

timelimit

The timelimit command is useful for putting a time bound on a computation, preventing it from running longer than you expect. The timelimit command now has virtually no overhead.

f := proc(x)
    description "Number of Primes less than x";
    global i,j;
    i:=0:
    for j to x do
        if isprime(j) then
            i := i + 1;
        end if;
    end do:
    return i;
end proc:

timelimit(0.5,f(1000000));

Error, (in isprime) time expired

printf("The number of primes less than %a is %a. This was computed in %.2f s.", j, i, 0.5);

The number of primes less than 150743 is 13909. This was computed in 0.50 s.