~ubuntu-branches/ubuntu/raring/scilab/raring-proposed

« back to all changes in this revision

Viewing changes to modules/compatibility_functions/help/en_US/mtlb_sum.xml

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2012-08-30 14:42:38 UTC
  • mfrom: (1.4.7)
  • Revision ID: package-import@ubuntu.com-20120830144238-c1y2og7dbm7m9nig
Tags: 5.4.0-beta-3-1~exp1
* New upstream release
* Update the scirenderer dep
* Get ride of libjhdf5-java dependency

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
    *
12
12
    -->
13
13
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:lang="en" xml:id="mtlb_sum">
14
 
  <refnamediv>
15
 
    <refname>mtlb_sum</refname>
16
 
    <refpurpose>Matlab sum emulation function</refpurpose>
17
 
  </refnamediv>
18
 
  <refsection>
19
 
    <title>Description</title>
20
 
    <para>
21
 
      Matlab and Scilab <literal>sum</literal> behave differently in some particular cases:
22
 
    </para>
23
 
    <itemizedlist>
24
 
      <listitem>
25
 
        <para>
26
 
          When called with one input: Matlab <literal>sum</literal> threts the values along the first
27
 
          non-singleton dimension of input while Scilab <literal>sum</literal> threats all values of input.
28
 
        </para>
29
 
      </listitem>
30
 
      <listitem>
31
 
        <para>
32
 
          When called with two inputs: Matlab <literal>sum</literal> can be used with second input giving
33
 
          a non-existing dimension of first input while Scilab <literal>sum</literal> returns an error message.
34
 
        </para>
35
 
      </listitem>
36
 
    </itemizedlist>
37
 
    <para>
38
 
      The function <literal>mtlb_sum(A[,dim])</literal> is used by
39
 
      <literal>mfile2sci</literal> to replace <literal>sum(A[,dim])</literal> when it was not
40
 
      possible to know what were the inputs while porting Matlab code to Scilab. This function will
41
 
      determine the correct semantic at run time. If you want to have a
42
 
      more efficient code it is possible to replace <literal>mtlb_sum</literal> calls:
43
 
    </para>
44
 
    <itemizedlist>
45
 
      <listitem>
46
 
        <para>
47
 
          When called with one input, if <literal>A</literal> is an empty matrix, a scalar or a vector,
48
 
          <literal>mtlb_sum(A)</literal> may be replaced by <literal>sum(A)</literal>
49
 
        </para>
50
 
      </listitem>
51
 
      <listitem>
52
 
        <para>
53
 
          When called with one input, if <literal>A</literal> is a not-empty matrix,
54
 
          <literal>mtlb_sum(A)</literal> may be replaced by <literal>sum(A,1)</literal>
55
 
        </para>
56
 
      </listitem>
57
 
      <listitem>
58
 
        <para>
59
 
          When called with one input, if <literal>A</literal> is a multidimensional array,
60
 
          <literal>mtlb_sum(A)</literal> may be replaced by <literal>sum(A,firstnonsingleton(A))</literal>
61
 
        </para>
62
 
      </listitem>
63
 
      <listitem>
64
 
        <para>
65
 
          When called with two inputs, if <literal>dim</literal> is lesser than the number of dimensions of <literal>A</literal>
66
 
          <literal>mtlb_sum(A,dim)</literal> may be replaced by <literal>sum(A,dim)</literal>
67
 
        </para>
68
 
      </listitem>
69
 
    </itemizedlist>
70
 
    <para>
71
 
      Caution: <literal>mtlb_sum</literal> has not to be used for hand coded functions.
72
 
    </para>
73
 
  </refsection>
74
 
  <refsection role="see also">
75
 
    <title>See Also</title>
76
 
    <simplelist type="inline">
77
 
      <member>
78
 
        <link linkend="firstnonsingleton">firstnonsingleton</link>
79
 
      </member>
80
 
    </simplelist>
81
 
  </refsection>
 
14
    <refnamediv>
 
15
        <refname>mtlb_sum</refname>
 
16
        <refpurpose>Matlab sum emulation function</refpurpose>
 
17
    </refnamediv>
 
18
    <refsection>
 
19
        <title>Description</title>
 
20
        <para>
 
21
            Matlab and Scilab <literal>sum</literal> behave differently in some particular cases:
 
22
        </para>
 
23
        <itemizedlist>
 
24
            <listitem>
 
25
                <para>
 
26
                    When called with one input: Matlab <literal>sum</literal> threts the values along the first
 
27
                    non-singleton dimension of input while Scilab <literal>sum</literal> threats all values of input.
 
28
                </para>
 
29
            </listitem>
 
30
            <listitem>
 
31
                <para>
 
32
                    When called with two inputs: Matlab <literal>sum</literal> can be used with second input giving
 
33
                    a non-existing dimension of first input while Scilab <literal>sum</literal> returns an error message.
 
34
                </para>
 
35
            </listitem>
 
36
        </itemizedlist>
 
37
        <para>
 
38
            The function <literal>mtlb_sum(A[,dim])</literal> is used by
 
39
            <literal>mfile2sci</literal> to replace <literal>sum(A[,dim])</literal> when it was not
 
40
            possible to know what were the inputs while porting Matlab code to Scilab. This function will
 
41
            determine the correct semantic at run time. If you want to have a
 
42
            more efficient code it is possible to replace <literal>mtlb_sum</literal> calls:
 
43
        </para>
 
44
        <itemizedlist>
 
45
            <listitem>
 
46
                <para>
 
47
                    When called with one input, if <literal>A</literal> is an empty matrix, a scalar or a vector,
 
48
                    <literal>mtlb_sum(A)</literal> may be replaced by <literal>sum(A)</literal>
 
49
                </para>
 
50
            </listitem>
 
51
            <listitem>
 
52
                <para>
 
53
                    When called with one input, if <literal>A</literal> is a not-empty matrix,
 
54
                    <literal>mtlb_sum(A)</literal> may be replaced by <literal>sum(A,1)</literal>
 
55
                </para>
 
56
            </listitem>
 
57
            <listitem>
 
58
                <para>
 
59
                    When called with one input, if <literal>A</literal> is a multidimensional array,
 
60
                    <literal>mtlb_sum(A)</literal> may be replaced by <literal>sum(A,firstnonsingleton(A))</literal>
 
61
                </para>
 
62
            </listitem>
 
63
            <listitem>
 
64
                <para>
 
65
                    When called with two inputs, if <literal>dim</literal> is lesser than the number of dimensions of <literal>A</literal>
 
66
                    <literal>mtlb_sum(A,dim)</literal> may be replaced by <literal>sum(A,dim)</literal>
 
67
                </para>
 
68
            </listitem>
 
69
        </itemizedlist>
 
70
        <para>
 
71
            Caution: <literal>mtlb_sum</literal> has not to be used for hand coded functions.
 
72
        </para>
 
73
    </refsection>
 
74
    <refsection role="see also">
 
75
        <title>See Also</title>
 
76
        <simplelist type="inline">
 
77
            <member>
 
78
                <link linkend="firstnonsingleton">firstnonsingleton</link>
 
79
            </member>
 
80
        </simplelist>
 
81
    </refsection>
82
82
</refentry>