Message Boards Message Boards

0
|
3357 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

[?] Speed up Sum while implementing the Jacobi method for linear systems?

Hi, I've come across a strange performance issue while implementing the Jacobi method. In the attachment, the last parameter in the "Jacobi" function, just controls how a certain sum is computed: using the Mathematica Sum (WithSum==1) or by standard partial sums. In my understanding, this should be equivalent, however I see a whole different story... For very small dimensions, say n <= 200, using Sum gives slightly smaller computational times. However, from a certain point on ( in my case n = 250), Sum suddenly starts taking forever... For n=250 using sum takes almost 40 times more then not using Sum!

How can this be??

Attachments:
POSTED BY: João Janela
2 Replies

Hi David, thank you for your reply. I am now warned about Sum!

POSTED BY: João Janela

Sum is really a symbolic function and can change methods based o e.g. length of summation. Much faster would be to use instead sum = A[[i]].aux; in that loop. There are other speed improvements one might make but this should be by far the most substantial.

POSTED BY: Daniel Lichtblau
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract