Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 2f67f9c7d34a113061b128c67572102c > files > 16

mathgl-doc-1.11.0.1-4.fc15.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- This manual is for MathGL (version 1.11), a collection of classes and routines for scientific plotting. Please report any errors in this manual to mathgl.abalakin@gmail.org.

Copyright C 2008 Alexey Balakin.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with the Front-Cover Texts being "A GNU Manual,"
and with the Back-Cover Texts as in (a) below.  A copy of the
license is included in the section entitled "GNU Free Documentation
License."

(a) The FSF's Back-Cover Text is: "You have the freedom to
copy and modify this GNU manual.  Buying copies from the FSF
supports it in developing GNU and promoting software freedom."

 -->
<!-- Created on February 27, 2011 by texi2html 1.82
texi2html was written by: 
            Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Many creative people.
Send bugs and suggestions to <texi2html-bug@nongnu.org>
-->
<head>
<title>MathGL 1.11: 6. mglData class</title>

<meta name="description" content="MathGL 1.11: 6. mglData class">
<meta name="keywords" content="MathGL 1.11: 6. mglData class">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.82">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.roman {font-family:serif; font-weight:normal;}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
-->
</style>


</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">

<a name="mglData-class"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="mathgl_en_5.html#QMathGL-class" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Public-variables" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en_5.html#Widget-classes" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en.html#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_7.html#Other-classes" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_12.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="mglData-class-1"></a>
<h1 class="chapter">6. mglData class</h1>

<p>Class for working with data array. This class is defined in <code>#include &lt;mgl/mgl_data.h&gt;</code>. The class has functions for easy and safe allocation, resizing, loading and saving, modifying of data arrays. Also it can numerically differentiate and integrate data, interpolate, fill data by formula and so on. Class supports data with dimensions up to 3 (like function of 3 variables &ndash; x,y,z). The internal representation of numbers is float. Float type was chosen because it has smaller size in memory and usually it has enough precision in plotting purposes. You can change it by selecting option <code>--enable-double</code> at the library configuring (see section <a href="mathgl_en_1.html#Installation-and-usage">Installation and usage</a>).
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Public-variables">6.1 Public variables</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">            
</td></tr>
<tr><td align="left" valign="top"><a href="#Create-and-delete">6.2 Create and delete</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">           
</td></tr>
<tr><td align="left" valign="top"><a href="#Fill">6.3 Fill</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                        
</td></tr>
<tr><td align="left" valign="top"><a href="#Rearrange">6.4 Rearrange</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                   
</td></tr>
<tr><td align="left" valign="top"><a href="#File-I_002fO">6.5 File I/O</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                    
</td></tr>
<tr><td align="left" valign="top"><a href="#Make-another-data">6.6 Make another data</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">           
</td></tr>
<tr><td align="left" valign="top"><a href="#Change-data">6.7 Change data</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">      
</td></tr>
<tr><td align="left" valign="top"><a href="#Interpolation">6.8 Interpolation</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">               
</td></tr>
<tr><td align="left" valign="top"><a href="#Informational-functions">6.9 Informational functions</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">     
</td></tr>
<tr><td align="left" valign="top"><a href="#Operators">6.10 Operators</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                   
</td></tr>
<tr><td align="left" valign="top"><a href="#Global-functions">6.11 Global functions</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">            
</td></tr>
</table>

<hr size="6">
<a name="Public-variables"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#mglData-class" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Create-and-delete" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_7.html#Other-classes" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_12.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Public-variables-1"></a>
<h2 class="section">6.1 Public variables</h2>

<dl>
<dt><a name="index-a-of-mglData"></a><u>Variable of mglData:</u> <code>float *</code> <b>a</b></dt>
<dd><p>Data array itself. The flat data representation is used. For example, matrix [nx x ny] is presented as flat (1d-) array with length nx*ny. The element with indexes {i, j, k} is a[i+nx*j+nx*ny*k] (indexes are zero based).
</p></dd></dl>
<dl>
<dt><a name="index-nx-of-mglData"></a><u>Variable of mglData:</u> <code>int</code> <b>nx</b></dt>
<dd><p>Number of points in 1st dimensions (&rsquo;x&rsquo; dimension).
</p></dd></dl>
<dl>
<dt><a name="index-ny-of-mglData"></a><u>Variable of mglData:</u> <code>int</code> <b>ny</b></dt>
<dd><p>Number of points in 2nd dimensions (&rsquo;y&rsquo; dimension).
</p></dd></dl>
<dl>
<dt><a name="index-nz-of-mglData"></a><u>Variable of mglData:</u> <code>int</code> <b>nz</b></dt>
<dd><p>Number of points in 3d dimensions (&rsquo;z&rsquo; dimension).
</p></dd></dl>
<dl>
<dt><a name="index-id-of-mglData"></a><u>Variable of mglData:</u> <code>char *</code> <b>id</b></dt>
<dd><p>Column (or slice if nz&gt;1) names &ndash; one character per column.
</p></dd></dl>


<hr size="6">
<a name="Create-and-delete"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Public-variables" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Fill" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_7.html#Other-classes" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_12.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Create-and-delete-1"></a>
<h2 class="section">6.2 Create and delete</h2>
<a name="index-mglData"></a>
<a name="index-Set"></a>

<dl>
<dt><a name="index--on-mglData"></a><u>Constructor on mglData:</u> <b><code></code></b><i> mglData (<code>int</code> mx=<code>1</code>, <code>int</code> my=<code>1</code>, <code>int</code> mz=<code>1</code>)</i></dt>
<dd><p>Default constructor. Allocates the memory for data array and initializes it by zero.
</p></dd></dl>
<dl>
<dt><a name="index--on-mglData-1"></a><u>Constructor on mglData:</u> <b><code></code></b><i> mglData (<code>const char *</code>fname)</i></dt>
<dd><p>Initializes the data by reading from file.
</p></dd></dl>
<dl>
<dt><a name="index--on-mglData-2"></a><u>Constructor on mglData:</u> <b><code></code></b><i> mglData (<code>const mglData</code> &amp;dat)</i></dt>
<dd><p>Initiates by other <code>mglData</code> instance.
</p></dd></dl>
<dl>
<dt><a name="index-Create"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Create</b><i> (<code>int</code> mx, <code>int</code> my=<code>1</code>, <code>int</code> mz=<code>1</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005fcreate"></a><u>C function:</u> <code>void</code> <b>mgl_data_create</b><i> (<code>HMDT</code> dat, <code>int</code> mx, <code>int</code> my, <code>int</code> mz)</i></dt>
<dd><p>Creates or recreates the array with specified size and fills it by zero. This function does nothing if one of parameters <var>mx</var>, <var>my</var>, <var>mz</var> is zero or negative.
</p></dd></dl>

<dl>
<dt><a name="index-Set-1"></a><u>Method on <code>mglData</code> (C++):</u> <code>void</code> <b>Set</b><i> (<code>const float *</code>A, <code>int</code> NX, <code>int</code> NY=<code>1</code>, <code>int</code> NZ=<code>1</code>)</i></dt>
<dt><a name="index-Set-2"></a><u>Method on <code>mglData</code> (C++):</u> <code>void</code> <b>Set</b><i> (<code>const double *</code>A, <code>int</code> NX, <code>int</code> NY=<code>1</code>, <code>int</code> NZ=<code>1</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005fset_005ffloat"></a><u>C function:</u> <code>void</code> <b>mgl_data_set_float</b><i> (<code>HMDT</code> dat, <code>const float *</code>A, <code>int</code> NX, <code>int</code> NY, <code>int</code> NZ)</i></dt>
<dt><a name="index-mgl_005fdata_005fset_005fdouble"></a><u>C function:</u> <code>void</code> <b>mgl_data_set_double</b><i> (<code>HMDT</code> dat, <code>const double *</code>A, <code>int</code> NX, <code>int</code> NY, <code>int</code> NZ)</i></dt>
<dd><p>Allocates memory and copies the data from the <strong>flat</strong> <code>float*</code> or <code>double*</code> array.
</p></dd></dl>

<dl>
<dt><a name="index-Set-3"></a><u>Method on <code>mglData</code> (C++):</u> <code>void</code> <b>Set</b><i> (<code>const float **</code>A, <code>int</code> N1, <code>int</code> N2)</i></dt>
<dt><a name="index-Set-4"></a><u>Method on <code>mglData</code> (C++):</u> <code>void</code> <b>Set</b><i> (<code>const double **</code>A, <code>int</code> N1, <code>int</code> N2)</i></dt>
<dt><a name="index-mgl_005fdata_005fset_005ffloat2"></a><u>C function:</u> <code>void</code> <b>mgl_data_set_float2</b><i> (<code>HMDT</code> dat, <code>const float **</code>A, <code>int</code> N1, <code>int</code> N2)</i></dt>
<dt><a name="index-mgl_005fdata_005fset_005fdouble2"></a><u>C function:</u> <code>void</code> <b>mgl_data_set_double2</b><i> (<code>HMDT</code> dat, <code>const double **</code>A, <code>int</code> N1, <code>int</code> N2)</i></dt>
<dd><p>Allocates memory and copies the data from the <code>float**</code> or <code>double**</code> array with dimensions <var>N1</var>, <var>N2</var>, i.e. from array defined as <code>float a[N1][N2];</code>.
</p></dd></dl>

<dl>
<dt><a name="index-Set-5"></a><u>Method on <code>mglData</code> (C++):</u> <code>void</code> <b>Set</b><i> (<code>const float ***</code>A, <code>int</code> N1, <code>int</code> N2)</i></dt>
<dt><a name="index-Set-6"></a><u>Method on <code>mglData</code> (C++):</u> <code>void</code> <b>Set</b><i> (<code>const double ***</code>A, <code>int</code> N1, <code>int</code> N2)</i></dt>
<dt><a name="index-mgl_005fdata_005fset_005ffloat3"></a><u>C function:</u> <code>void</code> <b>mgl_data_set_float3</b><i> (<code>HMDT</code> dat, <code>const float ***</code>A, <code>int</code> N1, <code>int</code> N2)</i></dt>
<dt><a name="index-mgl_005fdata_005fset_005fdouble3"></a><u>C function:</u> <code>void</code> <b>mgl_data_set_double3</b><i> (<code>HMDT</code> dat, <code>const double ***</code>A, <code>int</code> N1, <code>int</code> N2)</i></dt>
<dd><p>Allocates memory and copies the data from the <code>float***</code> or <code>double***</code> array with dimensions <var>N1</var>, <var>N2</var>, <var>N3</var>, i.e. from array defined as <code>float a[N1][N2][N3];</code>.
</p></dd></dl>

<dl>
<dt><a name="index-Set-7"></a><u>Method on <code>mglData</code> (C++):</u> <code>void</code> <b>Set</b><i> (<code>gsl_vector *</code>v)</i></dt>
<dt><a name="index-mgl_005fdata_005fset_005fvector"></a><u>C function:</u> <code>void</code> <b>mgl_data_set_vector</b><i> (<code>HMDT</code> dat, <code>gsl_vector *</code>v)</i></dt>
<dd><p>Allocates memory and copies the data from the <code>gsl_vector *</code> structure.
</p></dd></dl>
<dl>
<dt><a name="index-Set-8"></a><u>Method on <code>mglData</code> (C++):</u> <code>void</code> <b>Set</b><i> (<code>gsl_matrix *</code>m)</i></dt>
<dt><a name="index-mgl_005fdata_005fset_005fmatrix"></a><u>C function:</u> <code>void</code> <b>mgl_data_set_matrix</b><i> (<code>HMDT</code> dat, <code>gsl_matrix *</code>m)</i></dt>
<dd><p>Allocates memory and copies the data from the <code>gsl_matrix *</code> structure.
</p></dd></dl>
<dl>
<dt><a name="index-Set-9"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>inline void</code> <b>Set</b><i> (<code>const mglData &amp;</code>from)</i></dt>
<dt><a name="index-mgl_005fdata_005fset"></a><u>C function:</u> <code>void</code> <b>mgl_data_set</b><i> (<code>HMDT</code> dat, <code>const HMDT</code> from)</i></dt>
<dd><p>Copies the data from mglData instance <var>from</var>.
</p></dd></dl>

<dl>
<dt><a name="index-Set-10"></a><u>Method on <code>mglData</code> (C++):</u> <code>void</code> <b>Set</b><i> (<code>const std::vector&lt;int&gt; &amp;</code>d)</i></dt>
<dt><a name="index-Set-11"></a><u>Method on <code>mglData</code> (C++):</u> <code>void</code> <b>Set</b><i> (<code>const std::vector&lt;float&gt; &amp;</code>d)</i></dt>
<dt><a name="index-Set-12"></a><u>Method on <code>mglData</code> (C++):</u> <code>void</code> <b>Set</b><i> (<code>const std::vector&lt;double&gt; &amp;</code>d)</i></dt>
<dd><p>Allocates memory and copies the data from the <code>std::vector&lt;T&gt;</code> array.
</p></dd></dl>


<dl>
<dt><a name="index-Set-13"></a><u>Method on <code>mglData</code> (C+, Python):</u> <code>void</code> <b>Set</b><i> (<code>const char *</code>str, <code>int</code> NX, <code>int</code> NY=<code>1</code>, <code>int</code> NZ=<code>1</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005fset_005fvalues"></a><u>C function:</u> <code>void</code> <b>mgl_data_set_values</b><i> (<code>const char *</code>str, <code>int</code> NX, <code>int</code> NY, <code>int</code> NZ)</i></dt>
<dd><p>Allocates memory and scanf the data from the string.
</p></dd></dl>

<hr size="6">
<a name="Fill"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Create-and-delete" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Rearrange" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_7.html#Other-classes" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_12.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Fill-1"></a>
<h2 class="section">6.3 Fill</h2>
<a name="index-Fill"></a>
<a name="index-Modify"></a>

<dl>
<dt><a name="index-Fill-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Fill</b><i> (<code>float</code> x1, <code>float</code> x2, <code>char</code> dir=<code>'x'</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005ffill"></a><u>C function:</u> <code>void</code> <b>mgl_data_fill</b><i> (<code>HMDT</code> dat, <code>float</code> x1, <code>float</code> x2, <code>char</code> dir)</i></dt>
<dd><p>Equidistantly fills the data values to range [<var>x1</var>, <var>x2</var>] in direction <var>dir</var>={&lsquo;<samp>x</samp>&rsquo;,&lsquo;<samp>y</samp>&rsquo;,&lsquo;<samp>z</samp>&rsquo;}.
</p></dd></dl>

<dl>
<dt><a name="index-Fill-2"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Fill</b><i> (<code>const char *</code>eq, <code>mglPoint</code> Min, <code>mglPoint</code> Max, <code>const mglData *</code>vdat=0, <code>const mglData *</code>wdat=0)</i></dt>
<dt><a name="index-mgl_005fdata_005ffill-1"></a><u>C function:</u> <code>void</code> <b>mgl_data_fill</b><i> (<code>HMGL</code> gr, <code>HMDT</code> dat, <code>const char *</code>eq, <code>const HMDT *</code>vdat, <code>const HMDT *</code>wdat)</i></dt>
<dd><p>Fills the value of array according to the formula in string <var>eq</var>. Formula is an arbitrary expression depending  on variables &lsquo;<samp>x</samp>&rsquo;, &lsquo;<samp>y</samp>&rsquo;, &lsquo;<samp>z</samp>&rsquo;, &lsquo;<samp>u</samp>&rsquo;, &lsquo;<samp>v</samp>&rsquo;, &lsquo;<samp>w</samp>&rsquo;. Coordinates &lsquo;<samp>x</samp>&rsquo;, &lsquo;<samp>y</samp>&rsquo;, &lsquo;<samp>z</samp>&rsquo; are supposed to be normalized in range <var>Min</var> x <var>Max</var> (in difference from <code>Modify</code> functions). Variable &lsquo;<samp>u</samp>&rsquo; is the original value of the array. Variables &lsquo;<samp>v</samp>&rsquo; and &lsquo;<samp>w</samp>&rsquo; are values of <var>vdat</var>, <var>wdat</var> which can be <code>NULL</code> (i.e. can be omitted).
</p></dd></dl>

<dl>
<dt><a name="index-Modify-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Modify</b><i> (<code>const char *</code>eq, <code>int</code> dim=<code>0</code>)</i></dt>
<dt><a name="index-Modify-2"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Modify</b><i> (<code>const char *</code>eq, <code>const mglData &amp;</code>v)</i></dt>
<dt><a name="index-Modify-3"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Modify</b><i> (<code>const char *</code>eq, <code>const mglData &amp;</code>v, <code>const mglData &amp;</code>w)</i></dt>
<dt><a name="index-mgl_005fdata_005fmodify"></a><u>C function:</u> <code>void</code> <b>mgl_data_modify</b><i> (<code>HMDT</code> dat, <code>const char *</code>eq, <code>int</code> dim)</i></dt>
<dt><a name="index-mgl_005fdata_005fmodify_005fvw"></a><u>C function:</u> <code>void</code> <b>mgl_data_modify_vw</b><i> (<code>HMDT</code> dat, <code>const char *</code>eq, <code>const HMDT</code> v, <code>const HMDT</code> w)</i></dt>
<dd><p>Fills the value of array according to the formula in string <var>eq</var>. Formula is an arbitrary expression depending  on variables &lsquo;<samp>x</samp>&rsquo;, &lsquo;<samp>y</samp>&rsquo;, &lsquo;<samp>z</samp>&rsquo;, &lsquo;<samp>u</samp>&rsquo;, &lsquo;<samp>v</samp>&rsquo;, &lsquo;<samp>w</samp>&rsquo;. Coordinates &lsquo;<samp>x</samp>&rsquo;, &lsquo;<samp>y</samp>&rsquo;, &lsquo;<samp>z</samp>&rsquo; are supposed to be normalized in range [0,1] (in difference from <code>Fill</code> functions). Variable &lsquo;<samp>u</samp>&rsquo; is the original value of the array. Variables &lsquo;<samp>v</samp>&rsquo; and &lsquo;<samp>w</samp>&rsquo; are values of <var>vdat</var>, <var>wdat</var> which can be <code>NULL</code> (i.e. can be omitted). If <var>dim</var>&gt;0 is specified then modification will be fulfilled only for slices &gt;=<var>dim</var>.
</p></dd></dl>

<dl>
<dt><a name="index-Put"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Put</b><i> (<code>float</code> val, <code>int</code> i=<code>-1</code>, <code>int</code> j=<code>-1</code>, <code>int</code> k=<code>-1</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005fput_005fval"></a><u>mglData:</u> <code>void</code> <b>mgl_data_put_val</b><i> (<code>HMDT</code> a, <code>float</code> val, <code>int</code> i, <code>int</code> j, <code>int</code> k)</i></dt>
<dd><p>Function sets value(s) of array a[<var>i</var>, <var>j</var>, <var>k</var>] = <var>val</var>. Negative indexes <var>i</var>, <var>j</var>, <var>k</var>=-1 set the value <var>val</var> to whole range in corresponding direction(s). For example, <code>Put(val,-1,0,-1);</code> sets a[i,0,j]=<var>val</var> for i=0...(nx-1), j=0...(nz-1).
</p></dd></dl>

<dl>
<dt><a name="index-Put-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Put</b><i> (<code>const mglData &amp;</code>v, <code>int</code> i=<code>-1</code>, <code>int</code> j=<code>-1</code>, <code>int</code> k=<code>-1</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005fput_005fdat"></a><u>mglData:</u> <code>void</code> <b>mgl_data_put_dat</b><i> (<code>HMDT</code> a, <code>const HMDT</code> v, <code>int</code> i, <code>int</code> j, <code>int</code> k)</i></dt>
<dd><p>Function copies value(s) from array <var>v</var> to the range of original array. Negative indexes <var>i</var>, <var>j</var>, <var>k</var>=-1 set the range in corresponding direction(s). At this minor dimensions of array <var>v</var> should be large than corresponding dimensions of this array. For example, <code>Put(v,-1,0,-1);</code> sets a[i,0,j]=v.ny&gt;nz ? v[i,j] : v[i], where i=0...(nx-1), j=0...(nz-1) and condition v.nx&gt;=nx is true.
</p></dd></dl>

<dl>
<dt><a name="index-mgl_005fdata_005fset_005fvalue"></a><u>C function:</u> <code>void</code> <b>mgl_data_set_value</b><i> (<code>HMDT</code> dat, <code>float</code> v, <code>int</code> i, <code>int</code> j, <code>int</code> k)</i></dt>
<dd><p>Sets the value in specified cell of the data with border checking.
</p></dd></dl>

<dl>
<dt><a name="index-mgl_005fdata_005fget_005fvalue"></a><u>C function:</u> <code>float</code> <b>mgl_data_get_value</b><i> (<code>HMDT</code> dat, <code>int</code> i, <code>int</code> j, <code>int</code> k)</i></dt>
<dd><p>Gets the value in specified cell of the data with border checking.
</p></dd></dl>

<dl>
<dt><a name="index-GetNx"></a><u>Method on <code>mglData</code> (C+, Python):</u> <code>void</code> <b>GetNx</b><i> ()</i></dt>
<dt><a name="index-mgl_005fdata_005fget_005fnx"></a><u>C function:</u> <code>float</code> <b>mgl_data_get_nx</b><i> (<code>HMDT</code> dat)</i></dt>
<dd><p>Gets the x-size of the data.
</p></dd></dl>

<dl>
<dt><a name="index-GetNy"></a><u>Method on <code>mglData</code> (C+, Python):</u> <code>void</code> <b>GetNy</b><i> ()</i></dt>
<dt><a name="index-mgl_005fdata_005fget_005fny"></a><u>C function:</u> <code>float</code> <b>mgl_data_get_ny</b><i> (<code>HMDT</code> dat)</i></dt>
<dd><p>Gets the y-size of the data.
</p></dd></dl>

<dl>
<dt><a name="index-GetNz"></a><u>Method on <code>mglData</code> (C+, Python):</u> <code>void</code> <b>GetNz</b><i> ()</i></dt>
<dt><a name="index-mgl_005fdata_005fget_005fnz"></a><u>C function:</u> <code>float</code> <b>mgl_data_get_nz</b><i> (<code>HMDT</code> dat)</i></dt>
<dd><p>Gets the z-size of the data.
</p></dd></dl>

<hr size="6">
<a name="Rearrange"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Fill" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#File-I_002fO" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_7.html#Other-classes" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_12.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Rearrange-1"></a>
<h2 class="section">6.4 Rearrange</h2>
<a name="index-Rearrange"></a>
<a name="index-Extend"></a>
<a name="index-Transpose"></a>
<a name="index-Squeeze"></a>
<a name="index-Crop"></a>
<a name="index-InsertRows"></a>
<a name="index-InsertColumns"></a>
<a name="index-InsertSlices"></a>
<a name="index-DeleteRows"></a>
<a name="index-DeleteColumns"></a>
<a name="index-DeleteSlices"></a>
<a name="index-Insert"></a>
<a name="index-Delete"></a>

<dl>
<dt><a name="index-Rearrange-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Rearrange</b><i> (<code>int</code> mx, <code>int</code> my=<code>0</code>, <code>int</code> mz=<code>0</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005frearrange"></a><u>C function:</u> <code>void</code> <b>mgl_data_rearrange</b><i> (<code>HMDT</code> dat, <code>int</code> mx, <code>int</code> my, <code>int</code> mz)</i></dt>
<dd><p>Rearrange dimensions without changing data array so that resulting sizes should  be <var>mx</var>*<var>my</var>*<var>mz</var> &lt; nx*ny*nz. If some of parameter <var>my</var> or <var>mz</var> are zero then it will be selected to optimal fill of data array. For example, if <var>my</var>=0 then it will be change to <var>my</var>=nx*ny*nz/<var>mx</var> and <var>mz</var> will be 1.
</p></dd></dl>
<dl>
<dt><a name="index-Extend-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Extend</b><i> (<code>int</code> n1, <code>int</code> n2=<code>0</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005fextend"></a><u>C function:</u> <code>void</code> <b>mgl_data_extend</b><i> (<code>HMDT</code> dat, <code>int</code> n1, <code>int</code> n2)</i></dt>
<dd><p>Increase the dimensions of the data by inserting new (|<var>n1</var>|+1)-th slices after (for <var>n1</var>&gt;0) or before (for <var>n1</var>&lt;0) of existed one. It is possible to insert 2 dimensions simultaneously for 1d data by using parameter <var>n2</var>. Data to new slices is copy from existed one. For example, for <var>n1</var>&gt;0 new array will be 
a_ij^new = a_i^old where j=0...<var>n1</var>. Correspondingly, for <var>n1</var>&lt;0 new array will be a_ij^new = a_j^old where i=0...|<var>n1</var>|.
</p></dd></dl>
<dl>
<dt><a name="index-Transpose-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Transpose</b><i> (<code>const char *</code>dim=<code>&quot;yx&quot;</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005ftranspose"></a><u>C function:</u> <code>void</code> <b>mgl_data_transpose</b><i> (<code>const char *</code>dim)</i></dt>
<dd><p>Transposes (shift order of) dimensions of the data. New order of dimensions is specified int string <var>dim</var>. This function may be useful also for the reading of one-dimensional data.
</p></dd></dl>
<dl>
<dt><a name="index-Squeeze-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Squeeze</b><i> (<code>int</code> rx, <code>int</code> ry=<code>1</code>, <code>int</code> rz=<code>1</code>, <code>bool</code> smooth=<code>false</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005fsqueeze"></a><u>C function:</u> <code>void</code> <b>mgl_data_squeeze</b><i> (<code>HMDT</code> dat, <code>int</code> rx, <code>int</code> ry, <code>int</code> rz, <code>int</code> smooth)</i></dt>
<dd><p>Reduces the data size by excluding data elements which indexes are not divisible by <var>rx</var>, <var>ry</var>, <var>rz</var> correspondingly. Parameter <var>smooth</var> set to use smoothing
(i.e. out[i]=\sum_{j=i,i+r} a[j]/r) or not (i.e. out[i]=a[j*r]).
</p></dd></dl>

<dl>
<dt><a name="index-Crop-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Crop</b><i> (<code>int</code> n1, <code>int</code> n2, <code>char</code> dir=<code>'x'</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005fcrop"></a><u>C function:</u> <code>void</code> <b>mgl_data_crop</b><i> (<code>HMDT</code> dat, <code>int</code> n1, <code>int</code> n2, <code>char</code> dir)</i></dt>
<dd><p>Cuts off edges of the data <var>i</var>&lt;<var>n1</var> and <var>i</var>&gt;<var>n2</var> if <var>n2</var>&gt;0 or <var>i</var>&gt;<code>n[xyz]</code>-<var>n2</var> if <var>n2</var>&lt;=0 along direction <var>dir</var>.
</p></dd></dl>

<dl>
<dt><a name="index-InsertRows-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>InsertRows</b><i> (<code>int</code> at, <code>int</code> num=<code>1</code>, <code>const char *</code>eq=<code>NULL</code>)</i></dt>
<dd><p>Insert <var>num</var> rows (slice along y-direction) at position <var>at</var> and fill it by formula <var>eq</var> (if <var>eq</var>!=0) or by zeros.
</p></dd></dl>
<dl>
<dt><a name="index-InsertColumns-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>InsertColumns</b><i> (<code>int</code> at, <code>int</code> num=<code>1</code>, <code>const char *</code>eq=<code>NULL</code>)</i></dt>
<dd><p>Insert <var>num</var> columns (slice along x-direction) at position <var>at</var> and fill it by formula <var>eq</var> (if <var>eq</var>!=0) or by zeros.
</p></dd></dl>
<dl>
<dt><a name="index-InsertSlices-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>InsertSlices</b><i> (<code>int</code> at, <code>int</code> num=<code>1</code>, <code>const char *</code>eq=<code>NULL</code>)</i></dt>
<dd><p>Insert <var>num</var> slices (slice along z-direction) at position <var>at</var> and fill it by formula <var>eq</var> (if <var>eq</var>!=0) or by zeros.
</p></dd></dl>

<dl>
<dt><a name="index-DeleteRows-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>DeleteRows</b><i> (<code>int</code> at, <code>int</code> num=<code>1</code>)</i></dt>
<dd><p>Delete <var>num</var> rows (slice along y-direction) at position <var>at</var>.
</p></dd></dl>
<dl>
<dt><a name="index-DeleteColumns-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>DeleteColumns</b><i> (<code>int</code> at, <code>int</code> num=<code>1</code>)</i></dt>
<dd><p>Delete <var>num</var> columns (slice along x-direction) at position <var>at</var>.
</p></dd></dl>
<dl>
<dt><a name="index-DeleteSlices-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>DeleteSlices</b><i> (<code>int</code> at, <code>int</code> num=<code>1</code>)</i></dt>
<dd><p>Delete <var>num</var> slices (slice along z-direction) at position <var>at</var>.
</p></dd></dl>

<dl>
<dt><a name="index-Insert-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Insert</b><i> (<code>char</code> dir, <code>int</code> pos=<code>0</code>, <code>int</code> num=<code>1</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005finsert"></a><u>C function:</u> <code>void</code> <b>mgl_data_insert</b><i> (<code>HMDT</code> dat, <code>char</code> dir, <code>int</code> pos, <code>char</code> num)</i></dt>
<dd><p>Insert <var>num</var> slices along <var>dir</var>-direction at position <var>pos</var> and fill it by zeros.
</p></dd></dl>
<dl>
<dt><a name="index-Delete-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Delete</b><i> (<code>char</code> dir, <code>int</code> pos=<code>0</code>, <code>int</code> num=<code>1</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005fdelete"></a><u>C function:</u> <code>void</code> <b>mgl_data_delete</b><i> (<code>HMDT</code> dat, <code>char</code> dir, <code>int</code> pos, <code>char</code> num)</i></dt>
<dd><p>Delete <var>num</var> slices along <var>dir</var>-direction at position <var>pos</var>.
</p></dd></dl>

<hr size="6">
<a name="File-I_002fO"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Rearrange" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Make-another-data" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_7.html#Other-classes" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_12.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="File-I_002fO-1"></a>
<h2 class="section">6.5 File I/O</h2>
<a name="index-Read"></a>
<dl>
<dt><a name="index-Read-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Read</b><i> (<code>const char *</code>fname)</i></dt>
<dt><a name="index-mgl_005fdata_005fread"></a><u>C function:</u> <code>void</code> <b>mgl_data_read</b><i> (<code>HMDT</code> dat, <code>const char *</code>fname)</i></dt>
<dd><p>Reads data from tab-separated text file with auto determining sizes of the data.
</p></dd></dl>
<dl>
<dt><a name="index-Read-2"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Read</b><i> (<code>const char *</code>fname, <code>int</code> mx, <code>int</code> my=<code>1</code>, <code>int</code> mz=<code>1</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005fread_005fdim"></a><u>C function:</u> <code>void</code> <b>mgl_data_read_dim</b><i> (<code>HMDT</code> dat, <code>const char *</code>fname, <code>int</code> mx, <code>int</code> my, <code>int</code> mz)</i></dt>
<dd><p>Reads data from text file with specified data sizes. This function does nothing if one of parameters <var>mx</var>, <var>my</var> or <var>mz</var> is zero or negative.
</p></dd></dl>
<a name="index-ReadMat"></a>
<dl>
<dt><a name="index-ReadMat-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>ReadMat</b><i> (<code>const char *</code>fname, <code>int</code> dim=<code>2</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005fread_005fmat"></a><u>C function:</u> <code>void</code> <b>mgl_data_read_mat</b><i> (<code>HMDT</code> dat, <code>const char *</code>fname, <code>int</code> dim)</i></dt>
<dd><p>Read data from text file with size specified at beginning of the file by first <var>dim</var> numbers. At this, variable <var>dim</var> set data dimensions.
</p></dd></dl>

<a name="index-ReadRange"></a>
<dl>
<dt><a name="index-ReadRange-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>ReadRange</b><i> (<code>const char *</code>templ, <code>float</code> from, <code>float</code> to, <code>float</code> step=<code>1.f</code>, <code>bool</code> as_slice=<code>false</code>)</i></dt>
<dd><p>Join data arrays from several text files. The file names are determined by function call <code>sprintf(fname,templ,val);</code>, where <var>val</var> changes from <var>from</var> to <var>to</var> with step <var>step</var>. The data load one-by-one in the same slice if <var>as_slice</var>=<code>false</code> or as slice-by-slice if <var>as_slice</var>=<code>true</code>.
</p></dd></dl>
<a name="index-ReadAll"></a>
<dl>
<dt><a name="index-ReadAll-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>ReadAll</b><i> (<code>const char *</code>templ, <code>bool</code> as_slice=<code>false</code>)</i></dt>
<dd><p>Join data arrays from several text files which filenames satisfied the template <var>templ</var> (for example, <var>templ</var>=<code>&quot;t_*.dat&quot;</code>). The data load one-by-one in the same slice if <var>as_slice</var>=<code>false</code> or as slice-by-slice if <var>as_slice</var>=<code>true</code>.
</p></dd></dl>

<a name="index-Save"></a>
<dl>
<dt><a name="index-Save-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Save</b><i> (<code>const char *</code>fname, <code>int</code> ns=<code>-1</code>) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fsave"></a><u>C function:</u> <code>void</code> <b>mgl_data_save</b><i> (<code>const HMDT</code> dat, <code>const char *</code>fname, <code>int</code> ns)</i></dt>
<dd><p>Saves the whole data array (for <var>ns</var>=<code>-1</code>) or only <var>ns</var>-th slice to text file.
</p></dd></dl>

<a name="index-ReadHDF"></a>
<dl>
<dt><a name="index-ReadHDF-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>ReadHDF</b><i> (<code>const char *</code>fname, <code>const char *</code>dname)</i></dt>
<dd><p>Reads data array named <var>dname</var> from HDF5 or HDF4 file. This function does nothing if NO_HDF5|NO_HDF4 was defined during library compilation.
</p></dd></dl>
<a name="index-SaveHDF"></a>
<dl>
<dt><a name="index-SaveHDF-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>SaveHDF</b><i> (<code>const char *</code>fname, <code>const char *</code>dname, <code>bool</code> rewrite=<code>false</code>) <code>const</code></i></dt>
<dd><p>Saves data array named <var>dname</var> from HDF5 or HDF4 file. This function does nothing if NO_HDF5|NO_HDF4 was defined during library compilation.
</p></dd></dl>

<a name="index-Import"></a>
<dl>
<dt><a name="index-Import-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Import</b><i> (<code>const char *</code>fname, <code>const char *</code>scheme, <code>float</code> v1=<code>0</code>, float v2=<code>1</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005fimport"></a><u>C function:</u> <code>void</code> <b>mgl_data_import</b><i> (<code>HMDT</code> dat, <code>const char *</code>fname, <code>const char *</code>scheme, <code>float</code> v1, float v2)</i></dt>
<dd><p>Reads data from bitmap file (now support only PNG format). The RGB values of bitmap pixels are transformed to float values in range [<var>v1</var>, <var>v2</var>] using color scheme <var>scheme</var> (see section <a href="mathgl_en_1.html#Color-scheme">Color scheme</a>).
</p></dd></dl>
<a name="index-Export"></a>
<dl>
<dt><a name="index-Export-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Export</b><i> (<code>const char *</code>fname, <code>const char *</code>scheme, <code>float</code> v1=<code>0</code>, float v2=<code>0</code>, <code>int</code> ns=<code>-1</code>) const</i></dt>
<dt><a name="index-mgl_005fdata_005fexport"></a><u>C function:</u> <code>void</code> <b>mgl_data_export</b><i> (<code>HMDT</code> dat, <code>const char *</code>fname, <code>const char *</code>scheme, <code>float</code> v1, float v2, <code>int</code> ns) const</i></dt>
<dd><p>Saves data matrix (or <code>ns</code>-th slice for 3d data) to bitmap file (now support only PNG format). The data values are transformed from range [<var>v1</var>, <var>v2</var>] to RGB pixels of bitmap using color scheme <var>scheme</var> (see section <a href="mathgl_en_1.html#Color-scheme">Color scheme</a>). If <var>v1</var>&gt;=<var>v2</var> then the values of <var>v1</var>, <var>v2</var> are automatically determined as minimal and maximal value of the data array.
</p></dd></dl>

<hr size="6">
<a name="Make-another-data"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#File-I_002fO" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Change-data" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_7.html#Other-classes" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_12.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Make-another-data-1"></a>
<h2 class="section">6.6 Make another data</h2>

<a name="index-SubData"></a>
<dl>
<dt><a name="index-SubData-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>mglData</code> <b>SubData</b><i> (<code>int</code> xx, <code>int</code> yy=<code>-1</code>, <code>int</code> zz=<code>-1</code>) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fsubdata"></a><u>C function:</u> <code>HMDT</code> <b>mgl_data_subdata</b><i> (<code>const HMDT</code> dat, <code>int</code> xx, <code>int</code> yy, <code>int</code> zz)</i></dt>
<dd><p>Extracts sub-array data from the original data array keeping fixed positive index. For example <code>SubData(-1,2)</code> extracts 3d row (indexes are zero based), <code>SubData(4,-1)</code> extracts 5th column, <code>SubData(-1,-1,3)</code> extracts 4th slice and so on.
</p></dd></dl>

<dl>
<dt><a name="index-SubData-2"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>mglData</code> <b>SubData</b><i> (<code>const mglData &amp;</code>xx, <code>const mglData &amp;</code>yy, <code>const mglData &amp;</code>zz) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fsubdata_005fext"></a><u>C function:</u> <code>HMDT</code> <b>mgl_data_subdata_ext</b><i> (<code>const HMDT</code> dat, <code>const HMDT</code> xx, <code>const HMDT</code> yy, <code>const HMDT</code> zz)</i></dt>
<dd><p>Extracts sub-array data from the original data array for indexes specified by arrays <var>xx</var>, <var>yy</var>, <var>zz</var> (indirect access). The resulting array have the same dimensions as input arrays for 2D and 3D arguments. This function work like previous one for 1D arguments (or numbers). The dimensions of all argument must be the same if they are 2D or 3D arrays.
</p></dd></dl>

<a name="index-Column"></a>
<dl>
<dt><a name="index-Column-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>mglData</code> <b>Column</b><i> (<code>const char *</code>eq) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fcolumn"></a><u>C function:</u> <code>HMDT</code> <b>mgl_data_column</b><i> (<code>const HMDT</code> dat, <code>const char *</code>eq)</i></dt>
<dd><p>Get column (or slice) of the data filled by formula <var>eq</var> of other named columns. For example, <code>Column(&quot;n*w^2/exp(t)&quot;);</code>. The column ids must be defined first by <code>SetColumnId()</code> function.
</p></dd></dl>

<a name="index-SetColumnId"></a>
<dl>
<dt><a name="index-SetColumnId-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>SetColumnId</b><i> (<code>const char *</code>ids)</i></dt>
<dt><a name="index-mgl_005fdata_005fset_005fid"></a><u>C function:</u> <code>void</code> <b>mgl_data_set_id</b><i> (<code>HMDT</code> dat, <code>const char *</code>ids)</i></dt>
<dd><p>Set the symbol id for data columns. The string must contain one symbol &rsquo;a&rsquo;...&rsquo;z&rsquo; per column (without spaces).
</p></dd></dl>

<a name="index-Trace"></a>
<dl>
<dt><a name="index-Trace-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>mglData</code> <b>Trace</b><i> () <code>const</code></i></dt>
<dd><p>Gets array of diagonal elements a[i,i] (for 2D case) or a[i,i,i] (for 3D case) where i=0...nx-1. Function return copy of itself for 1D case. Data array must have dimensions ny,nz &gt;= nx or ny,nz = 1.
</p></dd></dl>

<a name="index-Hist-4"></a>
<dl>
<dt><a name="index-Hist-5"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>mglData</code> <b>Hist</b><i> (<code>int</code> n, <code>float</code> v1=<code>0</code>, <code>float</code> v2=<code>1</code>, <code>int</code> nsub=<code>0</code>) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fhist"></a><u>C function:</u> <code>HMDT</code> <b>mgl_data_hist</b><i> (<code>const HMDT</code> dat, <code>int</code> n, <code>float</code> v1, <code>float</code> v2, <code>int</code> nsub)</i></dt>
<dd><p>Creates <var>n</var>-th points distribution of the data values in range [<var>v1</var>, <var>v2</var>]. Parameter <var>nsub</var> define the number of additional interpolated points (for smoothness of histogram).
</p></dd></dl>
<dl>
<dt><a name="index-Hist-6"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>mglData</code> <b>Hist</b><i> (<code>const mglData &amp;</code>w, <code>int</code> n, <code>float</code> v1=<code>0</code>, <code>float</code> v2=<code>1</code>, <code>int</code> nsub=<code>0</code>) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fhist_005fw"></a><u>C function:</u> <code>HMDT</code> <b>mgl_data_hist_w</b><i> (<code>const HMDT</code> dat, <code>const HMDT</code> w, <code>int</code> n, <code>float</code> v1, <code>float</code> v2, <code>int</code> nsub)</i></dt>
<dd><p>Creates <var>n</var>-th points distribution of the data values in range [<var>v1</var>, <var>v2</var>]. Array <var>w</var> specifies weights of the data elements. Parameter <var>nsub</var> define the number of additional interpolated points (for smoothness of histogram).
</p></dd></dl>

<a name="index-Momentum"></a>
<dl>
<dt><a name="index-Momentum-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>mglData</code> <b>Momentum</b><i> (<code>char</code> dir, <code>const char *</code>how) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fmomentum"></a><u>C function:</u> <code>HMDT</code> <b>mgl_data_momentum</b><i> (<code>const HMDT</code> dat, <code>char</code> dir, <code>const char *</code>how)</i></dt>
<dd><p>Get momentum (1D-array) of the data along direction <var>dir</var>. String <var>how</var> contain kind of momentum. The momentum is defined like as
res_k = \sum_ij how(x_i,y_j,z_k) a_ij/ \sum_ij a_ij
if <var>var</var>=&lsquo;<samp>z</samp>&rsquo; and so on. Coordinates &lsquo;<samp>x</samp>&rsquo;, &lsquo;<samp>y</samp>&rsquo;, &lsquo;<samp>z</samp>&rsquo; are data indexes normalized in range [0,1].
</p></dd></dl>

<a name="index-Sum"></a>
<dl>
<dt><a name="index-Sum-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>mglData</code> <b>Sum</b><i> (<code>const char *</code>dir) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fsum"></a><u>C function:</u> <code>HMDT</code> <b>mgl_data_sum</b><i> (<code>const HMDT</code> dat, <code>const char *</code>dir)</i></dt>
<dd><p>Gets array which is the result of summation in given direction or direction(s).
</p></dd></dl>
<a name="index-Max-1"></a>
<dl>
<dt><a name="index-Max-2"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>mglData</code> <b>Max</b><i> (<code>const char *</code>dir) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fmax_005fdir"></a><u>C function:</u> <code>HMDT</code> <b>mgl_data_max_dir</b><i> (<code>const HMDT</code> dat, <code>const char *</code>dir)</i></dt>
<dd><p>Gets array which is the maximal data values in given direction or direction(s).
</p></dd></dl>
<a name="index-Min-1"></a>
<dl>
<dt><a name="index-Min-2"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>mglData</code> <b>Min</b><i> (<code>const char *</code>dir) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fmin_005fdir"></a><u>C function:</u> <code>HMDT</code> <b>mgl_data_min_dir</b><i> (<code>const HMDT</code> dat, <code>const char *</code>dir)</i></dt>
<dd><p>Gets array which is the maximal data values in given direction or direction(s).
</p></dd></dl>

<a name="index-Combine"></a>
<dl>
<dt><a name="index-Combine-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>mglData</code> <b>Combine</b><i> (<code>const mglData &amp;</code>a) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fcombine"></a><u>C function:</u> <code>HMDT</code> <b>mgl_data_combine</b><i> (<code>const HMDT</code> dat, <code>const HMDT</code> a)</i></dt>
<dd><p>Return direct multiplication of arrays (like, res[i,j] = this[i]*a[j] and so on).
</p></dd></dl>

<a name="index-Evaluate"></a>
<dl>
<dt><a name="index-Evaluate-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>mglData</code> <b>Evaluate</b><i> (<code>const mglData &amp;</code>idat, <code>bool</code> norm=<code>true</code>) <code>const</code></i></dt>
<dt><a name="index-Evaluate-2"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>mglData</code> <b>Evaluate</b><i> (<code>const mglData &amp;</code>idat, <code>const mglData &amp;</code>jdat, <code>bool</code> norm=<code>true</code>) <code>const</code></i></dt>
<dt><a name="index-Evaluate-3"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>mglData</code> <b>Evaluate</b><i> (<code>const mglData &amp;</code>idat, <code>const mglData &amp;</code>jdat, <code>const mglData &amp;</code>kdat, <code>bool</code> norm=<code>true</code>) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fevaluate_005fi"></a><u>C function:</u> <code>HMDT</code> <b>mgl_data_evaluate_i</b><i> (<code>const HMDT</code> dat, <code>const HMDT</code> idat, <code>int</code> norm)</i></dt>
<dt><a name="index-mgl_005fdata_005fevaluate_005fij"></a><u>C function:</u> <code>HMDT</code> <b>mgl_data_evaluate_ij</b><i> (<code>const HMDT</code> dat, <code>const HMDT</code> idat, <code>const HMDT</code> jdat, <code>int</code> norm)</i></dt>
<dt><a name="index-mgl_005fdata_005fevaluate_005fijk"></a><u>C function:</u> <code>HMDT</code> <b>mgl_data_evaluate_ijk</b><i> (<code>const HMDT</code> dat, <code>const HMDT</code> idat, <code>const HMDT</code> jdat, <code>const HMDT</code> kdat, <code>int</code> norm)</i></dt>
<dd><p>Get array which values is result of interpolation of original array for coordinates from other arrays. All dimensions must be the same for data <var>idat</var>, <var>jdat</var>, <var>kdat</var>. Coordinates from <var>idat</var>, <var>jdat</var>, <var>kdat</var> are supposed to be normalized in range [0,1] (if <var>norm</var>=<code>true</code>) or in ranges [0,nx], [0,ny], [0,nz] correspondingly.
</p></dd></dl>

<a name="index-Resize"></a>
<dl>
<dt><a name="index-Resize-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>mglData</code> <b>Resize</b><i> (<code>int</code> mx, <code>int</code> my=<code>1</code>, <code>int</code> mz=<code>1</code>, <code>float</code> x1=<code>0</code>, <code>float</code> x2=<code>1</code>, <code>float</code> y1=<code>0</code>, <code>float</code> y2=<code>1</code>, <code>float</code> z1=<code>0</code>, <code>float</code> z2=<code>1</code>) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fresize"></a><u>C function:</u> <code>HMDT</code> <b>mgl_data_resize</b><i> (<code>const HMDT</code> dat, <code>int</code> mx, <code>int</code> my, <code>int</code> mz)</i></dt>
<dt><a name="index-mgl_005fdata_005fresize_005fbox"></a><u>C function:</u> <code>HMDT</code> <b>mgl_data_resize_box</b><i> (<code>const HMDT</code> dat, <code>int</code> mx, <code>int</code> my, <code>int</code> mz, <code>float</code> x1, <code>float</code> x2, <code>float</code> y1, <code>float</code> y2, <code>float</code> z1, <code>float</code> z2)</i></dt>
<dd><p>Resizes the data to new size <var>mx</var>, <var>my</var>, <var>mz</var> from box (part) [<var>x1</var>,<var>x2</var>] x [<var>y1</var>,<var>y2</var>] x [<var>z1</var>,<var>z2</var>] of original array. Initially x,y,z coordinates are supposed to be in [0,1].
</p></dd></dl>

<hr size="6">
<a name="Change-data"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Make-another-data" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Interpolation" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_7.html#Other-classes" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_12.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Change-data-1"></a>
<h2 class="section">6.7 Change data</h2>

<p>These functions change the data in some direction like differentiations, integrations and so on. The direction in which the change will applied is specified by the string parameter, which may contain &lsquo;<samp>x</samp>&rsquo;, &lsquo;<samp>y</samp>&rsquo; or &lsquo;<samp>z</samp>&rsquo; characters for 1-st, 2-nd and 3-d dimension correspondengly.
</p>
<a name="index-CumSum"></a>
<dl>
<dt><a name="index-CumSum-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>CumSum</b><i> (<code>const char *</code>dir)</i></dt>
<dt><a name="index-mgl_005fdata_005fcumsum"></a><u>C function:</u> <code>void</code> <b>mgl_data_cumsum</b><i> (<code>HMDT</code> dat, <code>const char *</code>dir)</i></dt>
<dd><p>Cumulative summation of the data in given direction or directions.
</p></dd></dl>

<a name="index-Integral"></a>
<dl>
<dt><a name="index-Integral-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Integral</b><i> (<code>const char *</code>dir)</i></dt>
<dt><a name="index-mgl_005fdata_005fintegral"></a><u>C function:</u> <code>void</code> <b>mgl_data_integral</b><i> (<code>HMDT</code> dat, <code>const char *</code>dir)</i></dt>
<dd><p>Integrates (like cumulative summation) the data in given direction or directions.
</p></dd></dl>

<a name="index-Diff"></a>
<dl>
<dt><a name="index-Diff-1"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Diff</b><i> (<code>const char *</code>dir)</i></dt>
<dt><a name="index-mgl_005fdata_005fdiff"></a><u>Функция С:</u> <code>void</code> <b>mgl_data_diff</b><i> (<code>HMDT</code> dat, <code>const char *</code>dir)</i></dt>
<dd><p>Differentiates the data in given direction or directions.
</p></dd></dl>

<dl>
<dt><a name="index-Diff-2"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Diff</b><i> (<code>const mglData &amp;</code>x, <code>const mglData &amp;</code>y)</i></dt>
<dt><a name="index-Diff-3"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Diff</b><i> (<code>const mglData &amp;</code>x, <code>const mglData &amp;</code>y, <code>const mglData &amp;</code>z)</i></dt>
<dt><a name="index-mgl_005fdata_005fdiff_005fpar"></a><u>Функция С:</u> <code>void</code> <b>mgl_data_diff_par</b><i> (<code>HMDT</code> dat, <code>const HMDT</code> x, <code>const HMDT</code>y, <code>const HMDT</code>z)</i></dt>
<dd><p>Differentiates the data specified parametrically in direction <var>x</var> with <var>y</var>, <var>z</var>=constant. Parametrical differentiation uses the formula (for 2D case): <em>da/dx = (a_j*y_i-a_i*y_j)/(x_j*y_i-x_i*y_j)</em> where <em>a_i=da/di, a_j=da/dj</em> denotes usual differentiation along 1st and 2nd dimensions. The similar formula is used for 3D case. Note, that you may change the order of arguments &ndash; for example, if you have 2D data a(i,j) which depend on coordinates {x(i,j), y(i,j)} then usual derivative along &lsquo;<samp>x</samp>&rsquo; will be <code>Diff(x,y);</code> and usual derivative along &lsquo;<samp>y</samp>&rsquo; will be <code>Diff(y,x);</code>.
</p></dd></dl>


<a name="index-Diff2"></a>
<dl>
<dt><a name="index-Diff2-1"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Diff2</b><i> (<code>const char *</code>dir)</i></dt>
<dt><a name="index-mgl_005fdata_005fdiff2"></a><u>Функция С:</u> <code>void</code> <b>mgl_data_diff2</b><i> (<code>const char *</code>dir)</i></dt>
<dd><p>Double-differentiates (like Laplace operator) the data in given direction.
</p></dd></dl>

<a name="index-SinFFT"></a>
<dl>
<dt><a name="index-SinFFT-1"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>void</code> <b>SinFFT</b><i> (<code>const char *</code>dir)</i></dt>
<dt><a name="index-mgl_005fdata_005fsinfft"></a><u>Функция С:</u> <code>void</code> <b>mgl_data_sinfft</b><i> (<code>HMDT</code> dat, <code>const char *</code>dir)</i></dt>
<dd><p>Do Sine transform of the data in given direction or directions. The Sine transform is <em>\sum a_i \sin(k i)</em>.
</p></dd></dl>

<a name="index-CosFFT"></a>
<dl>
<dt><a name="index-CosFFT-1"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>void</code> <b>CosFFT</b><i> (<code>const char *</code>dir)</i></dt>
<dt><a name="index-mgl_005fdata_005fcosfft"></a><u>Функция С:</u> <code>void</code> <b>mgl_data_cosfft</b><i> (<code>HMDT</code> dat, <code>const char *</code>dir)</i></dt>
<dd><p>Do Cosine transform of the data in given direction or directions. The Cosine transform is <em>\sum a_i \cos(k i)</em>.
</p></dd></dl>

<a name="index-Hankel"></a>
<dl>
<dt><a name="index-Hankel-1"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Hankel</b><i> (<code>const char *</code>dir)</i></dt>
<dt><a name="index-mgl_005fdata_005fhankel"></a><u>Функция С:</u> <code>void</code> <b>mgl_data_hankel</b><i> (<code>HMDT</code> dat, <code>const char *</code>dir)</i></dt>
<dd><p>Do Hankel transform of the data in given direction or directions. The Hankel transform is <em>\sum a_i J_0(k i)</em>.
</p></dd></dl>


<a name="index-Swap"></a>
<dl>
<dt><a name="index-Swap-1"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Swap</b><i> (<code>const char *</code>dir)</i></dt>
<dt><a name="index-mgl_005fdata_005fswap"></a><u>Функция С:</u> <code>void</code> <b>mgl_data_swap</b><i> (<code>HMDT</code> dat, <code>const char *</code>dir)</i></dt>
<dd><p>Swaps the left and right part of the data in given direction (useful for Fourier spectrum).
</p></dd></dl>

<a name="index-Roll"></a>
<dl>
<dt><a name="index-Roll-1"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Roll</b><i> (<code>char</code> dir, <code>num</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005froll"></a><u>Функция С:</u> <code>void</code> <b>mgl_data_roll</b><i> (<code>HMDT</code> dat, <code>char</code> dir, <code>num</code>)</i></dt>
<dd><p>Rolls the data along direction <var>dir</var>. Resulting array will be out[i] = ini[(i+num)%nx] if <code>dir='x'</code>.
</p></dd></dl>

<a name="index-Mirror"></a>
<dl>
<dt><a name="index-Mirror-1"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Mirror</b><i> (<code>const char *</code>dir)</i></dt>
<dt><a name="index-mgl_005fdata_005fmirror"></a><u>Функция С:</u> <code>void</code> <b>mgl_data_mirror</b><i> (<code>HMDT</code> dat, <code>const char *</code>dir)</i></dt>
<dd><p>Mirror the left-to-right part of the data in given direction. Looks like change the value index <var>i</var>-&gt;<var>n-i</var>.
</p></dd></dl>

<a name="index-Sew"></a>
<dl>
<dt><a name="index-Sew-1"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Sew</b><i> (<code>const char *</code>dir, <code>float</code> da=<code>2*M_PI</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005fsew"></a><u>Функция С:</u> <code>void</code> <b>mgl_data_sew</b><i> (<code>HMDT</code> dat, <code>const char *</code>dir, <code>float</code> da)</i></dt>
<dd><p>Remove value steps (like phase jumps after inverse trigonometric functions) with period <var>da</var> in given direction.
</p></dd></dl>

<a name="index-Smooth"></a>
<dl>
<dt><a name="index-Smooth-1"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Smooth</b><i> (<code>int</code> Type, <code>const char *</code>dir, <code>float</code> delta=<code>0</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005fsmooth"></a><u>Функция С:</u> <code>void</code> <b>mgl_data_smooth</b><i> (<code>HMDT</code> dat, <code>int</code> Type, <code>float</code> delt, <code>const char *</code>dirs)</i></dt>
<dd><p>Smooths the data on specified direction or directions by method <var>Type</var>. Now 4 methods are supported: <code>SMOOTH_NONE</code> does nothing for <var>delta</var>=0 or approaches data to zero with the step <var>delta</var>, <code>SMOOTH_LINE_3</code> linear averaging by 3 points, <code>SMOOTH_LINE_5</code> linear averaging by 5 points, <code>SMOOTH_QUAD_5</code> quadratic averaging by 5 points. Parameter <var>delta</var> forbids to change values of array more than <var>delta</var> from the original ones. String <var>dirs</var> specifies the dimensions which will be smoothed. It may contain characters: &rsquo;x&rsquo; for 1st dimension, &rsquo;y&rsquo; for 2nd dimension, &rsquo;z&rsquo; for 3d dimension.
</p></dd></dl>
<dl>
<dt><a name="index-Smooth-2"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Smooth</b><i> (<code>const char *</code>dir)</i></dt>
<dd><p>Smooths the data on specified direction(s). This is the same as <code>Smooth()</code> but argument <var>Type</var> is specified in string as &lsquo;<samp>0</samp>&rsquo; for <code>SMOOTH_NONE</code>, &lsquo;<samp>3</samp>&rsquo; for <code>SMOOTH_LINE_3</code>, &lsquo;<samp>5</samp>&rsquo; for <code>SMOOTH_LINE_5</code>. If string <var>dir</var> don&rsquo;t contain digits &lsquo;<samp>035</samp>&rsquo; then <var>Type</var>=<code>SMOOTH_QUAD_5</code> is used.
</p></dd></dl>

<a name="index-Envelop"></a>
<dl>
<dt><a name="index-Envelop-1"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Envelop</b><i> (<code>char</code> dir=<code>'x'</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005fenvelop"></a><u>Функция С:</u> <code>void</code> <b>mgl_data_envelop</b><i> (<code>HMDT</code> dat, <code>char</code> dir)</i></dt>
<dd><p>Find envelop for data values along direction <var>dir</var>.
</p></dd></dl>

<a name="index-Norm"></a>
<dl>
<dt><a name="index-Norm-1"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>void</code> <b>Norm</b><i> (<code>float</code> v1=<code>0</code>, <code>float</code> v2=<code>1</code>, <code>bool</code> sym=<code>false</code>, <code>int</code> dim=<code>0</code>)</i></dt>
<dd><p>Normalizes the data to range [<var>v1</var>,<var>v2</var>]. If flag <var>sym</var>=<code>true</code> then symmetrical interval [-max(|v1|,|v2|), max(|v1|,|v2|)] is used. Modification will be applied only for slices &gt;=<var>dim</var>.
</p></dd></dl>

<a name="index-NormSl"></a>
<dl>
<dt><a name="index-NormSl-1"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>void</code> <b>NormSl</b><i> (<code>float</code> v1=<code>0</code>, <code>float</code> v2=<code>1</code>, <code>char</code> dir=<code>'z'</code>, <code>bool</code> keep_en=<code>true</code>, <code>bool</code> sym=<code>false</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005fnorm_005fslice"></a><u>Функция С:</u> <code>void</code> <b>mgl_data_norm_slice</b><i> (<code>HMDT</code> dat, <code>float</code> v1, <code>float</code> v2, <code>char</code> dir, <code>int</code> keep_en, <code>int</code> sym)</i></dt>
<dd><p>Normalizes data slice-by-slice along direction <var>dir</var> the data in slices to range [<var>v1</var>,<var>v2</var>]. If flag <var>sym</var>=<code>true</code> then symmetrical interval [-max(|v1|,|v2|), max(|v1|,|v2|)] is used. If <var>keep_en</var> is set then maximal value of k-th slice will be limited by 
<em>\sqrt\sum a_ij(k)/\sum a_ij(0)</em>.
</p></dd></dl>

<hr size="6">
<a name="Interpolation"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Change-data" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Informational-functions" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_7.html#Other-classes" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_12.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Interpolation-1"></a>
<h2 class="section">6.8 Interpolation</h2>
<a name="index-Spline"></a>
<dl>
<dt><a name="index-Spline-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>float</code> <b>Spline</b><i> (<code>float</code> x, <code>float</code> y=<code>0</code>, <code>float</code> z=<code>0</code>) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fspline"></a><u>C function:</u> <code>float</code> <b>mgl_data_spline</b><i> (<code>const HMDT</code> dat, <code>float</code> x, <code>float</code> y, <code>float</code> z)</i></dt>
<dd><p>Interpolates data by cubic spline to the given point <var>x</var> in [0...nx-1], <var>y</var> in [0...ny-1], <var>z</var> in [0...nz-1].
</p></dd></dl>
<a name="index-Spline1"></a>
<dl>
<dt><a name="index-Spline1-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>float</code> <b>Spline1</b><i> (<code>float</code> x, <code>float</code> y=<code>0</code>, <code>float</code> z=<code>0</code>) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fspline1"></a><u>C function:</u> <code>float</code> <b>mgl_data_spline1</b><i> (<code>const HMDT</code> dat, <code>float</code> x, <code>float</code> y, <code>float</code> z)</i></dt>
<dd><p>Interpolates data by cubic spline to the given point <var>x</var>, <var>y</var>, <var>z</var> which assumed to be normalized in range [0, 1].
</p></dd></dl>
<a name="index-Linear"></a>
<dl>
<dt><a name="index-Linear-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>float</code> <b>Linear</b><i> (<code>float</code> x, <code>float</code> y=<code>0</code>, <code>float</code> z=<code>0</code>) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005flinear"></a><u>C function:</u> <code>float</code> <b>mgl_data_linear</b><i> (<code>const HMDT</code> dat, <code>float</code> x, <code>float</code> y, <code>float</code> z)</i></dt>
<dd><p>Interpolates data by linear function to the given point <var>x</var> in [0...nx-1], <var>y</var> in [0...ny-1], <var>z</var> in [0...nz-1].
</p></dd></dl>
<a name="index-Linear1"></a>
<dl>
<dt><a name="index-Linear1-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>float</code> <b>Linear1</b><i> (<code>float</code> x, <code>float</code> y=<code>0</code>, <code>float</code> z=<code>0</code>) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005flinear1"></a><u>C function:</u> <code>float</code> <b>mgl_data_linear1</b><i> (<code>const HMDT</code> dat, <code>float</code> x, <code>float</code> y, <code>float</code> z)</i></dt>
<dd><p>Interpolates data by linear function to the given point <var>x</var>, <var>y</var>, <var>z</var> which assumed to be normalized in range [0, 1].
</p></dd></dl>
<a name="index-v"></a>
<dl>
<dt><a name="index-v-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>float</code> <b>v</b><i> (<code>int</code> i, <code>int</code> j=<code>0</code>, <code>int</code> k=<code>0</code>) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fget_005fvalue-1"></a><u>C function:</u> <code>float</code> <b>mgl_data_get_value</b><i> (<code>const HMDT</code> dat, <code>int</code> i, <code>int</code> j, <code>int</code> k)</i></dt>
<dd><p>Gets the value in specified cell of the data with border checking.
</p></dd></dl>
<a name="index-Spline5"></a>
<dl>
<dt><a name="index-Spline5-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>float</code> <b>Spline5</b><i> (<code>float</code> x, <code>float</code> y, <code>float</code> z, <code>float</code> &amp;dx, <code>float</code> &amp;dy, <code>float</code> &amp;dz) <code>const</code></i></dt>
<dd><p>Interpolate by 5-th order splain the data to given point <var>x</var>, <var>y</var>, <var>z</var> which normalized in range [0, 1] and evaluate its derivatives.
</p></dd></dl>

<dl>
<dt><a name="index-mgl_005fdata_005fvalue"></a><u>C function:</u> <code>float *</code> <b>mgl_data_value</b><i> (<code>HMDT</code> dat, <code>int</code> i, <code>int</code> j, <code>int</code> k)</i></dt>
<dd><p>Gets the pointer to data element.
</p></dd></dl>
<dl>
<dt><a name="index-mgl_005fdata_005fdata"></a><u>C function:</u> <code>const float *</code> <b>mgl_data_data</b><i> (<code>const HMDT</code> dat)</i></dt>
<dd><p>Gets the pointer to internal data array.
</p></dd></dl>

<hr size="6">
<a name="Informational-functions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Interpolation" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Operators" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_7.html#Other-classes" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_12.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Informational-functions-1"></a>
<h2 class="section">6.9 Informational functions</h2>
<a name="index-PrintInfo"></a>
<dl>
<dt><a name="index-PrintInfo-1"></a><u>Метод класса <code>mglData</code> (C++):</u> <code>void</code> <b>PrintInfo</b><i> (<code>char *</code>buf, <code>bool</code> all=<code>false</code>) <code>const</code></i></dt>
<dd><p>Print information about the data (sizes and momentum) to string <var>buf</var>. Parameter <var>all</var> set to print most of information (if <code>true</code>) or just basic one like dimensions, maximal an minimal values.
</p></dd></dl>
<dl>
<dt><a name="index-PrintInfo-2"></a><u>Метод класса <code>mglData</code> (C++):</u> <code>void</code> <b>PrintInfo</b><i> (<code>FILE *</code>fp) <code>const</code></i></dt>
<dd><p>Print information about the data (sizes and momentum) to FILE (for example, stdout).
</p></dd></dl>

<a name="index-Maximal"></a>
<dl>
<dt><a name="index-Maximal-1"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>float</code> <b>Maximal</b><i> () <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fmax"></a><u>Функция С:</u> <code>float</code> <b>mgl_data_max</b><i> (<code>const HMDT</code> dat)</i></dt>
<dd><p>Gets maximal value of the data.
</p></dd></dl>
<a name="index-Minimal"></a>
<dl>
<dt><a name="index-Minimal-1"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>float</code> <b>Minimal</b><i> () <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fmin"></a><u>Функция С:</u> <code>float</code> <b>mgl_data_min</b><i> (<code>HMDT</code> dat) <code>const</code></i></dt>
<dd><p>Gets minimal value of the data.
</p></dd></dl>

<dl>
<dt><a name="index-Maximal-2"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>float</code> <b>Maximal</b><i> (<code>int</code> &amp;i, <code>int</code> &amp;j, <code>int</code> &amp;k) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fmax_005fint"></a><u>Функция С:</u> <code>float</code> <b>mgl_data_max_int</b><i> (<code>const HMDT</code> dat, <code>int</code> *i, <code>int</code> *j, <code>int</code> *k)</i></dt>
<dd><p>Gets maximal value of the data and its position in the array to variables <var>i</var>, <var>j</var>, <var>k</var>.
</p></dd></dl>
<dl>
<dt><a name="index-Minimal-2"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>float</code> <b>Minimal</b><i> (<code>int</code> &amp;i, <code>int</code> &amp;j, <code>int</code> &amp;k) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fmin_005fint"></a><u>Функция С:</u> <code>float</code> <b>mgl_data_min_int</b><i> (<code>const HMDT</code> dat, <code>int</code> *i, <code>int</code> *j, <code>int</code> *k)</i></dt>
<dd><p>Gets minimal value of the data and its position in the array to variables <var>i</var>, <var>j</var>, <var>k</var>.
</p></dd></dl>
<dl>
<dt><a name="index-Maximal-3"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>float</code> <b>Maximal</b><i> (<code>float</code> &amp;i, <code>float</code> &amp;j, <code>float</code> &amp;k) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fmax_005freal"></a><u>Функция С:</u> <code>float</code> <b>mgl_data_max_real</b><i> (<code>const HMDT</code> dat, <code>float</code> *x, <code>float</code> *y, <code>float</code> *z)</i></dt>
<dd><p>Gets maximal value of the data and its approximated (interpolated) position to variables <var>i</var>, <var>j</var>, <var>k</var>.
</p></dd></dl>
<dl>
<dt><a name="index-Minimal-3"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>float</code> <b>Minimal</b><i> (<code>float</code> &amp;i, <code>float</code> &amp;j, <code>float</code> &amp;k) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fmin_005freal"></a><u>Функция С:</u> <code>float</code> <b>mgl_data_min_real</b><i> (<code>const HMDT</code> dat, <code>float</code> *x, <code>float</code> *y, <code>float</code> *z)</i></dt>
<dd><p>Gets minimal value of the data and its approximated (interpolated) position to variables <var>i</var>, <var>j</var>, <var>k</var>.
</p></dd></dl>

<a name="index-Momentum-2"></a>
<dl>
<dt><a name="index-Momentum-3"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>float</code> <b>Momentum</b><i> (<code>char</code> dir, <code>float</code> &amp;m, <code>float</code> &amp;w) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005fmomentum_005fmw"></a><u>Функция С:</u> <code>float</code> <b>mgl_data_momentum_mw</b><i> (<code>const HMDT</code> dat, <code>char</code> dir, <code>float</code> *m, <code>float</code> *w)</i></dt>
<dd><p>Gets zero-momentum (energy, <em>I=\sum a_i</em>) and write first momentum (median, <em>m = \sum \xi_i a_i/I</em>) and second momentum (width, <em>w^2 = \sum (\xi_i-m)^2 a_i/I</em>) to variables. Here <em>\xi</em> is corresponding coordinate if <var>dir</var> is &lsquo;<samp>'x'</samp>&rsquo;, &lsquo;<samp>'y'</samp>&rsquo; or &lsquo;<samp>'z'</samp>&rsquo;. Otherwise median is <em>m = \sum a_i/N</em>, width is <em>w^2 = \sum (a_i-m)^2/N</em>.
</p></dd></dl>
<dl>
<dt><a name="index-Momentum-4"></a><u>Метод класса <code>mglData</code> (C++):</u> <code>float</code> <b>Momentum</b><i> (<code>char</code> dir, <code>float</code> &amp;m, <code>float</code> &amp;w, <code>float</code> &amp;s, <code>float</code> &amp;k) <code>const</code></i></dt>
<dd><p>Gets zero-momentum (energy, <em>I=\sum a_i</em>) and write first momentum (median, <em>m = \sum \xi_i a_i/I</em>), second momentum (width, <em>w^2 = \sum (\xi_i-m)^2 a_i/I</em>), third momentum (skewness, <em>s = \sum (\xi_i-m)^3 a_i/ I w^3</em>) and fourth momentum (kurtosis, <em>k = \sum (\xi_i-m)^4 a_i / 3 I w^4</em>) to variables. Here <em>\xi</em> is corresponding coordinate if <var>dir</var> is &lsquo;<samp>'x'</samp>&rsquo;, &lsquo;<samp>'y'</samp>&rsquo; or &lsquo;<samp>'z'</samp>&rsquo;. Otherwise median is <em>m = \sum a_i/N</em>, width is <em>w^2 = \sum (a_i-m)^2/N</em> and so on.
</p></dd></dl>

<a name="index-Find"></a>
<dl>
<dt><a name="index-Find-1"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>float</code> <b>Find</b><i> (<code>const char *</code>cond, <code>int</code> &amp;i, <code>int</code> &amp;j, <code>int</code> &amp;k) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005ffirst"></a><u>Функция С:</u> <code>float</code> <b>mgl_data_first</b><i> (<code>const HMDT</code> dat, <code>const char *</code>cond, <code>int</code> *i, <code>int</code> *j, <code>int</code> *k)</i></dt>
<dd><p>Find position (after specified in <var>i</var>, <var>j</var>, <var>k</var>) of first nonzero value of formula <var>cond</var>. Function return the data value at found position.
</p></dd></dl>
<a name="index-Last"></a>
<dl>
<dt><a name="index-Last-1"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>float</code> <b>Last</b><i> (<code>const char *</code>cond, <code>int</code> &amp;i, <code>int</code> &amp;j, <code>int</code> &amp;k) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005flast"></a><u>Функция С:</u> <code>float</code> <b>mgl_data_last</b><i> (<code>const HMDT</code> dat, <code>const char *</code>cond, <code>int</code> *i, <code>int</code> *j, <code>int</code> *k)</i></dt>
<dd><p>Find position (before specified in <var>i</var>, <var>j</var>, <var>k</var>) of last nonzero value of formula <var>cond</var>. Function return the data value at found position.
</p></dd></dl>
<dl>
<dt><a name="index-Find-2"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>int</code> <b>Find</b><i> (<code>const char *</code>cond, <code>char</code> dir, <code>int</code> i=<code>0</code>, <code>int</code> j=<code>0</code>, <code>int</code> k=<code>0</code>) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005ffind"></a><u>Функция С:</u> <code>float</code> <b>mgl_data_find</b><i> (<code>const HMDT</code> dat, <code>const char *</code>cond, <code>int</code> i, <code>int</code> j, <code>int</code> k)</i></dt>
<dd><p>Return position of first in direction <var>dir</var> nonzero value of formula <var>cond</var>. The search is started from point {i,j,k}.
</p></dd></dl>
<a name="index-FindAny"></a>
<dl>
<dt><a name="index-FindAny-1"></a><u>Метод класса <code>mglData</code> (C++, Python):</u> <code>bool</code> <b>FindAny</b><i> (<code>const char *</code>cond) <code>const</code></i></dt>
<dt><a name="index-mgl_005fdata_005ffind_005fany"></a><u>Функция С:</u> <code>float</code> <b>mgl_data_find_any</b><i> (<code>const HMDT</code> dat, <code>const char *</code>cond)</i></dt>
<dd><p>Determines if any nonzero value of formula in the data array.
</p></dd></dl>

<hr size="6">
<a name="Operators"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Informational-functions" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Global-functions" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_7.html#Other-classes" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_12.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Operators-1"></a>
<h2 class="section">6.10 Operators</h2>

<dl>
<dt><a name="index-operator_003d"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>operator=</b><i> (<code>const mglData &amp;</code>d)</i></dt>
<dd><p>Copies data from other variable.
</p></dd></dl>
<dl>
<dt><a name="index-operator_002a_003d"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>operator*=</b><i> (<code>const mglData &amp;</code>d)</i></dt>
<dt><a name="index-mgl_005fdata_005fmul_005fdat"></a><u>C function:</u> <code>void</code> <b>mgl_data_mul_dat</b><i> (<code>HMDT</code> dat, <code>const HMDT</code> d)</i></dt>
<dd><p>Multiplies the data by the other one for each element.
</p></dd></dl>
<dl>
<dt><a name="index-operator_002f_003d"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>operator/=</b><i> (<code>const mglData &amp;</code>d)</i></dt>
<dt><a name="index-mgl_005fdata_005fdiv_005fdat"></a><u>C function:</u> <code>void</code> <b>mgl_data_div_dat</b><i> (<code>HMDT</code> dat, <code>const HMDT</code> d)</i></dt>
<dd><p>Divides the data by the other one for each element.
</p></dd></dl>
<dl>
<dt><a name="index-operator_002b_003d"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>operator+=</b><i> (<code>const mglData &amp;</code>d)</i></dt>
<dt><a name="index-mgl_005fdata_005fadd_005fdat"></a><u>C function:</u> <code>void</code> <b>mgl_data_add_dat</b><i> (<code>HMDT</code> dat, <code>const HMDT</code> d)</i></dt>
<dd><p>Adds the other data.
</p></dd></dl>
<dl>
<dt><a name="index-operator_002d_003d"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>operator-=</b><i> (<code>const mglData &amp;</code>d)</i></dt>
<dt><a name="index-mgl_005fdata_005fsub_005fdat"></a><u>C function:</u> <code>void</code> <b>mgl_data_sub_dat</b><i> (<code>HMDT</code> dat, <code>const HMDT</code> d)</i></dt>
<dd><p>Subtracts the other data.
</p></dd></dl>
<dl>
<dt><a name="index-operator_002a_003d-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>operator*=</b><i> (<code>float</code> d)</i></dt>
<dt><a name="index-mgl_005fdata_005fmul_005fnum"></a><u>C function:</u> <code>void</code> <b>mgl_data_mul_num</b><i> (<code>HMDT</code> dat, <code>float</code> d)</i></dt>
<dd><p>Multiplies each element by the number.
</p></dd></dl>
<dl>
<dt><a name="index-operator_002f_003d-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>operator/=</b><i> (<code>float</code> d)</i></dt>
<dt><a name="index-mgl_005fdata_005fdiv_005fnum"></a><u>C function:</u> <code>void</code> <b>mgl_data_div_num</b><i> (<code>HMDT</code> dat, <code>float</code> d)</i></dt>
<dd><p>Divides each element by the number.
</p></dd></dl>
<dl>
<dt><a name="index-operator_002b_003d-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>operator+=</b><i> (<code>float</code> d)</i></dt>
<dt><a name="index-mgl_005fdata_005fadd_005fnum"></a><u>C function:</u> <code>void</code> <b>mgl_data_add_num</b><i> (<code>HMDT</code> dat, <code>float</code> d)</i></dt>
<dd><p>Adds the number to each element.
</p></dd></dl>
<dl>
<dt><a name="index-operator_002d_003d-1"></a><u>Method on <code>mglData</code> (C++, Python):</u> <code>void</code> <b>operator-=</b><i> (<code>float</code> d)</i></dt>
<dt><a name="index-mgl_005fdata_005fsub_005fnum"></a><u>C function:</u> <code>void</code> <b>mgl_data_sub_num</b><i> (<code>HMDT</code> dat, <code>float</code> d)</i></dt>
<dd><p>Subtracts the number to each element.
</p></dd></dl>


<dl>
<dt><a name="index-operator_002b"></a><u>Library Function:</u> mglData <b>operator+</b><i> (<code>const mglData &amp;</code>a, <code>const mglData &amp;</code>b)</i></dt>
<dd><p>Adds the other data.
</p></dd></dl>
<dl>
<dt><a name="index-operator_002b-1"></a><u>Library Function:</u> mglData <b>operator+</b><i> (<code>float</code> a, <code>const mglData &amp;</code>b)</i></dt>
<dd><p>Adds the number.
</p></dd></dl>
<dl>
<dt><a name="index-operator_002b-2"></a><u>Library Function:</u> mglData <b>operator+</b><i> (<code>const mglData &amp;</code>a, <code>float</code> b)</i></dt>
<dd><p>Adds the number.
</p></dd></dl>

<dl>
<dt><a name="index-operator_002d"></a><u>Library Function:</u> mglData <b>operator-</b><i> (<code>const mglData &amp;</code>a, <code>const mglData &amp;</code>b)</i></dt>
<dd><p>Subtracts the other data.
</p></dd></dl>
<dl>
<dt><a name="index-operator_002d-1"></a><u>Library Function:</u> mglData <b>operator-</b><i> (<code>float</code> a, <code>const mglData &amp;</code>b)</i></dt>
<dd><p>Subtracts from the number.
</p></dd></dl>
<dl>
<dt><a name="index-operator_002d-2"></a><u>Library Function:</u> mglData <b>operator-</b><i> (<code>const mglData &amp;</code>a, <code>float</code> b)</i></dt>
<dd><p>Subtracts the number.
</p></dd></dl>

<dl>
<dt><a name="index-operator_002a"></a><u>Library Function:</u> mglData <b>operator*</b><i> (<code>const mglData &amp;</code>a, <code>const mglData &amp;</code>b)</i></dt>
<dd><p>Multiplies by the other data.
</p></dd></dl>
<dl>
<dt><a name="index-operator_002a-1"></a><u>Library Function:</u> mglData <b>operator*</b><i> (<code>float</code> a, <code>const mglData &amp;</code>b)</i></dt>
<dd><p>Multiplies by the number.
</p></dd></dl>
<dl>
<dt><a name="index-operator_002a-2"></a><u>Library Function:</u> mglData <b>operator*</b><i> (<code>const mglData &amp;</code>a, <code>float</code> b)</i></dt>
<dd><p>Multiplies by the number.
</p></dd></dl>

<dl>
<dt><a name="index-operator_002f"></a><u>Library Function:</u> mglData <b>operator/</b><i> (<code>const mglData &amp;</code>a, <code>const mglData &amp;</code>b)</i></dt>
<dd><p>Divides by the other data.
</p></dd></dl>
<dl>
<dt><a name="index-operator_002f-1"></a><u>Library Function:</u> mglData <b>operator/</b><i> (<code>const mglData &amp;</code>a, <code>float</code> b)</i></dt>
<dd><p>Divides by the number.
</p></dd></dl>

<hr size="6">
<a name="Global-functions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Operators" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_7.html#Other-classes" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#mglData-class" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_7.html#Other-classes" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_12.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Global-functions-1"></a>
<h2 class="section">6.11 Global functions</h2>

<p>These functions are not methods of <code>mglData</code> class. However it have additional functionality to handle data. So I put it in this chapter.
</p>
<dl>
<dt><a name="index-mglTransform"></a><u>Global function:</u> <code>mglData</code> <b>mglTransform</b><i> (<code>const mglData &amp;</code>real, <code>const mglData &amp;</code>imag, <code>const char *</code>type)</i></dt>
<dt><a name="index-mgl_005ftransform"></a><u>C function:</u> <code>HMDT</code> <b>mgl_transform</b><i> (<code>const HMDT</code> real, <code>const HMDT</code> imag, <code>const char *</code>type)</i></dt>
<dd><p>Do integral transformation of complex data <var>real</var>, <var>imag</var> on specified direction. The order of transformations is specified in string <var>type</var>: first character for x-dimension, second one for y-dimension, third one for z-dimension. The possible character are: &lsquo;<samp>f</samp>&rsquo; is forward Fourier transformation, &lsquo;<samp>i</samp>&rsquo; is inverse Fourier transformation, &lsquo;<samp>s</samp>&rsquo; is Sine transform, &lsquo;<samp>c</samp>&rsquo; is Cosine transform, &lsquo;<samp>h</samp>&rsquo; is Hankel transform, &lsquo;<samp>n</samp>&rsquo; or &lsquo;<samp> </samp>&rsquo; is no transformation.
</p></dd></dl>

<dl>
<dt><a name="index-mglTransformA"></a><u>Global function:</u> <code>mglData</code> <b>mglTransformA</b><i> <code>const mglData &amp;</code>ampl, <code>const mglData &amp;</code>phase, <code>const char *</code>type)</i></dt>
<dt><a name="index-mgl_005ftransform_005fa"></a><u>C function:</u> <code>HMDT</code> <b>mgl_transform_a</b><i> <code>const HMDT</code> ampl, <code>const HMDT</code> phase, <code>const char *</code>type)</i></dt>
<dd><p>The same as previous but with specified amplitude <var>ampl</var> and phase <var>phase</var> of complex numbers.
</p></dd></dl>

<dl>
<dt><a name="index-mglSTFA"></a><u>Global function:</u> <code>mglData</code> <b>mglSTFA</b><i> (<code>const mglData &amp;</code>real, <code>const mglData &amp;</code>imag, <code>int</code> dn, <code>char</code> dir=<code>'x'</code>)</i></dt>
<dt><a name="index-mgl_005fdata_005fstfa"></a><u>C function:</u> <code>HMDT</code> <b>mgl_data_stfa</b><i> (<code>const HMDT</code> real, <code>const HMDT</code> imag, <code>int</code> dn,<code>char</code> dir)</i></dt>
<dd><p>Short time Fourier transformation for real and imaginary parts. Output  is amplitude of partial Fourier of length <var>dn</var>. For example if <var>dir</var>=&lsquo;<samp>x</samp>&rsquo;, result will have size {int(nx/dn), dn, ny} and it will contain <em>res[i,j,k]=|\sum_d^dn exp(I*j*d)*(real[i*dn+d,k]+I*imag[i*dn+d,k])|/dn</em>.
</p></dd></dl>

<dl>
<dt><a name="index-mglPDE"></a><u>Global function:</u> <code>mglData</code> <b>mglPDE</b><i> (<code>const char *</code>ham, <code>const mglData &amp;</code>ini_re, <code>const mglData &amp;</code>ini_im, <code>mglPoint</code> Min, <code>mglPoint</code> Max, <code>float</code> dz=<code>0.1</code>, <code>float</code> k0=<code>100</code>)</i></dt>
<dt><a name="index-mgl_005fpde_005fsolve"></a><u>C function:</u> <code>HMDT</code> <b>mgl_pde_solve</b><i> (<code>HMGL</code> gr, <code>const char *</code>ham, <code>const HMDT</code> ini_re, <code>const HMDT</code> ini_im, <code>float</code> dz, <code>float</code> k0)</i></dt>
<dd><p>Solves equation du/dz = i*k0*<var>ham</var>(p,q,x,y,z,|u|)[u], where p=-i/k0*d/dx, q=-i/k0*d/dy are pseudo-differential operators. Parameters <var>ini_re</var>, <var>ini_im</var> specify real and imaginary part of initial field distribution. Parameters <var>Min</var>, <var>Max</var> set the bounding box for the solution. Note, that really this ranges are increased by factor 3/2 for purpose of reducing reflection from boundaries. Parameter <var>dz</var> set the step along evolutionary coordinate z. At this moment, simplified form of function <var>ham</var> is supported &ndash; all &ldquo;mixed&rdquo; terms (like &lsquo;<samp>x*p</samp>&rsquo;-&gt;x*d/dx) are excluded. For example, in 2D case this function is effectively <em>ham = f(p,z) + g(x,z,u)</em>. However commutable combinations (like &lsquo;<samp>x*q</samp>&rsquo;-&gt;x*d/dy) are allowed. Here variable &lsquo;<samp>u</samp>&rsquo; is used for field amplitude |u|. This allow one solve nonlinear problems &ndash; for example, for nonlinear Shrodinger equation you may set <code>ham=&quot;p^2 + q^2 - u^2&quot;</code>. You may specify imaginary part for wave absorption, like <code>ham = &quot;p^2 + i*x*(x&gt;0)&quot;</code>, but only if dependence on variable &lsquo;<samp>i</samp>&rsquo; is linear (i.e. <em>ham = hre+i*him</em>). See section <a href="mathgl_en_9.html#PDE-sample">PDE sample</a>, for sample code and picture.  See section <a href="mathgl_en_9.html#PDE-sample">PDE sample</a>, for sample code and picture.
</p></dd></dl>

<dl>
<dt><a name="index-mglRay"></a><u>Global function:</u> <code>mglData</code> <b>mglRay</b><i> (<code>const char *</code>ham, <code>mglPoint</code> r0, <code>mglPoint</code> p0, <code>float</code> dt=<code>0.1</code>, <code>float</code> tmax=<code>10</code>)</i></dt>
<dt><a name="index-mgl_005fray_005ftrace"></a><u>C function:</u> <code>HMDT</code> <b>mgl_ray_trace</b><i> (<code>const char *</code>ham, <code>float</code> x0, <code>float</code> y0, <code>float</code> z0, <code>float</code> px, <code>float</code> py, <code>float</code> pz, <code>float</code> dt, <code>float</code> tmax)</i></dt>
<dd><p>Solves GO ray equation like dr/dt = d <var>ham</var>/dp, dp/dt = -d <var>ham</var>/dr. This is Hamiltonian equations for particle trajectory in 3D case. Here <var>ham</var> is Hamiltonian which may depend on coordinates &lsquo;<samp>x</samp>&rsquo;, &lsquo;<samp>y</samp>&rsquo;, &lsquo;<samp>z</samp>&rsquo;, momentums &lsquo;<samp>p</samp>&rsquo;=px, &lsquo;<samp>q</samp>&rsquo;=py, &lsquo;<samp>v</samp>&rsquo;=pz and time &lsquo;<samp>t</samp>&rsquo;: <em>ham = H(x,y,z,p,q,v,t)</em>. The starting point (at <code>t=0</code>) is defined by variables <var>r0</var>, <var>p0</var>. Parameters <var>dt</var> and <var>tmax</var> specify the integration step and maximal time for ray tracing. Result is array of {x,y,z,p,q,v,t} with dimensions {7 * int(<var>tmax</var>/<var>dt</var>+1) }. See section <a href="mathgl_en_9.html#Beam-tracing-sample">Beam tracing sample</a>, for sample code and picture.
</p></dd></dl>

<dl>
<dt><a name="index-mglQO2d"></a><u>Global function:</u> <code>mglData</code> <b>mglQO2d</b><i> (<code>const char *</code>ham, <code>const mglData &amp;</code>ini_re, <code>const mglData &amp;</code>ini_im, <code>const mglData &amp;</code>ray, <code>float</code> r=<code>1</code>, <code>float</code> k0=<code>100</code>, <code>mglData *</code>xx=<code>0</code>, <code>mglData *</code>yy=<code>0</code>, <code>bool</code> UseR=<code>true</code>)</i></dt>
<dt><a name="index-mgl_005fqo2d_005fsolve"></a><u>C function:</u> <code>HMDT</code> <b>mgl_qo2d_solve</b><i> (<code>const char *</code>ham, <code>const HMDT</code> ini_re, <code>const HMDT</code> ini_im, <code>const HMDT</code> ray, <code>float</code> r, <code>float</code> k0, <code>HMDT</code> xx, <code>HMDT</code> yy)</i></dt>
<dd><p>Solves equation du/dt = i*k0*<var>ham</var>(p,q,x,y,|u|)[u], where p=-i/k0*d/dx, q=-i/k0*d/dy are pseudo-differential operators (see <code>mglPDE()</code> for details). Parameters <var>ini_re</var>, <var>ini_im</var> specify real and imaginary part of initial field distribution. Parameters <var>ray</var> set the reference ray, i.e. the ray around which the accompanied coordinate system will be maked. You may use, for example, the array created by <code>mglRay()</code> function. Note, that the reference ray <strong>must be</strong> smooth enough to make accompanied coodrinates unambiguity. Otherwise errors in the solution may appear. If <var>xx</var> and <var>yy</var> are non-zero then Cartesian coordinates for each point will be written into them. See also <code>mglPDE()</code>. See section <a href="mathgl_en_9.html#Beam-tracing-sample">Beam tracing sample</a>, for sample code and picture. 
</p></dd></dl>

<dl>
<dt><a name="index-mglJacobian"></a><u>Global function:</u> <code>mglData</code> <b>mglJacobian</b><i> (<code>const mglData &amp;</code>x, <code>const mglData &amp;</code>y)</i></dt>
<dt><a name="index-mglJacobian-1"></a><u>Global function:</u> <code>mglData</code> <b>mglJacobian</b><i> (<code>const mglData &amp;</code>x, <code>const mglData &amp;</code>y, <code>const mglData &amp;</code>z)</i></dt>
<dt><a name="index-mgl_005fjacobian_005f2d"></a><u>C function:</u> <code>HMDT</code> <b>mgl_jacobian_2d</b><i> (<code>const HMDT</code> x, <code>const HMDT</code> y)</i></dt>
<dt><a name="index-mgl_005fjacobian_005f3d"></a><u>C function:</u> <code>HMDT</code> <b>mgl_jacobian_3d</b><i> (<code>const HMDT</code> x, <code>const HMDT</code> y, <code>const HMDT</code> z)</i></dt>
<dd><p>Computates the Jacobian for transformation {i,j,k} to {<var>x</var>,<var>y</var>,<var>z</var>} where initial coordinates  {i,j,k} are data indexes normalized in range [0,1]. The Jacobian is determined by formula det||<em>dr_\alpha/d\xi_\beta</em>|| where <em>r</em>={<var>x</var>,<var>y</var>,<var>z</var>} and <em>\xi</em>={i,j,k}. All dimensions must be the same for all data arrays. Data must be 3D if all 3 arrays {<var>x</var>,<var>y</var>,<var>z</var>} are specified or 2D if only 2 arrays {<var>x</var>,<var>y</var>} are specified.
</p></dd></dl>


<hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#mglData-class" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_7.html#Other-classes" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_12.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p>
 <font size="-1">
  This document was generated on <i>February 27, 2011</i> using <a href="http://www.nongnu.org/texi2html/"><i>texi2html 1.82</i></a>.
 </font>
 <br>

</p>
</body>
</html>