Convert a sage.interfaces.matlab.MatlabElement object

asked 2013-04-08 14:46:59 +0200


I tried the following command to call Matlab to generate a sparse matrix and multiply it with a vector

sage: matlab('rand(3)')*matrix([1,2,2]).T
    0.0344    0.7655    0.4898
    0.4387    0.7952    0.4456
    0.3816    0.1869    0.6463

This is not correct. It seems the multiplication is not done. I'm curious if there is anyway to do the multiplication of a sage.interfaces.matlab.MatlabElement object and a built-in matrix object? Or is there anyway to convert a sage.interfaces.matlab.MatlabElement object to one that can do multiplications with the built-in matrix types? Thanks

edit retag flag offensive close merge delete


Can you just do `matlab('rand(3)').sage()` to get such a thing? I don't have access to Matlab, but in principle this should work; however, for Matlab it seems to just use a string representation so maybe that wouldn't be enough...

kcrisman gravatar imagekcrisman ( 2013-04-08 21:43:28 +0200 )edit

It does not work and complains "NotImplementedError: Unable to parse output", by the way, I'm using sage-5.3

Zheng gravatar imageZheng ( 2013-04-11 23:57:17 +0200 )edit