rewrite hypermat api for scilab 6
[scilab.git] / scilab / modules / api_scilab / help / ja_JP / hypermat / B_getHypermatOfDouble.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) 2013  - Scilab Enterprises - Calixte DENIZET
5  * 
6  * This file must be used under the terms of the CeCILL.
7  * This source file is licensed as described in the file COPYING, which
8  * you should have received as part of this distribution.  The terms
9  * are also available at    
10  * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
11  *
12  -->
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:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="getHypermatOfDouble" xml:lang="ja">
14     <refnamediv>
15         <refname>getHypermatOfDouble</refname>
16         <refpurpose>
17             double変数のハイパー行列を取得.
18         </refpurpose>
19     </refnamediv>
20     <refsynopsisdiv>
21         <title>呼び出し手順</title>
22         <synopsis>SciErr getHypermatOfDouble(void* _pvCtx, int* _piAddress, int **_dims, int *_ndims, double* _pdblReal)</synopsis>
23     </refsynopsisdiv>
24     <refsection>
25         <title>引数</title>
26         <variablelist>
27             <varlistentry>
28                 <term>_pvCtx</term>
29                 <listitem>
30                     <para>
31                         Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定.
32                     </para>
33                 </listitem>
34             </varlistentry>
35             <varlistentry>
36                 <term>_piAddress</term>
37                 <listitem>
38                     <para>
39                         Scilab 変数のアドレス.
40                     </para>
41                 </listitem>
42             </varlistentry>
43             <varlistentry>
44                 <term>_dims</term>
45                 <listitem>
46                     <para>
47                         ハイパー行列の次元
48                     </para>
49                 </listitem>
50             </varlistentry>
51             <varlistentry>
52                 <term>_ndims</term>
53                 <listitem>
54                     <para>
55                         次元の数.
56                     </para>
57                 </listitem>
58             </varlistentry>
59             <varlistentry>
60                 <term>_pdblReal</term>
61                 <listitem>
62                     <para>
63                         double値.
64                     </para>
65                 </listitem>
66             </varlistentry>
67         </variablelist>
68     </refsection>
69     <refsection>
70         <title>戻り値</title>
71         <para>SciErr構造体, フィールド iErr は
72             エラー番号を保持します (エラーがない場合は 0).
73         </para>
74     </refsection>
75     <refsection>
76         <title>ゲートウェイのソース</title>
77         <programlisting role="code_gateway">
78             <![CDATA[ 
79 #include "api_scilab.h"
80
81 int hypermatExample(char *fname, void* pvApiCtx)
82 {
83     SciErr sciErr;
84     int* piAddr = NULL;
85     int iType   = 0;
86     int iRet    = 0;
87     CheckInputArgument(pvApiCtx, 1, 1);
88     CheckOutputArgument(pvApiCtx, 0, 1);
89     sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
90     if (sciErr.iErr)
91     {
92         printError(&sciErr, 0);
93         return 0;
94     }
95     if (isEmptyMatrix(pvApiCtx, piAddr))
96     {
97         iRet = createEmptyMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1);
98         if (iRet)
99         {
100             return iRet;
101         }
102         AssignOutputVariable(pvApiCtx, 1) = 0;
103     }
104     else if (isHypermatType(pvApiCtx, piAddr))
105     {
106         int * dims = NULL;
107         int ndims;
108         double* pdblReal = NULL;
109         double* pdblImg = NULL;
110         if (isHypermatComplex(pvApiCtx, piAddr))
111         {
112             sciErr = getComplexHypermatOfDouble(pvApiCtx, piAddr, &dims, &ndims, &pdblReal, &pdblImg);
113             if (sciErr.iErr)
114             {
115                 printError(&sciErr, 0);
116                 return sciErr.iErr;
117             }
118             sciErr = createComplexHypermatOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, pdblReal, pdblImg);
119             if (sciErr.iErr)
120             {
121                 printError(&sciErr, 0);
122                 return sciErr.iErr;
123             }
124         }
125         else
126         {
127             sciErr = getHypermatOfDouble(pvApiCtx, piAddr, &dims, &ndims, &pdblReal);
128             if (sciErr.iErr)
129             {
130                 printError(&sciErr, 0);
131                 return sciErr.iErr;
132             }
133             sciErr = createHypermatOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dims, ndims, pdblReal);
134             if (sciErr.iErr)
135             {
136                 printError(&sciErr, 0);
137                 return sciErr.iErr;
138             }
139         }
140         AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
141     }
142     return 0;
143 }]]>
144         </programlisting>
145     </refsection>
146     <refsection>
147         <title>Scilab テストスクリプト</title>
148         <programlisting role="code_scilab"><![CDATA[ 
149 a = hypermat([1 2 3], ones(1,6));
150 b = a + %i*hypermat([1 2 3], 1:6);
151 hypermatExample(a) == a
152 hypermatExample(b) == b
153  ]]></programlisting>
154     </refsection>
155 </refentry>