Skip to main content
12-Amethyst
February 6, 2024
Solved

Calculation speed - 216619x8 result data

  • February 6, 2024
  • 2 replies
  • 3435 views

Hi,

 

I have a MCP sheet that pulls from some matrices to perform basic calculations that takes over an hour to complete. I would like to improve this significantly if possible. I tried to rely on built-in functions (e.g., "lookup") when possible for calculation efficiency.

 

The main calculation (image below) uses data from three matrices (36177x9, 2412x9, 1206x12) to perform basic +-x/ calculations resulting in a 216619x8 matrix. At the end of the sheet, there is some red text that helps point this out. File attached.

 

If anyone has tips for how to improve calculation speed or is able to help me optimize this process, I would much appreciate it!

 

Thanks!

Andrew
Mathcad Prime v9
NO multithreading

11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz 2.61 GHz

24.0 GB

64-bit

 

Andy_C_0-1707203021647.png

Best answer by Werner_E

Sorry, had a quick look at the sheet but did not find the time to study in more detail what the nested loops actually are doing to see if it could be achieved with less effort.

EDIT:

Got rid of the "matrix" function calls (and also of stack3 and stack5). Speed gain is about 50% or more (depends on the size of the input matrix LL)

See the speed comparison here for one call with the full matrix LL.Des:

Werner_E_1-1707438182451.png

Have not tested the new RATING2 function in the section you disabled which you say took more than one hour, but I guess it should help at least a little bit to cut down calculation time.

 

Prime 9 file attached

2 replies

23-Emerald IV
February 7, 2024

Would it help if you take the embedded Excel sheets out of the Prime worksheet into external Excel files, and just read the required data in from those external files?

 

Success!
Luc

Andy_C12-AmethystAuthor
12-Amethyst
February 7, 2024

Hi, @LucMeekes 

That is how I have my actual MCP sheet setup, so, no that doesn't help all that much. All of the Excel components in the file I uploaded are READ into my working sheet. I embedded the data to simplify the file I was attaching.

Thanks anyway!
Andrew

Andy_C12-AmethystAuthor
12-Amethyst
February 8, 2024

Hi @Werner_E , I am curious if you see anything off or inefficient in the above calculation method?

Werner_E25-Diamond IAnswer
25-Diamond I
February 8, 2024

Sorry, had a quick look at the sheet but did not find the time to study in more detail what the nested loops actually are doing to see if it could be achieved with less effort.

EDIT:

Got rid of the "matrix" function calls (and also of stack3 and stack5). Speed gain is about 50% or more (depends on the size of the input matrix LL)

See the speed comparison here for one call with the full matrix LL.Des:

Werner_E_1-1707438182451.png

Have not tested the new RATING2 function in the section you disabled which you say took more than one hour, but I guess it should help at least a little bit to cut down calculation time.

 

Prime 9 file attached

Andy_C12-AmethystAuthor
12-Amethyst
February 9, 2024

No worries @Werner_E , thank you for chiming in!