\doxysection{include/sphinxbase/logmath.h File Reference}
\label{logmath_8h}\index{include/sphinxbase/logmath.h@{include/sphinxbase/logmath.h}}


Fast integer logarithmic addition operations.  


{\ttfamily \#include $<$sphinxbase/sphinxbase\+\_\+export.\+h$>$}\newline
{\ttfamily \#include $<$sphinxbase/prim\+\_\+type.\+h$>$}\newline
{\ttfamily \#include $<$sphinxbase/cmd\+\_\+ln.\+h$>$}\newline
\doxysubsubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ logadd\+\_\+s}
\end{DoxyCompactItemize}
\doxysubsubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ LOGMATH\+\_\+\+TABLE}(lm)~((\textbf{ logadd\+\_\+t} $\ast$)lm)
\begin{DoxyCompactList}\small\item\em Obtain the log-\/add table from a logmath\+\_\+t $\ast$. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef struct \textbf{ logadd\+\_\+s} \textbf{ logadd\+\_\+t}
\begin{DoxyCompactList}\small\item\em Integer log math computation table. \end{DoxyCompactList}\item 
typedef struct \textbf{ logmath\+\_\+s} \textbf{ logmath\+\_\+t}
\begin{DoxyCompactList}\small\item\em Integer log math computation class. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ logmath\+\_\+t} $\ast$ \textbf{ logmath\+\_\+init} (float64 base, int shift, int use\+\_\+table)
\begin{DoxyCompactList}\small\item\em Initialize a log math computation table. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ logmath\+\_\+t} $\ast$ \textbf{ logmath\+\_\+read} (const char $\ast$filename)
\begin{DoxyCompactList}\small\item\em Memory-\/map (or read) a log table from a file. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ logmath\+\_\+write} (\textbf{ logmath\+\_\+t} $\ast$lmath, const char $\ast$filename)
\begin{DoxyCompactList}\small\item\em Write a log table to a file. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ logmath\+\_\+get\+\_\+table\+\_\+shape} (\textbf{ logmath\+\_\+t} $\ast$lmath, uint32 $\ast$out\+\_\+size, uint32 $\ast$out\+\_\+width, uint32 $\ast$out\+\_\+shift)
\begin{DoxyCompactList}\small\item\em Get the log table size and dimensions. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT float64 \textbf{ logmath\+\_\+get\+\_\+base} (\textbf{ logmath\+\_\+t} $\ast$lmath)
\begin{DoxyCompactList}\small\item\em Get the log base. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ logmath\+\_\+get\+\_\+zero} (\textbf{ logmath\+\_\+t} $\ast$lmath)
\begin{DoxyCompactList}\small\item\em Get the smallest possible value represented in this base. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ logmath\+\_\+get\+\_\+width} (\textbf{ logmath\+\_\+t} $\ast$lmath)
\begin{DoxyCompactList}\small\item\em Get the width of the values in a log table. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ logmath\+\_\+get\+\_\+shift} (\textbf{ logmath\+\_\+t} $\ast$lmath)
\begin{DoxyCompactList}\small\item\em Get the shift of the values in a log table. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ logmath\+\_\+t} $\ast$ \textbf{ logmath\+\_\+retain} (\textbf{ logmath\+\_\+t} $\ast$lmath)
\begin{DoxyCompactList}\small\item\em Retain ownership of a log table. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ logmath\+\_\+free} (\textbf{ logmath\+\_\+t} $\ast$lmath)
\begin{DoxyCompactList}\small\item\em Free a log table. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ logmath\+\_\+add\+\_\+exact} (\textbf{ logmath\+\_\+t} $\ast$lmath, int logb\+\_\+p, int logb\+\_\+q)
\begin{DoxyCompactList}\small\item\em Add two values in log space exactly and slowly (without using add table). \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ logmath\+\_\+add} (\textbf{ logmath\+\_\+t} $\ast$lmath, int logb\+\_\+p, int logb\+\_\+q)
\begin{DoxyCompactList}\small\item\em Add two values in log space (i.\+e. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ logmath\+\_\+log} (\textbf{ logmath\+\_\+t} $\ast$lmath, float64 p)
\begin{DoxyCompactList}\small\item\em Convert linear floating point number to integer log in base B. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT float64 \textbf{ logmath\+\_\+exp} (\textbf{ logmath\+\_\+t} $\ast$lmath, int logb\+\_\+p)
\begin{DoxyCompactList}\small\item\em Convert integer log in base B to linear floating point. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ logmath\+\_\+ln\+\_\+to\+\_\+log} (\textbf{ logmath\+\_\+t} $\ast$lmath, float64 log\+\_\+p)
\begin{DoxyCompactList}\small\item\em Convert natural log (in floating point) to integer log in base B. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT float64 \textbf{ logmath\+\_\+log\+\_\+to\+\_\+ln} (\textbf{ logmath\+\_\+t} $\ast$lmath, int logb\+\_\+p)
\begin{DoxyCompactList}\small\item\em Convert integer log in base B to natural log (in floating point). \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ logmath\+\_\+log10\+\_\+to\+\_\+log} (\textbf{ logmath\+\_\+t} $\ast$lmath, float64 log\+\_\+p)
\begin{DoxyCompactList}\small\item\em Convert base 10 log (in floating point) to integer log in base B. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT float64 \textbf{ logmath\+\_\+log\+\_\+to\+\_\+log10} (\textbf{ logmath\+\_\+t} $\ast$lmath, int logb\+\_\+p)
\begin{DoxyCompactList}\small\item\em Convert integer log in base B to base 10 log (in floating point). \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Fast integer logarithmic addition operations. 

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).

However, maintaining probabilities in log domain creates a problem when adding two probability values. This problem can be solved by table lookup. Note that\+:


\begin{DoxyItemize}
\item $ b^z = b^x + b^y $
\item $ b^z = b^x(1 + b^{y-x})     = b^y(1 + e^{x-y}) $
\item $ z   = x + log_b(1 + b^{y-x}) = y + log_b(1 + b^{x-y}) $
\end{DoxyItemize}

So\+:


\begin{DoxyItemize}
\item when $ y > x, z = y + logadd\_table[-(x-y)] $
\item when $ x > y, z = x + logadd\_table[-(y-x)] $
\item where $ logadd\_table[n] = log_b(1 + b^{-n}) $
\end{DoxyItemize}

The first entry in {\itshape logadd\+\_\+table} is simply $ log_b(2.0) $, for the case where $ y = x $ and thus $ z = log_b(2x) = log_b(2) + x $. The last entry is zero, where $ log_b(x+y) = x = y $ due to loss of precision.

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. 

Definition in file \textbf{ logmath.\+h}.



\doxysubsection{Macro Definition Documentation}
\label{logmath_8h_ae5c5ce106e9f8f1e763d419de53317a8} 
\index{logmath.h@{logmath.h}!LOGMATH\_TABLE@{LOGMATH\_TABLE}}
\index{LOGMATH\_TABLE@{LOGMATH\_TABLE}!logmath.h@{logmath.h}}
\doxysubsubsection{LOGMATH\_TABLE}
{\footnotesize\ttfamily \#define LOGMATH\+\_\+\+TABLE(\begin{DoxyParamCaption}\item[{}]{lm }\end{DoxyParamCaption})~((\textbf{ logadd\+\_\+t} $\ast$)lm)}



Obtain the log-\/add table from a logmath\+\_\+t $\ast$. 



Definition at line \textbf{ 113} of file \textbf{ logmath.\+h}.



\doxysubsection{Typedef Documentation}
\label{logmath_8h_a8c04c94e2c6364f6cf3b649eb4ce5bfd} 
\index{logmath.h@{logmath.h}!logadd\_t@{logadd\_t}}
\index{logadd\_t@{logadd\_t}!logmath.h@{logmath.h}}
\doxysubsubsection{logadd\_t}
{\footnotesize\ttfamily typedef struct \textbf{ logadd\+\_\+s} \textbf{ logadd\+\_\+t}}



Integer log math computation table. 

This is exposed here to allow log-\/add computations to be inlined. 

Definition at line \textbf{ 93} of file \textbf{ logmath.\+h}.

\label{logmath_8h_ae613aa7db1dd40ff56a80a7dadb22cc8} 
\index{logmath.h@{logmath.h}!logmath\_t@{logmath\_t}}
\index{logmath\_t@{logmath\_t}!logmath.h@{logmath.h}}
\doxysubsubsection{logmath\_t}
{\footnotesize\ttfamily typedef struct \textbf{ logmath\+\_\+s} \textbf{ logmath\+\_\+t}}



Integer log math computation class. 



Definition at line \textbf{ 108} of file \textbf{ logmath.\+h}.



\doxysubsection{Function Documentation}
\label{logmath_8h_a5eb70928578b0115c9c7ac2765396a06} 
\index{logmath.h@{logmath.h}!logmath\_add@{logmath\_add}}
\index{logmath\_add@{logmath\_add}!logmath.h@{logmath.h}}
\doxysubsubsection{logmath\_add()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int logmath\+\_\+add (\begin{DoxyParamCaption}\item[{\textbf{ logmath\+\_\+t} $\ast$}]{lmath,  }\item[{int}]{logb\+\_\+p,  }\item[{int}]{logb\+\_\+q }\end{DoxyParamCaption})}



Add two values in log space (i.\+e. 

return log(exp(p)+exp(q))) 

Definition at line \textbf{ 392} of file \textbf{ logmath.\+c}.



References \textbf{ logmath\+\_\+add()}, \textbf{ logmath\+\_\+add\+\_\+exact()}, \textbf{ LOGMATH\+\_\+\+TABLE}, \textbf{ logadd\+\_\+s\+::table}, \textbf{ logadd\+\_\+s\+::table\+\_\+size}, and \textbf{ logadd\+\_\+s\+::width}.



Referenced by \textbf{ logmath\+\_\+add()}.

\label{logmath_8h_a61bf79c70a38f00ca060b69b0efd7489} 
\index{logmath.h@{logmath.h}!logmath\_add\_exact@{logmath\_add\_exact}}
\index{logmath\_add\_exact@{logmath\_add\_exact}!logmath.h@{logmath.h}}
\doxysubsubsection{logmath\_add\_exact()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int logmath\+\_\+add\+\_\+exact (\begin{DoxyParamCaption}\item[{\textbf{ logmath\+\_\+t} $\ast$}]{lmath,  }\item[{int}]{logb\+\_\+p,  }\item[{int}]{logb\+\_\+q }\end{DoxyParamCaption})}



Add two values in log space exactly and slowly (without using add table). 



Definition at line \textbf{ 439} of file \textbf{ logmath.\+c}.



References \textbf{ logmath\+\_\+add\+\_\+exact()}, \textbf{ logmath\+\_\+exp()}, and \textbf{ logmath\+\_\+log()}.



Referenced by \textbf{ logmath\+\_\+add()}, and \textbf{ logmath\+\_\+add\+\_\+exact()}.

\label{logmath_8h_ae8b0a168e29e448c0d6de66dc46e099e} 
\index{logmath.h@{logmath.h}!logmath\_exp@{logmath\_exp}}
\index{logmath\_exp@{logmath\_exp}!logmath.h@{logmath.h}}
\doxysubsubsection{logmath\_exp()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT float64 logmath\+\_\+exp (\begin{DoxyParamCaption}\item[{\textbf{ logmath\+\_\+t} $\ast$}]{lmath,  }\item[{int}]{logb\+\_\+p }\end{DoxyParamCaption})}



Convert integer log in base B to linear floating point. 



Definition at line \textbf{ 456} of file \textbf{ logmath.\+c}.



References \textbf{ logmath\+\_\+exp()}, and \textbf{ logadd\+\_\+s\+::shift}.



Referenced by \textbf{ logmath\+\_\+add\+\_\+exact()}, \textbf{ logmath\+\_\+exp()}, and \textbf{ ngram\+\_\+model\+\_\+set\+\_\+remove()}.

\label{logmath_8h_a97865ef8bc1e8e2525a2329e0627ecfb} 
\index{logmath.h@{logmath.h}!logmath\_free@{logmath\_free}}
\index{logmath\_free@{logmath\_free}!logmath.h@{logmath.h}}
\doxysubsubsection{logmath\_free()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int logmath\+\_\+free (\begin{DoxyParamCaption}\item[{\textbf{ logmath\+\_\+t} $\ast$}]{lmath }\end{DoxyParamCaption})}



Free a log table. 

\begin{DoxyReturn}{Returns}
new reference count (0 if freed completely) 
\end{DoxyReturn}


Definition at line \textbf{ 342} of file \textbf{ logmath.\+c}.



References \textbf{ ckd\+\_\+free()}, \textbf{ logmath\+\_\+free()}, \textbf{ mmio\+\_\+file\+\_\+unmap()}, and \textbf{ logadd\+\_\+s\+::table}.



Referenced by \textbf{ jsgf\+\_\+write\+\_\+fsg()}, \textbf{ logmath\+\_\+free()}, and \textbf{ logmath\+\_\+read()}.

\label{logmath_8h_a6114206ec0321d7015c42fc7b81cb83e} 
\index{logmath.h@{logmath.h}!logmath\_get\_base@{logmath\_get\_base}}
\index{logmath\_get\_base@{logmath\_get\_base}!logmath.h@{logmath.h}}
\doxysubsubsection{logmath\_get\_base()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT float64 logmath\+\_\+get\+\_\+base (\begin{DoxyParamCaption}\item[{\textbf{ logmath\+\_\+t} $\ast$}]{lmath }\end{DoxyParamCaption})}



Get the log base. 



Definition at line \textbf{ 368} of file \textbf{ logmath.\+c}.



References \textbf{ logmath\+\_\+get\+\_\+base()}.



Referenced by \textbf{ logmath\+\_\+get\+\_\+base()}, and \textbf{ ngram\+\_\+model\+\_\+set\+\_\+init()}.

\label{logmath_8h_aed009aca9736612bebdda57444ec63a6} 
\index{logmath.h@{logmath.h}!logmath\_get\_shift@{logmath\_get\_shift}}
\index{logmath\_get\_shift@{logmath\_get\_shift}!logmath.h@{logmath.h}}
\doxysubsubsection{logmath\_get\_shift()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int logmath\+\_\+get\+\_\+shift (\begin{DoxyParamCaption}\item[{\textbf{ logmath\+\_\+t} $\ast$}]{lmath }\end{DoxyParamCaption})}



Get the shift of the values in a log table. 



Definition at line \textbf{ 386} of file \textbf{ logmath.\+c}.



References \textbf{ logmath\+\_\+get\+\_\+shift()}, and \textbf{ logadd\+\_\+s\+::shift}.



Referenced by \textbf{ logmath\+\_\+get\+\_\+shift()}, and \textbf{ ngram\+\_\+model\+\_\+set\+\_\+init()}.

\label{logmath_8h_a3280500e77bf27aa7cda23268b8eb8b3} 
\index{logmath.h@{logmath.h}!logmath\_get\_table\_shape@{logmath\_get\_table\_shape}}
\index{logmath\_get\_table\_shape@{logmath\_get\_table\_shape}!logmath.h@{logmath.h}}
\doxysubsubsection{logmath\_get\_table\_shape()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 logmath\+\_\+get\+\_\+table\+\_\+shape (\begin{DoxyParamCaption}\item[{\textbf{ logmath\+\_\+t} $\ast$}]{lmath,  }\item[{uint32 $\ast$}]{out\+\_\+size,  }\item[{uint32 $\ast$}]{out\+\_\+width,  }\item[{uint32 $\ast$}]{out\+\_\+shift }\end{DoxyParamCaption})}



Get the log table size and dimensions. 



Definition at line \textbf{ 357} of file \textbf{ logmath.\+c}.



References \textbf{ logmath\+\_\+get\+\_\+table\+\_\+shape()}, \textbf{ logadd\+\_\+s\+::shift}, \textbf{ logadd\+\_\+s\+::table\+\_\+size}, and \textbf{ logadd\+\_\+s\+::width}.



Referenced by \textbf{ logmath\+\_\+get\+\_\+table\+\_\+shape()}.

\label{logmath_8h_a0cd690d2a414aebb5e126b8cabbfabde} 
\index{logmath.h@{logmath.h}!logmath\_get\_width@{logmath\_get\_width}}
\index{logmath\_get\_width@{logmath\_get\_width}!logmath.h@{logmath.h}}
\doxysubsubsection{logmath\_get\_width()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int logmath\+\_\+get\+\_\+width (\begin{DoxyParamCaption}\item[{\textbf{ logmath\+\_\+t} $\ast$}]{lmath }\end{DoxyParamCaption})}



Get the width of the values in a log table. 



Definition at line \textbf{ 380} of file \textbf{ logmath.\+c}.



References \textbf{ logmath\+\_\+get\+\_\+width()}, and \textbf{ logadd\+\_\+s\+::width}.



Referenced by \textbf{ logmath\+\_\+get\+\_\+width()}.

\label{logmath_8h_a1c160c28a9e7d25923f391773b1028c0} 
\index{logmath.h@{logmath.h}!logmath\_get\_zero@{logmath\_get\_zero}}
\index{logmath\_get\_zero@{logmath\_get\_zero}!logmath.h@{logmath.h}}
\doxysubsubsection{logmath\_get\_zero()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int logmath\+\_\+get\+\_\+zero (\begin{DoxyParamCaption}\item[{\textbf{ logmath\+\_\+t} $\ast$}]{lmath }\end{DoxyParamCaption})}



Get the smallest possible value represented in this base. 



Definition at line \textbf{ 374} of file \textbf{ logmath.\+c}.



References \textbf{ logmath\+\_\+get\+\_\+zero()}.



Referenced by \textbf{ logmath\+\_\+get\+\_\+zero()}.

\label{logmath_8h_abbe7dbe2602b4962334f50a8f112abe0} 
\index{logmath.h@{logmath.h}!logmath\_init@{logmath\_init}}
\index{logmath\_init@{logmath\_init}!logmath.h@{logmath.h}}
\doxysubsubsection{logmath\_init()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ logmath\+\_\+t} $\ast$ logmath\+\_\+init (\begin{DoxyParamCaption}\item[{float64}]{base,  }\item[{int}]{shift,  }\item[{int}]{use\+\_\+table }\end{DoxyParamCaption})}



Initialize a log math computation table. 


\begin{DoxyParams}{Parameters}
{\em base} & The base B in which computation is to be done. \\
\hline
{\em shift} & Log values are shifted right by this many bits. \\
\hline
{\em use\+\_\+table} & Whether to use an add table or not \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The newly created log math table. 
\end{DoxyReturn}


Definition at line \textbf{ 62} of file \textbf{ logmath.\+c}.



References \textbf{ ckd\+\_\+calloc}, \textbf{ E\+\_\+\+ERROR}, \textbf{ logmath\+\_\+init()}, \textbf{ logadd\+\_\+s\+::shift}, \textbf{ logadd\+\_\+s\+::table}, \textbf{ logadd\+\_\+s\+::table\+\_\+size}, and \textbf{ logadd\+\_\+s\+::width}.



Referenced by \textbf{ jsgf\+\_\+write\+\_\+fsg()}, and \textbf{ logmath\+\_\+init()}.

\label{logmath_8h_a52eff2c778ad758888b03ac5efcdccea} 
\index{logmath.h@{logmath.h}!logmath\_ln\_to\_log@{logmath\_ln\_to\_log}}
\index{logmath\_ln\_to\_log@{logmath\_ln\_to\_log}!logmath.h@{logmath.h}}
\doxysubsubsection{logmath\_ln\_to\_log()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int logmath\+\_\+ln\+\_\+to\+\_\+log (\begin{DoxyParamCaption}\item[{\textbf{ logmath\+\_\+t} $\ast$}]{lmath,  }\item[{float64}]{log\+\_\+p }\end{DoxyParamCaption})}



Convert natural log (in floating point) to integer log in base B. 



Definition at line \textbf{ 462} of file \textbf{ logmath.\+c}.



References \textbf{ logmath\+\_\+ln\+\_\+to\+\_\+log()}, and \textbf{ logadd\+\_\+s\+::shift}.



Referenced by \textbf{ logmath\+\_\+ln\+\_\+to\+\_\+log()}.

\label{logmath_8h_aebb4711268322fa7aec31e5798fe7e90} 
\index{logmath.h@{logmath.h}!logmath\_log@{logmath\_log}}
\index{logmath\_log@{logmath\_log}!logmath.h@{logmath.h}}
\doxysubsubsection{logmath\_log()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int logmath\+\_\+log (\begin{DoxyParamCaption}\item[{\textbf{ logmath\+\_\+t} $\ast$}]{lmath,  }\item[{float64}]{p }\end{DoxyParamCaption})}



Convert linear floating point number to integer log in base B. 



Definition at line \textbf{ 447} of file \textbf{ logmath.\+c}.



References \textbf{ logmath\+\_\+log()}, and \textbf{ logadd\+\_\+s\+::shift}.



Referenced by \textbf{ logmath\+\_\+add\+\_\+exact()}, \textbf{ logmath\+\_\+log()}, \textbf{ ngram\+\_\+model\+\_\+add\+\_\+class\+\_\+word()}, \textbf{ ngram\+\_\+model\+\_\+add\+\_\+word()}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+add()}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+init()}, \textbf{ ngram\+\_\+model\+\_\+set\+\_\+interp()}, and \textbf{ ngram\+\_\+model\+\_\+set\+\_\+remove()}.

\label{logmath_8h_aacb4dddeed63a61fb927915f7e3a642e} 
\index{logmath.h@{logmath.h}!logmath\_log10\_to\_log@{logmath\_log10\_to\_log}}
\index{logmath\_log10\_to\_log@{logmath\_log10\_to\_log}!logmath.h@{logmath.h}}
\doxysubsubsection{logmath\_log10\_to\_log()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int logmath\+\_\+log10\+\_\+to\+\_\+log (\begin{DoxyParamCaption}\item[{\textbf{ logmath\+\_\+t} $\ast$}]{lmath,  }\item[{float64}]{log\+\_\+p }\end{DoxyParamCaption})}



Convert base 10 log (in floating point) to integer log in base B. 



Definition at line \textbf{ 474} of file \textbf{ logmath.\+c}.



References \textbf{ logmath\+\_\+log10\+\_\+to\+\_\+log()}, and \textbf{ logadd\+\_\+s\+::shift}.



Referenced by \textbf{ logmath\+\_\+log10\+\_\+to\+\_\+log()}.

\label{logmath_8h_a8035e176636eae8b4e02fe488f25457a} 
\index{logmath.h@{logmath.h}!logmath\_log\_to\_ln@{logmath\_log\_to\_ln}}
\index{logmath\_log\_to\_ln@{logmath\_log\_to\_ln}!logmath.h@{logmath.h}}
\doxysubsubsection{logmath\_log\_to\_ln()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT float64 logmath\+\_\+log\+\_\+to\+\_\+ln (\begin{DoxyParamCaption}\item[{\textbf{ logmath\+\_\+t} $\ast$}]{lmath,  }\item[{int}]{logb\+\_\+p }\end{DoxyParamCaption})}



Convert integer log in base B to natural log (in floating point). 



Definition at line \textbf{ 468} of file \textbf{ logmath.\+c}.



References \textbf{ logmath\+\_\+log\+\_\+to\+\_\+ln()}, and \textbf{ logadd\+\_\+s\+::shift}.



Referenced by \textbf{ logmath\+\_\+log\+\_\+to\+\_\+ln()}.

\label{logmath_8h_a7c17cb624003975e84fbd141ca6e2e06} 
\index{logmath.h@{logmath.h}!logmath\_log\_to\_log10@{logmath\_log\_to\_log10}}
\index{logmath\_log\_to\_log10@{logmath\_log\_to\_log10}!logmath.h@{logmath.h}}
\doxysubsubsection{logmath\_log\_to\_log10()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT float64 logmath\+\_\+log\+\_\+to\+\_\+log10 (\begin{DoxyParamCaption}\item[{\textbf{ logmath\+\_\+t} $\ast$}]{lmath,  }\item[{int}]{logb\+\_\+p }\end{DoxyParamCaption})}



Convert integer log in base B to base 10 log (in floating point). 



Definition at line \textbf{ 480} of file \textbf{ logmath.\+c}.



References \textbf{ logmath\+\_\+log\+\_\+to\+\_\+log10()}, and \textbf{ logadd\+\_\+s\+::shift}.



Referenced by \textbf{ logmath\+\_\+log\+\_\+to\+\_\+log10()}.

\label{logmath_8h_a57e9505adc4e0e0a2839d4932a92804c} 
\index{logmath.h@{logmath.h}!logmath\_read@{logmath\_read}}
\index{logmath\_read@{logmath\_read}!logmath.h@{logmath.h}}
\doxysubsubsection{logmath\_read()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ logmath\+\_\+t} $\ast$ logmath\+\_\+read (\begin{DoxyParamCaption}\item[{const char $\ast$}]{filename }\end{DoxyParamCaption})}



Memory-\/map (or read) a log table from a file. 



Definition at line \textbf{ 164} of file \textbf{ logmath.\+c}.



References \textbf{ atof\+\_\+c()}, \textbf{ bio\+\_\+fread()}, \textbf{ bio\+\_\+hdrarg\+\_\+free()}, \textbf{ bio\+\_\+readhdr()}, \textbf{ bio\+\_\+verify\+\_\+chksum()}, \textbf{ ckd\+\_\+calloc}, \textbf{ E\+\_\+\+ERROR}, \textbf{ E\+\_\+\+ERROR\+\_\+\+SYSTEM}, \textbf{ E\+\_\+\+INFO}, \textbf{ E\+\_\+\+WARN}, \textbf{ logmath\+\_\+free()}, \textbf{ logmath\+\_\+read()}, \textbf{ mmio\+\_\+file\+\_\+ptr()}, \textbf{ mmio\+\_\+file\+\_\+read()}, \textbf{ logadd\+\_\+s\+::shift}, \textbf{ logadd\+\_\+s\+::table}, \textbf{ logadd\+\_\+s\+::table\+\_\+size}, and \textbf{ logadd\+\_\+s\+::width}.



Referenced by \textbf{ logmath\+\_\+read()}.

\label{logmath_8h_adad8494649ef2e49cde1c5ad3ccbe072} 
\index{logmath.h@{logmath.h}!logmath\_retain@{logmath\_retain}}
\index{logmath\_retain@{logmath\_retain}!logmath.h@{logmath.h}}
\doxysubsubsection{logmath\_retain()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ logmath\+\_\+t} $\ast$ logmath\+\_\+retain (\begin{DoxyParamCaption}\item[{\textbf{ logmath\+\_\+t} $\ast$}]{lmath }\end{DoxyParamCaption})}



Retain ownership of a log table. 

\begin{DoxyReturn}{Returns}
pointer to retained log table. 
\end{DoxyReturn}


Definition at line \textbf{ 335} of file \textbf{ logmath.\+c}.



References \textbf{ logmath\+\_\+retain()}.



Referenced by \textbf{ logmath\+\_\+retain()}.

\label{logmath_8h_a787070f5e689878348ef219245fc7c44} 
\index{logmath.h@{logmath.h}!logmath\_write@{logmath\_write}}
\index{logmath\_write@{logmath\_write}!logmath.h@{logmath.h}}
\doxysubsubsection{logmath\_write()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 logmath\+\_\+write (\begin{DoxyParamCaption}\item[{\textbf{ logmath\+\_\+t} $\ast$}]{lmath,  }\item[{const char $\ast$}]{filename }\end{DoxyParamCaption})}



Write a log table to a file. 



Definition at line \textbf{ 272} of file \textbf{ logmath.\+c}.



References \textbf{ bio\+\_\+fwrite()}, \textbf{ E\+\_\+\+ERROR}, \textbf{ E\+\_\+\+ERROR\+\_\+\+SYSTEM}, \textbf{ E\+\_\+\+INFO}, \textbf{ logmath\+\_\+write()}, \textbf{ logadd\+\_\+s\+::shift}, \textbf{ logadd\+\_\+s\+::table}, \textbf{ logadd\+\_\+s\+::table\+\_\+size}, and \textbf{ logadd\+\_\+s\+::width}.



Referenced by \textbf{ logmath\+\_\+write()}.

