File: mlist.xml

package info (click to toggle)
scilab 5.2.2-9
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 334,832 kB
  • ctags: 52,586
  • sloc: xml: 526,945; ansic: 223,590; fortran: 163,080; java: 56,934; cpp: 33,840; tcl: 27,936; sh: 20,397; makefile: 9,908; ml: 9,451; perl: 1,323; cs: 614; lisp: 30
file content (126 lines) | stat: -rw-r--r-- 4,460 bytes parent folder | download
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) 2007-2008 - 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-en.txt
 *
 -->
<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="mlist">
  <info>
    <pubdate>$LastChangedDate$</pubdate>
  </info>
  <refnamediv>
    <refname>mlist</refname>
    <refpurpose>Scilab object, matrix oriented typed list
  definition.</refpurpose>
  </refnamediv>
  <refsynopsisdiv>
    <title>Calling Sequence</title>
    <synopsis>mlist(typ,a1,....an )</synopsis>
  </refsynopsisdiv>
  <refsection>
    <title>Parameters</title>
    <variablelist>
      <varlistentry>
        <term>typ</term>
        <listitem>
          <para>vector of character strings</para>
        </listitem>
      </varlistentry>
      <varlistentry>
        <term>ai</term>
        <listitem>
          <para>any Scilab object (<literal>matrix, list,string...</literal>).</para>
        </listitem>
      </varlistentry>
    </variablelist>
  </refsection>
  <refsection>
    <title>Description</title>
    <para><literal>mlist</literal> object are very similar to <link linkend="tlist">tlist</link> objects.
    The only difference concerns the <link linkend="extraction">extraction</link>  and <link linkend="insertion">insertion</link>   syntax:
    if <literal>M</literal> is an mlist, for any index <literal>i</literal> which is
    not a field name, <literal>M(i)</literal> is no more the <literal>i</literal>th
    field of the list.</para>
    <para> The semantic of the extraction and insertion syntax should be given by
    an <link linkend="overloading">overloading</link> functions.</para>
    <para>The overloading function for extraction syntax <literal>b=a(i1,...,in)</literal>
    has the following calling sequence: <literal>b=%&lt;type_of_a&gt;_e_(i1,...,in,a)</literal> </para>
    <para>and the syntax
    <literal>[x1,..,xm]=a(i1,...,in)</literal> has the following calling sequence:
    <literal>[x1,..,xm]=%&lt;type_of_a&gt;_e_(i1,...,in,a)</literal></para>
    <para/>
    <para> The overloading function associated to the insertion syntax
    <literal>a(i1,...,in)=b</literal>  has the following calling sequence:
    <literal>a=%&lt;type_of_b&gt;_i_&lt;type_of_a&gt;(i1,...,in,b,a)</literal>. </para>
    <para/>
    <para>mlist fields must then be designed by their names. They can also be
    handled using the <literal>getfield</literal> and <literal>setfield</literal>
    functions.</para>
  </refsection>
  <refsection>
    <title>Examples</title>
    <programlisting role="example"><![CDATA[ 
M=mlist(['V','name','value'],['a','b';'c' 'd'],[1 2; 3 4]);
//define display
function %V_p(M),disp(M.name+':'+string(M.value)),endfunction

//define extraction operation
function r=%V_e(varargin)
  M=varargin($)
  r=mlist(['V','name','value'],M.name(varargin(1:$-1)),M.value(varargin(1:$-1)))
endfunction
M(2,:) // the second row of  M
M.value

//define insertion operations
function M=%V_i_V(varargin)
  M=varargin($)
  N=varargin($-1)
  M.value(varargin(1:$-2))=N.value
  M.name(varargin(1:$-2))=N.name
endfunction
M(1,1)=M(2,2)

function M=%s_i_V(varargin) //insertion of a regular matrix into a V matrix
  M=varargin($)
  N=varargin($-1)
  M.value(varargin(1:$-2))=N
  M.name(varargin(1:$-2))=emptystr(N)
endfunction
M(1,1)=44

//tlist case
M=tlist(['V','name','value'],['a','b';'c' 'd'],[1 2; 3 4]);
M(2)
M(2)='a'+string([1 2;3 4])

M('name')
 ]]></programlisting>
  </refsection>
  <refsection>
    <title>See Also</title>
    <simplelist type="inline">
      <member>
        <link linkend="tlist">tlist</link>
      </member>
      <member>
        <link linkend="list">list</link>
      </member>
      <member>
        <link linkend="overloading">overloading</link>
      </member>
      <member>
        <link linkend="getfield">getfield</link>
      </member>
      <member>
        <link linkend="setfield">setfield</link>
      </member>
    </simplelist>
  </refsection>
</refentry>