Items tagged with performance performance Tagged Items Feed

Hi,
I am solving large systems of linear equations (mod 2) which are of this form ,
systems:= {0 = f[[1, 4]]-f[[1, 3]], 0 = f[[1, 5]]-f[[1, 3]], 0 = f[[1, 5]]-f[[1, 4]], 0 = f[[1, 6]]-f[[1, 3]], 0 = f[[1, 6]]-f[[1, 4]], 0 = f[[1, 6]]-f[[1, 5]], 0 = f[[1, 7]]-f[[1, 3]], 0 = f[[1, 7]]-f[[1, 4]], 0 = f[[1, 7]]-f[[1, 5]], 0 = f[[1, 7]]-f[[1, 6]], 0 = f[[2, 4]]-f[[1, 3]], 0 = f[[2, 5]]-f[[1, 3]], 0 = f[[2, 5]]-f[[1, 4]], 0 = f[[2, 6]]-f[[1, 3]], 0 = f[[2, 6]]-f[[1, 4]], 0 = f[[2, 6]]-f[[1, 5]], 0 = f[[2, 6]]-f[[2, 4]], 0 = f[[2, 6]]-f[[2, 5]], 0 = f[[2, 7]]-f[[1, 3]], 0 = f[[2, 7]]-f[[1, 4]], 0 = f[[2, 7]]-f[[1, 5]], 0 = f[[2, 7]]-f[[1, 6]], 0 = f[[2, 7]]-f[[2, 4]], 0 = f[[2, 7]]-f[[2, 5]], 0 = f[[3, 1]]-f[[1, 4]], 0 = f[[3, 1]]-f[[1, 5]], 0 = f[[3, 1]]-f[[1, 6]], 0 = f[[3, 1]]-f[[2, 7]], 0 = f[[3, 5]]-f[[1, 4]], 0 = f[[3, 5]]-f[[1, 5]], 0 = f[[3, 5]]-f[[2, 4]], 0 = f[[3, 5]]-f[[2, 5]], 0 = f[[3, 6]]-f[[1, 3]], 0 = f[[3, 6]]-f[[1, 4]], 0 = f[[3, 6]]-f[[1, 5]], 0 = f[[3, 6]]-f[[1, 6]], 0 = f[[3, 6]]-f[[2, 4]], 0 = f[[3, 6]]-f[[2, 5]], 0 = f[[3, 6]]-f[[2, 6]], 0 = f[[3, 7]]-f[[1, 4]], 0 = f[[3, 7]]-f[[1, 5]], 0 = f[[3, 7]]-f[[1, 6]], 0 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f[[7, 2]]-f[[4, 7]], 1 = f[[7, 3]]-f[[5, 7]], 1 = f[[7, 4]]-f[[5, 7]]};


I have been using msolve as follows; msolve(systems,2);  which returns NULL if there is no solution. This however takes a lot of my computer memory and also take a lot of time since the equations are very many.  I decided to try LinearSolve, but it doesn't give me any solutions even for the ones that I know that the solutions exist. My code was writen as follows:

systems:=as above..

vars := [f[[1, 3]], f[[1, 4]], f[[1, 5]], f[[1, 6]], f[[1, 7]], f[[2, 4]], f[[2, 5]], f[[2, 6]], f[[2, 7]], f[[3, 1]], f[[3, 5]], f[[3, 6]], f[[3, 7]], f[[4, 1]], f[[4, 2]], f[[4, 6]], f[[4, 7]], f[[5, 1]], f[[5, 2]], f[[5, 3]], f[[5, 7]], f[[6, 1]], f[[6, 2]], f[[6, 3]], f[[6, 4]], f[[7, 1]], f[[7, 2]], f[[7, 3]], f[[7, 4]]];

A,b:=GenerateMatrix(systems,var):
LinearSolve(A,b) mod 2;
what I'm I doing wrong? How can I make this fast and in such a way that the solution is computed without taking too much memory?

I also understand that LinearSolve returns the following when there is no solution, "Error, (in LinearAlgebra:-LinearSolve) inconsistent system
", in my case, if there is no solution, I don't want that error to be printed, but I want some variable (call it x) to be printed if a solution is found.

Any help is appreciated.

Vic.

Hi,

I would like to thank everyone who takes their time to respond to posts on this page. I have another question.

I have about 11 trillion lists that are of the form A shown below. The lists ofcourse have more elements than A (about 50 elements). What I want is to compute this value I call f, and the moment this value is found to be 1, we stop, and if all the values of f are 0, then we print(A). Here is my code, which has a problem and doesn't give me the result I want. How do I modify this so that if any value of f=1, then we stop, elif no 1 is found, we print just one value for A and not for every 0 produced?

with(ListTools);
A := [[1, 2], [1, 7], [5, 6], [1, 6], [1, 9], [6, 5], [9, 1], [2, 1], [7, 1], [6, 1], [5, 6]]; n := 9;
for i to n do for j to n do for k to nops(A) do if [i, j] = A[k] then a := Search([i, j], A); b := Search([j, i], A); if a < b then f := `mod`(b-a, 2); if f = 1 then break else print(A) end if end if end if end do end do end do;

Presently what I am doing is to Append all values of f into an Array and check that 1 is not an element of that Array. This is however very inconvenient since my lists are huge, and they are many, and we do not have to cpompute all the values of f once we come across a 1. Other than this, is there a way I can make my program run faster? Any suggestions are welcomed.

Thanks,

VIC.

 Hi everybody,

Until recently I was using Maple 2015.0 on this PC :

Windows XP
2 dual core proc Intel(R) Xeon(R) CPU E3-1225 V2 ; 3.19 GHz
64 bytes,
16 Go RAM

For two days now I am using Maple 2015.0 on this one

Windows 7
4 dual core proc Intel(R) Xeon(R) CPU 5-2637 V3 ; 3.50 GHz
64 bytes,
64 Go RAM


Comparisons of the running times for exactly the same code, consisting in 10000 independent Monte Carlo  simulations distributed over all the nodes (resp 4 and 8) give :

Windows XP :  504 sec  (with a variation of the order of  +/- 3s for different replicates)

Windows 7   :  343 sec  (with a variation of the order of  +/- 3s for different replicates)


The expected running time should be 504 * (3.2/3.5) * (4/8) = 230 s
(or 504 * (4/8) = 252 s if you neglect the acceleration due to the clock rate)
The realized running time (343 s) is thus at least  40% larger than the expected one.


Does anybody has already observed this kind of performance loss during XP -> 7 migration ?
Are there some comparisons of cpu times between Windows XP and 7 ?


Thank you all for sharing your own experience.



postscript : a NOTIONALexample of how the computations are distributed is given below

NbOfRuns := 10000:

# Data is a Matix(NbOfRuns, NbOfCols, …) constructed elsewhere

NbOfNodes := Grid:-NumNodes():
NbOfRunsPerNode := NbOfRuns / NbOfNodes:
for k from 0 to NbOfNodes do
   FirstData := 1 + k * NbOfRunsPerNode:
   LastData := (k+1) * NbOfRunsPerNode:
   Grid:-Run(k+1, MyCode, [Data[FirstData..LastData, ..], …])
end do:

Dear friends

It seems that Maple takes a long time to evaluate the square roots of numbers.

See the simple code below.

st := time();

for i to 1000 do for j to 1000 do

a[i, j] := evalf(abs(i-j+1)^0.3-abs(i-j)^0.3):

end: end:

time()-st

I run it, then after a few seconds I run it again and again  to see the consuming time: once the running time is 77 seconds, then is 57 seconds, again is 73 seconds ...

Two questions:

1- Why the time is so differnt?

2- Why a simple code is being done at about a minute? Based on the number of operations, I think it should be done at less than a second. It just involves finding two million real third roots each of them less than 100 operations (if Newton method for finding roots is applied it probably needs less than 20 operations). I was thinking that a computer may do one billion operations per second. 

Since I need to report my numerical results in a scientific paper, it is important for me to know what's going on.

It is worthy of noting that I use Maple 18 on a Lenovo Laptop with Corei3 1.90 GHz with 64 bit operating system and 4 Gb RAM.

In advance, I appreciate for helping me to reveal the secrets.

Thank you all

 

I thought I would share some code for computing sparse matrix products in Maple.  For floating point matrices this is done quickly, but for algebraic datatypes there is a performance problem with the builtin routines, as noted in http://www.mapleprimes.com/questions/205739-How-Do-I-Improve-The-Performance-Of

Download spm.txt

The code is fairly straightforward in that it uses op(1,A) to extract the dimensions and op(2,A) to extract the non-zero elements of a Matrix or Vector, and then loops over those elements.  I included a sparse map function for cases where you want to map a function (like expand) over non-zero elements only.

# sparse matrix vector product
spmv := proc(A::Matrix,V::Vector)
local m,n,Ae,Ve,Vi,R,e;
n, m := op(1,A);
if op(1,V) <> m then error "incompatible dimensions"; end if;
Ae := op(2,A);
Ve := op(2,V);
Vi := map2(op,1,Ve);
R := Vector(n, storage=sparse);
for e in Ae do
n, m := op(1,e);
if member(m, Vi) then R[n] := R[n] + A[n,m]*V[m]; end if;
end do;
return R;
end proc:
# sparse matrix product
spmm := proc(A::Matrix, B::Matrix)
local m,n,Ae,Be,Bi,R,l,e,i;
n, m := op(1,A);
i, l := op(1,B);
if i <> m then error "incompatible dimensions"; end if;
Ae := op(2,A);
Be := op(2,B);
R := Matrix(n,l,storage=sparse);
for i from 1 to l do
Bi, Be := selectremove(type, Be, (anything,i)=anything);
Bi := map2(op,[1,1],Bi);
for e in Ae do
n, m := op(1,e);
if member(m, Bi) then R[n,i] := R[n,i] + A[n,m]*B[m,i]; end if;
end do;
end do;
return R;
end proc:
# sparse map
smap := proc(f, A::{Matrix,Vector})
local B, Ae, e;
if A::Vector then
B := Vector(op(1,A),storage=sparse):
else
B := Matrix(op(1,A),storage=sparse):
end if;
Ae := op(2,A);
for e in Ae do
B[op(1,e)] := f(op(2,e),args[3..nargs]);
end do;
return B;
end proc:


As for how it performs, here is a demo inspired by the original post.

n := 674;
k := 6;
A := Matrix(n,n,storage=sparse):
for i to n do
  for j to k do
    A[i,irem(rand(),n)+1] := randpoly(x):
  end do:
end do:
V := Vector(n):
for i to k do
  V[irem(rand(),n)+1] := randpoly(x):
end do:
C := CodeTools:-Usage( spmv(A,V) ):  # 7ms, 25x faster
CodeTools:-Usage( A.V ):  # 174 ms
B := Matrix(n,n,storage=sparse):
for i to n do
  for j to k do
    B[i,irem(rand(),n)+1] := randpoly(x):
  end do:
end do:
C := CodeTools:-Usage( spmm(A,B) ):  # 2.74 sec, 50x faster
CodeTools:-Usage( A.B ):  # 2.44 min
# expand and collect like terms
C := CodeTools:-Usage( smap(expand, C) ):

Leading on from this post I made before:

http://www.mapleprimes.com/questions/210359-Integrating-Very-Large-Sums

I have a script that can now integrate larger sums thanks to the tips I was given. I now have a question regarding cpu usage when the calculation is run through a loop. I have attached two files. One contains the sum (large_sum.txt) which is then read in to the main Maple script (large_sum_int.mw).

When the loop is run, the first few points are calculated quite consistently with very similar cpu times. However, as the calculation progresses the cpu time suddenly increases (with larger sums than the one given it is a very severe increase) it then decreases again and returns to the time it took for the initial points to be calculated.

Is there a reason there is a sticking point in this calculation? is there a more efficient way to simplify it before it reaches the integration stage? When using simplify(...,size) the initial block takes a very long time to execute hence is not included here. This is not the largest sum that needs to be processed so I am looking for means to speed up calculation time/make it more consistent.

Any help is appreciated

large_sum.txt

large_sum_int.mw

-Yeti

Hi, Im now trying to run my code. But it took like years to even getting the results. may I know any solutions on how to get faster results? Because I have run this code for almost 4 hours yet there is still 'Evaluating...' at the corner left. And when I tried to stop the program, it will stop at 'R1...'.

 

Digits := 18;
with(plots):n:=1.4: mu(eta):=(diff(U(eta),eta)^(2)+diff(V(eta),eta)^(2))^((n-1)/(2)):
Eqn1 := 2*U(eta)+(1-n)*eta*(diff(U(eta), eta))/(n+1)+diff(W(eta), eta) = 0;
Eqn2 := U(eta)^2-(V(eta)+1)^2+(W(eta)+(1-n)*eta*U(eta)/(n+1))*(diff(U(eta), eta))-mu(eta)*(diff(U(eta), eta, eta))-(diff(U(eta), eta))*(diff(mu(eta), eta)) = 0;
Eqn3 := 2*U(eta)*(V(eta)+1)+(W(eta)+(1-n)*eta*U(eta)/(n+1))*(diff(V(eta), eta))-mu(eta)*(diff(V(eta), eta, eta))-(diff(V(eta), eta))*(diff(mu(eta), eta)) = 0;
bcs1 := U(0) = 0, V(0) = 0, W(0) = 0;
bcs2 := U(4) = 0, V(4) = -1;
R1 := dsolve({Eqn1, Eqn2, Eqn3, bcs1, bcs2}, {U(eta), V(eta), W(eta)}, initmesh = 30000, output = listprocedure, numeric);
Warning, computation interrupted
for l from 0 by 2 to 4 do R1(l) end do;
plot1 := odeplot(R1, [eta, U(eta)], 0 .. 4, numpoints = 2000, color = red);

 

Thankyou in advance :)

There are dozens of indefinite integral expressions in my worksheet. Everytime I execute the entire worksheet, the cursor always rests beside one indefinite integral expreesion and Maple stays in "Evaluating...". Even 30 minutes passed, the result of the integral couldn't come out. What bothers me is that the cursor would rest beside different indefinite integral expressions. For example, I write 4 indefinite integral expressions A, B, C and D one by one. First time, the results of A, B and C come out and the cursor rests beside D with "Evaluating...". Next time, the results of A and B come out and the cursor rests beside C with "Evaluating...".

Before the indefinite integral expressions, I wrote dozens of lines of codes aiming at assigning values to variables. As I typed more and more indefinite integral expressions into the worksheet, even evaluating the codes aiming at assigning values would spend more and more time.

Does Maple evaluate the codes line by line from the top to the end of a worksheet? If it is true, why evaluating the codes before the indefinite integral expressions becomes slowly?

How to evaluate the entire worksheet without stuck in one indefinite integral expression?

Hello,

I was wondering why there is difference in computer speed between two almost the same calculations.

Example:

61! + 1 costs 271 sec and 59! + 1 almost 0? Why is that? When there are small prime factors, the

calculation goes often faster, why? hanks in advance!

Hi

When I run a maple file it uses 25% of CPU.

When I run 2 files, the half of CPU is used.

How can I change the preferences for using most of CPU

Hi all,

I have been trying to plot Riemann Zeta Function on certain range, but it takes a lot of time(several minutes ,maybe hours).These are the basic things.

How to speed up ploting Zeta?

The same problem with Optimization.

Zeta-Problems.mw

Mathematica don't have this such problems.

Mathematica ploting Zeta with 0.125 second and optimizing 3.42 second.Maple few hours maybe......

 

 

 

I am trying to use Maple 18 to do some computations with matrices over a ring of polynomials in one variable over the integers $\mathbb{Z}[x]$, or the corresponding field of fractions $\mathbb{Q}(x)$.

 

The matrices in question are of dimension approximately 5000 and are sparse. The algorithm requires at least as many matrix multiplications as the dimension of the space.

Doing some small examples, of dimension 674, with a laptop (i7-3520 M CPU @2.9GHz with 8GB of Ram) gave the following disappointing result:

time(LinearAlgebra[MatrixMatrixMultiply](A,A);

34.694

 

When a colleague with access to a Mathematica license performed an identical calculation using sparse matrices in Mathematica, we found that Mathematica performed the calcuation in fractions of a second.

 

In small dimensional examples, constructing the matrices over the field of fractions as sparse in Maple 18 resulted in a four fold decrease in the already disappointing performance of the LinearAlgebra package in Maple 18.

 

Is there any way to improve the computational performance of Maple 18 for symbolic linear algebra? Alternatively, is the performance of Maple 2015 for symbolic linear algebra noticably better than Maple 18?

 

Thanks in advance.


Dave

 

 

My 5 year old laptop executes some commands very slowly e.g. plottools(rotate) around a line which is not a Cartesian axis. I intend to buy a new desktop. Which off-the-shelf desktops provide the fastest processing of Maple commands which do not include large data sets? Which provide the best price/performance?

Hi everyone,

Consider the following worksheet (Maple 13):

Euler.mw

 (or as a Google Drive link)

https://drive.google.com/file/d/0Bzr3EyK8arkOUkZPcEE5b0NySVU/view?usp=sharing

Choose execute entire worksheet on both Maple 13 and Maple 18.

Maple 13 is blindingly fast at 40 seconds, entire wroksheet upon completion

Maple 18 crawls and hangs forever.

 

Can anyone recognise what the problem with Maple 18 is?

Running on a two core 1.7GHz AMD Athlon.

 

Many thanks

--

Yiannis

I have an indexed equation that contains serval definite integrals in it. I want maple to evaluate the equation for different indices. But when I set the parameter "N=100" in the code, it takes maple lots of time for the evaluation. I am looking for some tricks to make the code numerically more efficient. I will be so thankful for any opinion and help.
you can find my code below. The code is so simple and just contains few lines. I will appreciate any help.

Numerical_Performance.mw

Thanks in advance.

1 2 3 4 5 Page 1 of 5