SMath Studio Forum
»
SMath Studio
»
Questions
»
slow extraction of matrix elements
Rank: Member Groups: Registered
Joined: 12/03/2019(UTC) Posts: 19 Was thanked: 1 time(s) in 1 post(s)
|
Hallo, Thanks to PTC's weird policy, I'm now trying to switch completely to Smath and have started rebuilding my main sheets. Now I'm running into a problem here that I can't solve: I build a matrix in half a second, but I can't display it. Even displaying a single element doesn't finish unless I shrink the matrix w. The optimization of all equations is set to "numerical", the matrix elements should then be ready calculated, right? Does anyone know such a behavior? The complete sm file and the data for it will come tomorrow. Best regards, Johannes Extract Matrix element.png (1,023kb) downloaded 40 time(s).Edited by user 14 September 2021 14:45:51(UTC)
| Reason: Not specified
|
|
|
|
Rank: Member Groups: Registered
Joined: 12/03/2019(UTC) Posts: 19 Was thanked: 1 time(s) in 1 post(s)
|
Putting eval() around the matrix definition solved this.
But what is then the setting "numerical" good for?
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: Jopi But what is then the setting "numerical" good for? You are in the learning curve of Smath. It toke me ~ 6 years to convert most of my MCD 11. Wait to glance your promised document ... Jean
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 10/12/2009(UTC) Posts: 246 Location: Cali, Colombia Was thanked: 85 time(s) in 65 post(s)
|
Originally Posted by: Jopi Hallo, Thanks to PTC's weird policy, I'm now trying to switch completely to Smath and have started rebuilding my main sheets. Now I'm running into a problem here that I can't solve: I build a matrix in half a second, but I can't display it. Even displaying a single element doesn't finish unless I shrink the matrix w. The optimization of all equations is set to "numerical", the matrix elements should then be ready calculated, right? Does anyone know such a behavior? The complete sm file and the data for it will come tomorrow. Best regards, Johannes Extract Matrix element.png (1,023kb) downloaded 40 time(s). Please, can you share your .sm file? Oscar
|
|
|
|
Rank: Member Groups: Registered
Joined: 12/03/2019(UTC) Posts: 19 Was thanked: 1 time(s) in 1 post(s)
|
Here is the file. I have inserted a random source matrix, that needs a longer calculation time than my original. But the effect is the same. Extract matrix element.sm (11kb) downloaded 19 time(s).
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 23/07/2013(UTC) Posts: 1,126 Was thanked: 507 time(s) in 338 post(s)
|
Originally Posted by: Jopi Here is the file. I have inserted a random source matrix, that needs a longer calculation time than my original. But the effect is the same.
This product evaluation may seem small on paper. But actually it is a huge calculation. And it gets bigger if t.max/i.max gets higher. It takes 26s on my pc and my CPU is i7 6700k. Not one of the fastest but not a slow one either. Obviously you have to wait until that product is finished. After that you can display elements of matrix w individually, and in an instant. SMath is smart, it won't recalculate if you try to display an element of matrix after it is finished. It will take microseconds to show the elements of matrix. Unless you don't change something before "the long process calculation" of course. Regards
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
The classical Iterated Product.
|
|
|
|
Rank: Member Groups: Registered
Joined: 12/03/2019(UTC) Posts: 19 Was thanked: 1 time(s) in 1 post(s)
|
Thank you for your answers.
My concern was NOT that the evaluation of Matrix := complicated definition took a long time, it was about the extraction of a single element, Matrix[x,y]= As i noted above, with a different definition: Matrix := eval(complicated definition) the following Matrix[x,y]= performed as expected in milliseconds.
I did not expect that a calculation, that is set to "numerical optimization", needs this additional eval() to calculate to the numerical end.
My original matrix is times bigger, but includes a lot of zeros. It now performs in a second.
Thank you , Johannes
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 23/07/2013(UTC) Posts: 1,126 Was thanked: 507 time(s) in 338 post(s)
|
Originally Posted by: Jopi I did not expect that a calculation, that is set to "numerical optimization", needs this additional eval() to calculate to the numerical end.
Because that is what eval() "may" does, usually. Simplify expression, reduce calculation time. I didn't get what you mentioned earlier, sorry. I thought you were complaining about you couldn't display elements, unless you shrink the matrix w. Regards
|
1 user thanked overlord for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 10/12/2009(UTC) Posts: 246 Location: Cali, Colombia Was thanked: 85 time(s) in 65 post(s)
|
Originally Posted by: Jopi Here is the file. I have inserted a random source matrix, that needs a longer calculation time than my original. But the effect is the same. Extract matrix element.sm (11kb) downloaded 19 time(s). If you define your matrix as a function, you have an alternative and faster "extraction of a matrix element":
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
|
|
|
|
SMath Studio Forum
»
SMath Studio
»
Questions
»
slow extraction of matrix elements
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.