summaryrefslogtreecommitdiff
path: root/modules/overloading/macros/%r_x_r.sci
blob: c7ca23d9fcc5aba10c3d4dc6bbadb5a1988dade2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution.  The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt

function f=%r_x_r(s1,s2)
    // %r_x_r(r1,r2)=r1.*r2    r1,r2 rationals
    //!
    //author Serge Steer INRIA
    if ndims(s1)<=2& ndims(s2)<=2 then
        [s1,s2]=sysconv(s1,s2)
        [num,den]=simp(s1.num.*s2.num,s1.den.*s2.den)
        f=rlist(num,den,s1.dt)
    else
        if size(s1,"*")==1 then
            sz=size(s2)
        else
            sz=size(s1)
        end
        [num,den]=simp(s1.num(:).*s2.num(:),s1.den(:).*s2.den(:))
        f=rlist(matrix(num,sz),matrix(den,sz),s1.dt)
    end
endfunction