Ask Your Question

Cheatboy2's profile - activity

2018-07-09 00:00:53 -0600 received badge  Popular Question (source)
2013-04-08 09:47:26 -0600 received badge  Nice Answer (source)
2012-07-11 23:47:04 -0600 received badge  Teacher (source)
2012-07-11 23:47:04 -0600 received badge  Self-Learner (source)
2012-07-11 23:46:02 -0600 received badge  Student (source)
2011-12-06 04:13:44 -0600 answered a question Matlab values as sage vector or matrix object ?

It's ok !

It an error of my own.

Sage does provide a __matrix__ interface for MatlabElement (but not a __vector__ one so that explains my initial problem).

However it is based on string parsing so could be slow with large matrices. I gave a glance to Matlab binding package for the R programming language and it seems that the "fastest" way to communicate with matlab is to use the filesystem through mat files. Fortunately, it is easy to do in sage with scipy.sio.loadmat function and very fast.

Thanks for your answer Jason. Have a good day.

2011-12-06 02:36:55 -0600 answered a question Matlab values as sage vector or matrix object ?

I am afraid your are right.

I wrote a function that parse matlab text output, but as it relies on matlab ability to output formatted text data, it could be very slow with large amount of data.

I gave a glance to Matlab binding package for the R programming language and it seems that the "best" way to communicate with matlab is to use the filesystem through mat files.

Fortunately, it is easy to do with scipy.sio.loadmat function and very fast.

Concerning error messages: you can get them with octave as well. Sage simply lacks a standard way to turn matlab-like data into python-like data.

Thank you for your answer ! Have a good day.

2011-12-05 02:38:10 -0600 asked a question Matlab values as sage vector or matrix object ?

Hi all !

I tried Sage and I found that having a matlab interface is very useful, however I can't import matlab matrices as sage matrices (or numpy arrays) for further work into sage workspace.

For example :

a = matlab.linspace(1,10,20) # ok

a * 2 # ok

plot(a) # Attribute Error

vector(a) # Not Implemented Error

a.sage() # --> unable to parse output

Is there a way to avoid this problem ? Did I miss something in the documentation or does the MatlabElement type not support the same operations as the vector type does (excepted arithmetic operators) ?

Thanks !