<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>SphinxBase: include/sphinxbase/logmath.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript"> $(document).ready(initResizable); </script> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.3 --> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">SphinxBase <span id="projectnumber">0.6</span></div> </td> </tr> </tbody> </table> </div> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> initNavTree('logmath_8h.html',''); </script> <div id="doc-content"> <div class="header"> <div class="summary"> <a href="#nested-classes">Data Structures</a> | <a href="#define-members">Defines</a> | <a href="#typedef-members">Typedefs</a> | <a href="#func-members">Functions</a> </div> <div class="headertitle"> <h1>include/sphinxbase/logmath.h File Reference</h1> </div> </div> <div class="contents"> <p>Fast integer logarithmic addition operations. <a href="#_details">More...</a></p> <div class="textblock"><code>#include <sphinxbase/sphinxbase_export.h></code><br/> <code>#include <sphinxbase/prim_type.h></code><br/> <code>#include <sphinxbase/cmd_ln.h></code><br/> </div> <p><a href="logmath_8h_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="nested-classes"></a> Data Structures</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structlogadd__s.html">logadd_s</a></td></tr> <tr><td colspan="2"><h2><a name="define-members"></a> Defines</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae5c5ce106e9f8f1e763d419de53317a8"></a><!-- doxytag: member="logmath.h::LOGMATH_TABLE" ref="ae5c5ce106e9f8f1e763d419de53317a8" args="(lm)" --> #define </td><td class="memItemRight" valign="bottom"><a class="el" href="logmath_8h.html#ae5c5ce106e9f8f1e763d419de53317a8">LOGMATH_TABLE</a>(lm)   ((<a class="el" href="structlogadd__s.html">logadd_t</a> *)lm)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Obtain the log-add table from a logmath_t *. <br/></td></tr> <tr><td colspan="2"><h2><a name="typedef-members"></a> Typedefs</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structlogadd__s.html">logadd_s</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="logmath_8h.html#a8c04c94e2c6364f6cf3b649eb4ce5bfd">logadd_t</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Integer log math computation table. <a href="#a8c04c94e2c6364f6cf3b649eb4ce5bfd"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae613aa7db1dd40ff56a80a7dadb22cc8"></a><!-- doxytag: member="logmath.h::logmath_t" ref="ae613aa7db1dd40ff56a80a7dadb22cc8" args="" --> typedef struct <a class="el" href="structlogmath__s.html">logmath_s</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="logmath_8h.html#ae613aa7db1dd40ff56a80a7dadb22cc8">logmath_t</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Integer log math computation class. <br/></td></tr> <tr><td colspan="2"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">SPHINXBASE_EXPORT <a class="el" href="structlogmath__s.html">logmath_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="logmath_8h.html#a5835860c5f6a703c80c0214f816f0b11">logmath_init</a> (float64 base, int shift, int use_table)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Initialize a log math computation table. <a href="#a5835860c5f6a703c80c0214f816f0b11"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afbed298ba0bc4736415d78880fe5c7c2"></a><!-- doxytag: member="logmath.h::logmath_read" ref="afbed298ba0bc4736415d78880fe5c7c2" args="(const char *filename)" --> SPHINXBASE_EXPORT <a class="el" href="structlogmath__s.html">logmath_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="logmath_8h.html#afbed298ba0bc4736415d78880fe5c7c2">logmath_read</a> (const char *filename)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Memory-map (or read) a log table from a file. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a787070f5e689878348ef219245fc7c44"></a><!-- doxytag: member="logmath.h::logmath_write" ref="a787070f5e689878348ef219245fc7c44" args="(logmath_t *lmath, const char *filename)" --> SPHINXBASE_EXPORT int32 </td><td class="memItemRight" valign="bottom"><a class="el" href="logmath_8h.html#a787070f5e689878348ef219245fc7c44">logmath_write</a> (<a class="el" href="structlogmath__s.html">logmath_t</a> *lmath, const char *filename)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Write a log table to a file. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3280500e77bf27aa7cda23268b8eb8b3"></a><!-- doxytag: member="logmath.h::logmath_get_table_shape" ref="a3280500e77bf27aa7cda23268b8eb8b3" args="(logmath_t *lmath, uint32 *out_size, uint32 *out_width, uint32 *out_shift)" --> SPHINXBASE_EXPORT int32 </td><td class="memItemRight" valign="bottom"><a class="el" href="logmath_8h.html#a3280500e77bf27aa7cda23268b8eb8b3">logmath_get_table_shape</a> (<a class="el" href="structlogmath__s.html">logmath_t</a> *lmath, uint32 *out_size, uint32 *out_width, uint32 *out_shift)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Get the log table size and dimensions. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6114206ec0321d7015c42fc7b81cb83e"></a><!-- doxytag: member="logmath.h::logmath_get_base" ref="a6114206ec0321d7015c42fc7b81cb83e" args="(logmath_t *lmath)" --> SPHINXBASE_EXPORT float64 </td><td class="memItemRight" valign="bottom"><a class="el" href="logmath_8h.html#a6114206ec0321d7015c42fc7b81cb83e">logmath_get_base</a> (<a class="el" href="structlogmath__s.html">logmath_t</a> *lmath)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Get the log base. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1c160c28a9e7d25923f391773b1028c0"></a><!-- doxytag: member="logmath.h::logmath_get_zero" ref="a1c160c28a9e7d25923f391773b1028c0" args="(logmath_t *lmath)" --> SPHINXBASE_EXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="logmath_8h.html#a1c160c28a9e7d25923f391773b1028c0">logmath_get_zero</a> (<a class="el" href="structlogmath__s.html">logmath_t</a> *lmath)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Get the smallest possible value represented in this base. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0cd690d2a414aebb5e126b8cabbfabde"></a><!-- doxytag: member="logmath.h::logmath_get_width" ref="a0cd690d2a414aebb5e126b8cabbfabde" args="(logmath_t *lmath)" --> SPHINXBASE_EXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="logmath_8h.html#a0cd690d2a414aebb5e126b8cabbfabde">logmath_get_width</a> (<a class="el" href="structlogmath__s.html">logmath_t</a> *lmath)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Get the width of the values in a log table. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aed009aca9736612bebdda57444ec63a6"></a><!-- doxytag: member="logmath.h::logmath_get_shift" ref="aed009aca9736612bebdda57444ec63a6" args="(logmath_t *lmath)" --> SPHINXBASE_EXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="logmath_8h.html#aed009aca9736612bebdda57444ec63a6">logmath_get_shift</a> (<a class="el" href="structlogmath__s.html">logmath_t</a> *lmath)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Get the shift of the values in a log table. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">SPHINXBASE_EXPORT <a class="el" href="structlogmath__s.html">logmath_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="logmath_8h.html#a1c1b2ba3b137a39e9e835a8f3e27d381">logmath_retain</a> (<a class="el" href="structlogmath__s.html">logmath_t</a> *lmath)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Retain ownership of a log table. <a href="#a1c1b2ba3b137a39e9e835a8f3e27d381"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">SPHINXBASE_EXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="logmath_8h.html#a97865ef8bc1e8e2525a2329e0627ecfb">logmath_free</a> (<a class="el" href="structlogmath__s.html">logmath_t</a> *lmath)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Free a log table. <a href="#a97865ef8bc1e8e2525a2329e0627ecfb"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a61bf79c70a38f00ca060b69b0efd7489"></a><!-- doxytag: member="logmath.h::logmath_add_exact" ref="a61bf79c70a38f00ca060b69b0efd7489" args="(logmath_t *lmath, int logb_p, int logb_q)" --> SPHINXBASE_EXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="logmath_8h.html#a61bf79c70a38f00ca060b69b0efd7489">logmath_add_exact</a> (<a class="el" href="structlogmath__s.html">logmath_t</a> *lmath, int logb_p, int logb_q)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Add two values in log space exactly and slowly (without using add table). <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">SPHINXBASE_EXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="logmath_8h.html#a5eb70928578b0115c9c7ac2765396a06">logmath_add</a> (<a class="el" href="structlogmath__s.html">logmath_t</a> *lmath, int logb_p, int logb_q)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Add two values in log space (i.e. <a href="#a5eb70928578b0115c9c7ac2765396a06"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aebb4711268322fa7aec31e5798fe7e90"></a><!-- doxytag: member="logmath.h::logmath_log" ref="aebb4711268322fa7aec31e5798fe7e90" args="(logmath_t *lmath, float64 p)" --> SPHINXBASE_EXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="logmath_8h.html#aebb4711268322fa7aec31e5798fe7e90">logmath_log</a> (<a class="el" href="structlogmath__s.html">logmath_t</a> *lmath, float64 p)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Convert linear floating point number to integer log in base B. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae8b0a168e29e448c0d6de66dc46e099e"></a><!-- doxytag: member="logmath.h::logmath_exp" ref="ae8b0a168e29e448c0d6de66dc46e099e" args="(logmath_t *lmath, int logb_p)" --> SPHINXBASE_EXPORT float64 </td><td class="memItemRight" valign="bottom"><a class="el" href="logmath_8h.html#ae8b0a168e29e448c0d6de66dc46e099e">logmath_exp</a> (<a class="el" href="structlogmath__s.html">logmath_t</a> *lmath, int logb_p)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Convert integer log in base B to linear floating point. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a52eff2c778ad758888b03ac5efcdccea"></a><!-- doxytag: member="logmath.h::logmath_ln_to_log" ref="a52eff2c778ad758888b03ac5efcdccea" args="(logmath_t *lmath, float64 log_p)" --> SPHINXBASE_EXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="logmath_8h.html#a52eff2c778ad758888b03ac5efcdccea">logmath_ln_to_log</a> (<a class="el" href="structlogmath__s.html">logmath_t</a> *lmath, float64 log_p)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Convert natural log (in floating point) to integer log in base B. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8035e176636eae8b4e02fe488f25457a"></a><!-- doxytag: member="logmath.h::logmath_log_to_ln" ref="a8035e176636eae8b4e02fe488f25457a" args="(logmath_t *lmath, int logb_p)" --> SPHINXBASE_EXPORT float64 </td><td class="memItemRight" valign="bottom"><a class="el" href="logmath_8h.html#a8035e176636eae8b4e02fe488f25457a">logmath_log_to_ln</a> (<a class="el" href="structlogmath__s.html">logmath_t</a> *lmath, int logb_p)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Convert integer log in base B to natural log (in floating point). <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aacb4dddeed63a61fb927915f7e3a642e"></a><!-- doxytag: member="logmath.h::logmath_log10_to_log" ref="aacb4dddeed63a61fb927915f7e3a642e" args="(logmath_t *lmath, float64 log_p)" --> SPHINXBASE_EXPORT int </td><td class="memItemRight" valign="bottom"><a class="el" href="logmath_8h.html#aacb4dddeed63a61fb927915f7e3a642e">logmath_log10_to_log</a> (<a class="el" href="structlogmath__s.html">logmath_t</a> *lmath, float64 log_p)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Convert base 10 log (in floating point) to integer log in base B. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7c17cb624003975e84fbd141ca6e2e06"></a><!-- doxytag: member="logmath.h::logmath_log_to_log10" ref="a7c17cb624003975e84fbd141ca6e2e06" args="(logmath_t *lmath, int logb_p)" --> SPHINXBASE_EXPORT float64 </td><td class="memItemRight" valign="bottom"><a class="el" href="logmath_8h.html#a7c17cb624003975e84fbd141ca6e2e06">logmath_log_to_log10</a> (<a class="el" href="structlogmath__s.html">logmath_t</a> *lmath, int logb_p)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Convert integer log in base B to base 10 log (in floating point). <br/></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <div class="textblock"><p>Fast integer logarithmic addition operations. </p> <p>In evaluating HMM models, probability values are often kept in log domain, to avoid overflow. To enable these logprob values to be held in int32 variables without significant loss of precision, a logbase of (1+epsilon) (where epsilon < 0.01 or so) is used. This module maintains this logbase (B).</p> <p>However, maintaining probabilities in log domain creates a problem when adding two probability values. This problem can be solved by table lookup. Note that:</p> <ul> <li><img class="formulaInl" alt="$ b^z = b^x + b^y $" src="form_0.png"/></li> <li><img class="formulaInl" alt="$ b^z = b^x(1 + b^{y-x}) = b^y(1 + e^{x-y}) $" src="form_1.png"/></li> <li><img class="formulaInl" alt="$ z = x + log_b(1 + b^{y-x}) = y + log_b(1 + b^{x-y}) $" src="form_2.png"/></li> </ul> <p>So:</p> <ul> <li>when <img class="formulaInl" alt="$ y > x, z = y + logadd\_table[-(x-y)] $" src="form_3.png"/></li> <li>when <img class="formulaInl" alt="$ x > y, z = x + logadd\_table[-(y-x)] $" src="form_4.png"/></li> <li>where <img class="formulaInl" alt="$ logadd\_table[n] = log_b(1 + b^{-n}) $" src="form_5.png"/></li> </ul> <p>The first entry in <em>logadd_table</em> is simply <img class="formulaInl" alt="$ log_b(2.0) $" src="form_6.png"/>, for the case where <img class="formulaInl" alt="$ y = x $" src="form_7.png"/> and thus <img class="formulaInl" alt="$ z = log_b(2x) = log_b(2) + x $" src="form_8.png"/>. The last entry is zero, where <img class="formulaInl" alt="$ log_b(x+y) = x = y $" src="form_9.png"/> due to loss of precision.</p> <p>Since this table can be quite large particularly for small logbases, an option is provided to compress it by dropping the least significant bits of the table. </p> <p>Definition in file <a class="el" href="logmath_8h_source.html">logmath.h</a>.</p> </div><hr/><h2>Typedef Documentation</h2> <a class="anchor" id="a8c04c94e2c6364f6cf3b649eb4ce5bfd"></a><!-- doxytag: member="logmath.h::logadd_t" ref="a8c04c94e2c6364f6cf3b649eb4ce5bfd" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef struct <a class="el" href="structlogadd__s.html">logadd_s</a> <a class="el" href="structlogadd__s.html">logadd_t</a></td> </tr> </table> </div> <div class="memdoc"> <p>Integer log math computation table. </p> <p>This is exposed here to allow log-add computations to be inlined. </p> <p>Definition at line <a class="el" href="logmath_8h_source.html#l00093">93</a> of file <a class="el" href="logmath_8h_source.html">logmath.h</a>.</p> </div> </div> <hr/><h2>Function Documentation</h2> <a class="anchor" id="a5eb70928578b0115c9c7ac2765396a06"></a><!-- doxytag: member="logmath.h::logmath_add" ref="a5eb70928578b0115c9c7ac2765396a06" args="(logmath_t *lmath, int logb_p, int logb_q)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">SPHINXBASE_EXPORT int logmath_add </td> <td>(</td> <td class="paramtype"><a class="el" href="structlogmath__s.html">logmath_t</a> * </td> <td class="paramname"><em>lmath</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"><em>logb_p</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"><em>logb_q</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Add two values in log space (i.e. </p> <p>return log(exp(p)+exp(q))) </p> <p>Definition at line <a class="el" href="logmath_8c_source.html#l00392">392</a> of file <a class="el" href="logmath_8c_source.html">logmath.c</a>.</p> <p>References <a class="el" href="logmath_8c_source.html#l00392">logmath_add()</a>, <a class="el" href="logmath_8c_source.html#l00439">logmath_add_exact()</a>, <a class="el" href="logmath_8h_source.html#l00113">LOGMATH_TABLE</a>, <a class="el" href="logmath_8h_source.html#l00096">logadd_s::table</a>, <a class="el" href="logmath_8h_source.html#l00098">logadd_s::table_size</a>, and <a class="el" href="logmath_8h_source.html#l00100">logadd_s::width</a>.</p> <p>Referenced by <a class="el" href="logmath_8c_source.html#l00392">logmath_add()</a>.</p> </div> </div> <a class="anchor" id="a97865ef8bc1e8e2525a2329e0627ecfb"></a><!-- doxytag: member="logmath.h::logmath_free" ref="a97865ef8bc1e8e2525a2329e0627ecfb" args="(logmath_t *lmath)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">SPHINXBASE_EXPORT int logmath_free </td> <td>(</td> <td class="paramtype"><a class="el" href="structlogmath__s.html">logmath_t</a> * </td> <td class="paramname"><em>lmath</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Free a log table. </p> <dl class="return"><dt><b>Returns:</b></dt><dd>new reference count (0 if freed completely) </dd></dl> <p>Definition at line <a class="el" href="logmath_8c_source.html#l00342">342</a> of file <a class="el" href="logmath_8c_source.html">logmath.c</a>.</p> <p>References <a class="el" href="ckd__alloc_8c_source.html#l00241">ckd_free()</a>, <a class="el" href="logmath_8c_source.html#l00342">logmath_free()</a>, <a class="el" href="mmio_8c_source.html#l00238">mmio_file_unmap()</a>, and <a class="el" href="logmath_8h_source.html#l00096">logadd_s::table</a>.</p> <p>Referenced by <a class="el" href="jsgf_8c_source.html#l00507">jsgf_write_fsg()</a>, <a class="el" href="logmath_8c_source.html#l00342">logmath_free()</a>, and <a class="el" href="logmath_8c_source.html#l00164">logmath_read()</a>.</p> </div> </div> <a class="anchor" id="a5835860c5f6a703c80c0214f816f0b11"></a><!-- doxytag: member="logmath.h::logmath_init" ref="a5835860c5f6a703c80c0214f816f0b11" args="(float64 base, int shift, int use_table)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">SPHINXBASE_EXPORT <a class="el" href="structlogmath__s.html">logmath_t</a>* logmath_init </td> <td>(</td> <td class="paramtype">float64 </td> <td class="paramname"><em>base</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"><em>shift</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"><em>use_table</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Initialize a log math computation table. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">base</td><td>The base B in which computation is to be done. </td></tr> <tr><td class="paramname">shift</td><td>Log values are shifted right by this many bits. </td></tr> <tr><td class="paramname">use_table</td><td>Whether to use an add table or not </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>The newly created log math table. </dd></dl> <p>Definition at line <a class="el" href="logmath_8c_source.html#l00062">62</a> of file <a class="el" href="logmath_8c_source.html">logmath.c</a>.</p> <p>References <a class="el" href="ckd__alloc_8h_source.html#l00248">ckd_calloc</a>, <a class="el" href="err_8h_source.html#l00169">E_ERROR</a>, <a class="el" href="logmath_8c_source.html#l00062">logmath_init()</a>, <a class="el" href="logmath_8h_source.html#l00102">logadd_s::shift</a>, <a class="el" href="logmath_8h_source.html#l00096">logadd_s::table</a>, <a class="el" href="logmath_8h_source.html#l00098">logadd_s::table_size</a>, and <a class="el" href="logmath_8h_source.html#l00100">logadd_s::width</a>.</p> <p>Referenced by <a class="el" href="jsgf_8c_source.html#l00507">jsgf_write_fsg()</a>, and <a class="el" href="logmath_8c_source.html#l00062">logmath_init()</a>.</p> </div> </div> <a class="anchor" id="a1c1b2ba3b137a39e9e835a8f3e27d381"></a><!-- doxytag: member="logmath.h::logmath_retain" ref="a1c1b2ba3b137a39e9e835a8f3e27d381" args="(logmath_t *lmath)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">SPHINXBASE_EXPORT <a class="el" href="structlogmath__s.html">logmath_t</a>* logmath_retain </td> <td>(</td> <td class="paramtype"><a class="el" href="structlogmath__s.html">logmath_t</a> * </td> <td class="paramname"><em>lmath</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Retain ownership of a log table. </p> <dl class="return"><dt><b>Returns:</b></dt><dd>pointer to retained log table. </dd></dl> <p>Definition at line <a class="el" href="logmath_8c_source.html#l00335">335</a> of file <a class="el" href="logmath_8c_source.html">logmath.c</a>.</p> <p>References <a class="el" href="logmath_8c_source.html#l00335">logmath_retain()</a>.</p> <p>Referenced by <a class="el" href="logmath_8c_source.html#l00335">logmath_retain()</a>.</p> </div> </div> </div> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="logmath_8h.html">logmath.h</a> </li> <li class="footer">Generated on Tue Apr 19 2011 for SphinxBase by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </li> </ul> </div> </body> </html>