1
function [tree]=%m2sci(tree)
4
// Conversion function for Matlab multiplication
5
// Input: tree = Matlab operation tree
6
// Output: tree = Scilab equivalent for tree
9
// Overloading functions in $SCI/macros/mtlb/:
13
[A,B]=getoperands(tree)
15
// Multiplication does not work with Strings in Scilab
16
if or(A.vtype==[String,Unknown]) then
19
if or(B.vtype==[String,Unknown]) then
23
// %b_m_b is not defined in Scilab
24
if A.vtype==Boolean & B.vtype==Boolean then
27
tree.operands=list(A,B)
29
if is_complex(A) & is_complex(B) then
31
elseif A.property==Complex | B.property==Complex then
32
if not_empty(A) & not_empty(B) then
34
elseif is_empty(A) | is_empty(B) then
39
elseif is_real(A) & is_real(B) then
45
tree.out(1).type=Type(Double,prop)
47
if is_a_scalar(A) then
48
tree.out(1).dims=B.dims
49
elseif is_a_scalar(B) then
50
tree.out(1).dims=A.dims
51
elseif not_empty(A) & not_empty(B) then
52
tree.out(1).dims=list(A.dims(1),B.dims(2))
53
elseif is_empty(A) | is_empty(B) then
54
tree.out(1).dims=list(0,0)
55
elseif not_empty(A) | not_empty(B) then
56
tree.out(1).dims=list(A.dims(1),B.dims(2))
58
tree.out(1).dims=list(Unknown,Unknown)