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 Alex M.  
#1 Posted : 08 December 2015 00:23:57(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)
Hi all,

I have discovered recently that excel_IO plugin is way too slow in outputting LARGE excel ranges to SMath (30000+ elements).

The slowness narrows down to this part of the code:
Code:

        Dim myResult As List(Of Term) = New List(Of Term)
            For Each matValue As String In result_temp3
                myResult.AddRange(SMath.Manager.Converter.ToTerms(matValue))
            Next
            If counter > 2 Then
                myResult.AddRange(SMath.Manager.Converter.ToTerms(range_rows.ToString))
                myResult.AddRange(SMath.Manager.Converter.ToTerms(range_cols.ToString))
                myResult.Add(New Term(Functions.Mat, TermType.Function, (2 + (range_cols * range_rows))))
            End If


I am certain about the source of slowness because initially my code had two For Loops: one to format strings to satisfy SMath requirements and another one listed above. Later I have condensed those two For Loops into one. Performance DID NOT improve.

Is there any other way to pass a matrix to SMAth?

Any input is appreciated.

Thanks!

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

Offline sinneD  
#2 Posted : 08 December 2015 20:11:52(UTC)
sinneD


Rank: Advanced Member

Groups: Registered
Joined: 12/03/2011(UTC)
Posts: 101
Location: Chicago

Was thanked: 16 time(s) in 7 post(s)
Alex-

What is the last line doing for you?

Are you trying to size/format the matrix and then populate it element by element?

The code is hard for me, so maybe I don't recognize your approach.

Could you simply read the data line by line and append the set with each one and then at the end with range_rows, range_columns) for the same effect?

Since SMath syntax seems to be

mat(R1C1,R1C2,R1C3,R2C1,R2C2,R2C3,nROWs,nCOLS)

to get matrix of

R1C1 R1C2 R1C3
R2C1 R2C2 R2C3

I have been 'making' matrices to use in SMath via Excel in .csv files and text editor.

Using the .csv file already has everything formatted as needed. I take my data in csv, open it in editor, delete the CR/LF's so it becomes one long line and append the rows,cols) at the end. Copy and paste into SMAth and its there. My only trouble sometimes is counting the right number of rows/columns if I change things.
Join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
Offline Alex M.  
#3 Posted : 08 December 2015 23:19:45(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)
Originally Posted by: sinneD Go to Quoted Post
Alex-
Since SMath syntax seems to be

mat(R1C1,R1C2,R1C3,R2C1,R2C2,R2C3,nROWs,nCOLS)

I have been 'making' matrices to use in SMath via Excel in .csv files and text editor.



Do you have a plugin code (C# or VB.NET) that would pass a string mat(R1C1,R1C2,R1C3,R2C1,R2C2,R2C3,nROWs,nCOLS) back to SMath without an error?

I have tried it in the past, but passing a simple string did not quite work...

Offline Davide Carpi  
#4 Posted : 10 December 2015 18:09:25(UTC)
Davide Carpi


Rank: Advanced Member

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

Was thanked: 1329 time(s) in 875 post(s)
How much slow? With importData.XLSX I can import a 1100x111 matrix of numbers in ~7-8 seconds (optimization: numeric)

2015-12-10 16_07_07-SMath Studio Desktop - [Book1.sm_].png

The code is the same:

Code:
			// return selectionContent values to SMath
			List<Term> myResult = new List<Term>();
			foreach (string matValue in selectionContent)
			{
				myResult.AddRange(Converter.ToTerms(matValue));
			}
			myResult.AddRange(Converter.ToTerms(selectionHeight.ToString()));
			myResult.AddRange(Converter.ToTerms(selectionWidth.ToString()));
			myResult.Add(new Term(Functions.Mat, TermType.Function, 2 + (selectionHeight * selectionWidth)));
			
			// output to SMath
			return myResult.ToArray();

Edited by user 10 December 2015 18:11:01(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
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.