Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline ndtma  
#1 Posted : 29 April 2015 09:31:38(UTC)
ndtma


Rank: Advanced Member

Groups: Registered
Joined: 05/06/2014(UTC)
Posts: 348
Man
Sri Lanka
Location: Colombo

Was thanked: 127 time(s) in 82 post(s)
Dear All,
I am a civil engineer, specialized in water resources engineering.
My aim is to analyze 30 years of daily stream flow data in an Excel table with about 300 rows x 31 columns.
The data table contains negative values and strings which I have to discard first.
Then I want to create a column vector of data for further analysis.
The Smath program shown below gives the result, but takes a long time (about 50 seconds- see image).
As I build up the program for further analysis, the time grows up to even 5 minutes or more.
However, my Mathcad 15 program yields the result almost immediately.

Can anyone help to resolve this please? Thanks in advance.
ndtma

Image1

Edited by user 29 April 2015 09:56:51(UTC)  | Reason: To attach Excel file

File Attachment(s):
DailyQ_Malwala.xls (122kb) downloaded 18 time(s).
ndtma attached the following image(s):
Slide1.JPG
Look within!... The secret is inside you.
Best Regards
Eng. NDTM Amarasekera - Sri Lanka

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Davide Carpi  
#2 Posted : 29 April 2015 11:21:12(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,654
Man
Italy
Location: Italy

Was thanked: 1340 time(s) in 879 post(s)
Hello ndtma Good

I attach my proposal (approx. 25s on my notebook). The first part takes advantage from how are built matrices in SMath. The slower part is the 2nd (as for now I don't have ideas on how to improve this part).

[edit] please note that the first part is not strictly required, anyway seems to me (?) that there's a small speed improvement using a vector instead of the linear indexing on the matrix

Edited by user 29 April 2015 11:43:31(UTC)  | Reason: Not specified

File Attachment(s):
Davide Carpi attached the following image(s):
2015-04-29 10_12_10-SMath Studio Desktop - [Kalu Ganga-Malwala Operation Study-Simple-R1.sm_].png
2015-04-29 10_41_14-SMath Studio Desktop - [Kalu Ganga-Malwala Operation Study-Simple-R1 (2).sm_].png
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
thanks 1 user thanked Davide Carpi for this useful post.
on 29/04/2015(UTC)
Offline ndtma  
#3 Posted : 29 April 2015 12:14:44(UTC)
ndtma


Rank: Advanced Member

Groups: Registered
Joined: 05/06/2014(UTC)
Posts: 348
Man
Sri Lanka
Location: Colombo

Was thanked: 127 time(s) in 82 post(s)
Hello Davide

Thanks for your valuable proposal, and I am awaiting more improvements.

Best Regards
ndtma
Look within!... The secret is inside you.
Best Regards
Eng. NDTM Amarasekera - Sri Lanka
Offline Davide Carpi  
#4 Posted : 29 April 2015 16:19:25(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,654
Man
Italy
Location: Italy

Was thanked: 1340 time(s) in 879 post(s)
12s average (not immediate, however faster than the previous solution)
File Attachment(s):
Davide Carpi attached the following image(s):
2015-04-29 15_21_13-SMath Studio Desktop - [Kalu Ganga-Malwala Operation Study-Simple-R1 (1).sm].png
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline ndtma  
#5 Posted : 30 April 2015 04:37:03(UTC)
ndtma


Rank: Advanced Member

Groups: Registered
Joined: 05/06/2014(UTC)
Posts: 348
Man
Sri Lanka
Location: Colombo

Was thanked: 127 time(s) in 82 post(s)
Hello Davide

Thanks for the second improvement.

Best Regards
ndtma
Look within!... The secret is inside you.
Best Regards
Eng. NDTM Amarasekera - Sri Lanka
Offline Alex M.  
#6 Posted : 03 May 2015 05:17:07(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 post(s)
I was faced with a similar problem of a slow function (in fact EXCEL interop call). I could not speed up the function so I have created if() loops that will run the function only when input has changed. This makes sure that when workbook automatically recalculates it will not get "stuck" on a slow function unless necessary.

A sample is attached. In the workbook c:a+b is an example function, while a+b is input.

Hope that helps
File Attachment(s):
input_CHK.sm (6kb) downloaded 24 time(s).
Users browsing this topic
Guest
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.