ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 11 Apr 2013 16:57:17 -0500Convert a sage.interfaces.matlab.MatlabElement objecthttp://ask.sagemath.org/question/10003/convert-a-sageinterfacesmatlabmatlabelement-object/Hi,
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 Mon, 08 Apr 2013 07:46:59 -0500http://ask.sagemath.org/question/10003/convert-a-sageinterfacesmatlabmatlabelement-object/Comment by Zheng for <p>Hi, </p>
<p>I tried the following command to call Matlab to generate a sparse matrix and multiply it with a vector</p>
<pre><code>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
</code></pre>
<p>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 </p>
http://ask.sagemath.org/question/10003/convert-a-sageinterfacesmatlabmatlabelement-object/?comment=17912#post-id-17912It does not work and complains "NotImplementedError: Unable to parse output", by the way, I'm using sage-5.3Thu, 11 Apr 2013 16:57:17 -0500http://ask.sagemath.org/question/10003/convert-a-sageinterfacesmatlabmatlabelement-object/?comment=17912#post-id-17912Comment by kcrisman for <p>Hi, </p>
<p>I tried the following command to call Matlab to generate a sparse matrix and multiply it with a vector</p>
<pre><code>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
</code></pre>
<p>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 </p>
http://ask.sagemath.org/question/10003/convert-a-sageinterfacesmatlabmatlabelement-object/?comment=17924#post-id-17924Can 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...Mon, 08 Apr 2013 14:43:28 -0500http://ask.sagemath.org/question/10003/convert-a-sageinterfacesmatlabmatlabelement-object/?comment=17924#post-id-17924