<?php $isip_window_title = "ISIP Homepage"; ?>
<?php include("/data/isip/www/templates/documentation/header/header.html"); ?>

<!--#set var="isip_page_title" value="UniformModel" -->
<?php include("/data/isip/www/templates/documentation/body/index_class.html"); ?>
<?php include("/data/isip/www/templates/documentation/body/bar.html"); ?>

<a name="name">
<b>
name:
<a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h">UniformModel</a>
</b>

<br><br>

<a name="synopsis">
<b>synopsis:</b>
<br><br>

<blockquote>
<pre>
g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_stat.a

#include &lt;UniformModel.h&gt;

UniformModel(MODE mode = DEF_MODE);
UniformModel(const UniformModel& arg);
boolean eq(const UniformModel& arg) const;
boolean assign(const UniformModel& arg);
boolean setMin(VectorFloat& arg);
boolean setMax(VectorFloat& arg);
</pre>
</blockquote>

<a name="quick_start">
<b>quick start:</b>
<br><br>

<blockquote>
<pre>
UniformModel model;
VectorFloat min;
min.assign(L"-2, -1, -3");
model.setMin(min);
VectorFloat max(L"1, 2, 0");
model.setMax(max);
</pre>
</blockquote>

<a name="description"> 
<b>description:</b>
<br><br>

The UniformModel class is used to calculate the likelihood
of a vector modeled by a uniform distribution.
The density function is defined as follows:

<pre>
               1 
  p(x) = -----------------  ,  min < x < max
          Area(max - min)

                0           ,  otherwise
</pre>

where the area is computed as a product of rectangular regions in
an N-dimensional space.

<br><br>

<a name="dependencies">
<b>dependencies:</b>
<br><br>

<ul>
  <li> <a href="../../math/vector/VectorFloat/index.html">VectorFloat</a>
  <li> <a href="/perl/ifc_document.pl?file=$isip/class/stat/StatisticalModel/StatisticalModelBase.h">StatisticalModelBase</a>
  <li> <a href="../../system/MemoryManager/index.html">MemoryManager</a>
</ul>

<a name="constants">
<b>public constants:</b>
<br><br>

<ul>
  <li> define the class name:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/uni_00.cc&constant=CLASS_NAME">static const String CLASS_NAME;</a></pre>

  <li> define i/o related constants:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/uni_00.cc&constant=DEF_PARAM">static const String DEF_PARAM;</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/uni_00.cc&constant=PARAM_MIN">static const String PARAM_MIN;</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/uni_00.cc&constant=PARAM_MAX">static const String PARAM_MAX;</a></pre>
</ul>

<a name="error">
<b>error codes:</b>
<br><br>

<ul>
  <li> error code indicating UniformModel class general error:
       
       <pre><a href="/perl/ifc_document.pl?err=00060400">static const long ERR = 60400;</a></pre>
</ul>

<a name="protected">
<b>protected data:</b>
<br><br>

<ul>
  <li> variables to describe the range:
       
       <pre>VectorFloat min_d;</pre>
       <pre>VectorFloat max_d;</pre>

  <li> probability distribution scale factor:
       
       <pre>float scale_d;</pre>        

 <li> define the memory manager:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/uni_00.cc&static=mgr_d">static MemoryManager mgr_d;</a></pre>
</ul>

<a name="public">
<b>required public methods:</b>
<br><br>

<ul>
  <li> static methods:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=name">static const String& name();</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/uni_02.cc&method=diagnose">static boolean diagnose(Integral::DEBUG debug_level);</a></pre>

  <li> debug methods:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/uni_01.cc&method=debug">boolean debug(const unichar* message) const;</a></pre>
       <p>setDebug is inherited from base class</p>

  <li> destructor/constructor(s):
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=destructor">~UniformModel();</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=default+constructor">UniformModel(MODE mode = DEF_MODE);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=copy+constructor">UniformModel(const UniformModel& arg);</a></pre>

  <li> assign methods:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=assign">boolean assign(const UniformModel& arg);</a></pre>     

  <li> operator= methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=operator%3D">UniformModel& operator=(const UniformModel& arg);</a></pre>

  <li> i/o methods:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=sofSize">long sofSize() const;</a></pre>     

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/uni_03.cc&method=read">boolean read(Sof& sof, long tag, const String& name = CLASS_NAME);</a></pre>     

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/uni_04.cc&method=write">boolean write(Sof& sof, long tag, const String& name = CLASS_NAME) const;</a></pre>     

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=readAccumulator">boolean readAccumulator(Sof& sof, long tag, const String& name = CLASS_NAME);</a></pre>     

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=writeAccumulator">boolean writeAccumulator(Sof& sof, long tag, const String& name = CLASS_NAME) const;</a></pre>     
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/uni_03.cc&method=readData">boolean readData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);</a></pre>     

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/uni_04.cc&method=writeData">boolean writeData(Sof& sof, const String& pname = DEF_PARAM) const;</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=readAccumulatorData">boolean readAccumulatorData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);</a></pre>     

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=writeAccumulatorData">boolean writeAccumulatorData(Sof& sof, const String& pname = DEF_PARAM) const;</a></pre>            

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/uni_03.cc&method=readOccupancies">boolean readOccupancies(Sof& sof, long tag, const String& name = CLASS_NAME);</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/uni_03.cc&method=readOccupanciesData">boolean readOccupanciesData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);</a></pre>     
       
  <li> equality methods:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=eq">boolean eq(const UniformModel& arg) const;</a></pre>
       
  <li> memory management methods:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=operator+new">static void* operator new(size_t size);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=operator+new\[\]">static void* operator new[](size_t size);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=operator+delete">static void operator delete(void* ptr);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=operator+delete\[\]">static void operator delete[](void* ptr);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=setGrowSize">static boolean setGrowSize(long grow_size);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=clear">boolean clear(Integral::CMODE cmode = Integral::DEF_CMODE);</a></pre>
</ul>

<a name="specific">
<b>class-specific public methods:</b>
<br><br>

<ul>
  <li> constructor(s):
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=constructor&instance=0">UniformModel(VectorFloat min, MatrixFloat max, MODE mode = DEF_MODE);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=constructor&instance=1">UniformModel(float min, float max, MODE mode = DEF_MODE);</a></pre>
       
  <li> set methods:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=setMin&instance=0">boolean setMin(const VectorFloat& min);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=setMin&instance=1">boolean setMin(float min);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=setMax&instance=0">boolean setMax(const MatrixFloat& max);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=setMax&instance=1">boolean setMax(float max);</a></pre>

  <li> get methods:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=getMin">boolean getMin(const VectorFloat& min);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=getMax">boolean getMax(const MatrixFloat& max);</a></pre>

  <li> interface contract for the StatisticalModelBase:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/uni_05.cc&method=assign">boolean assign(const StatisticalModelBase& arg);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/uni_06.cc&method=eq">boolean eq(const StatisticalModelBase& arg);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=className">const String& className() const;</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/uni_07.cc&method=init">boolean init();</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/uni_08.cc&method=getLikelihood">float getLikelihood(const VectorFloat& input);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/uni_08.cc&method=getLogLikelihood">float getLogLikelihood(const VectorFloat& input);</a></pre>

  <li> model reestimation methods:

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=getOccupancy">double getOccupancy();</a></pre>

       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=setOccupancy">boolean setOccupancy(double arg);</a></pre>       
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=setAccessCount&instance=0">boolean setAccessCount(long arg);</a></pre>              
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=getAccessCount">long getAccessCount();</a></pre>
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=resetAccumulators">boolean resetAccumulators();</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=initialize&instance=0">boolean initialize(VectorFloat& param);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=accumulate&instance=0">boolean accumulate(VectorFloat& param);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=accumulate&instance=1">boolean accumulate(VectorFloat& param, VectorFloat& data, boolean precomp);</a></pre>       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/UniformModel.h&method=update">boolean update(VectorFloat& param);</a></pre>
</ul>

<a name="private">
<b>private methods:</b>
<br><br>

<ul>  
  <li> initialization methods:
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/stat/UniformModel/uni_07.cc&method=initScale">float initScale();</a></pre>
</ul>

<a name="examples">
<b>examples:</b>
<br><br>

<ul>
  <li> This example shows how to construct a UniformModel and get
       likelihood of a vector:
       
<pre>
// declare the UniformModel object
//
UniformModel model;

// set the compute mode
//
model.setMode(PRE_COMPUTE);

// set the minimum vector
//
VectorFloat min;
min.assign(L"-2, -1, -3");
model.setMin(min);

// set the maximum vector
//
VectorFloat max(L"1, 2, 0");
model.setMax(max);

// declare the input vector
//
VectorFloat input;
input.assign(L"-1.050, -7.709, -2.303");

// get the distance
//
Float distance = model.getLikelihood(input);</pre>       
</ul>

<a name="notes">
<b>notes:</b>
<br><br>

<ul>
  <li> none
</ul>

<!--#include virtual="/hse/ies/templates/documentation/footer/footer.html" -->
