IT++ Logo Newcom Logo

scalfunc.h File Reference

Definitions of scalar functions. More...

#include <itpp/config.h>
#include <itpp/base/itassert.h>
#include <complex>
#include <limits>

Go to the source code of this file.

Namespaces

namespace  itpp

Functions

double asinh (double x)
 Arcus sinhyp.
double acosh (double x)
 Arcus coshyp.
double atanh (double x)
 Arcus tanhyp.
double tgamma (double x)
 True gamma function.
double lgamma (double x)
 Lograrithm of an absolute gamma function.
double cbrt (double x)
double trunc_log (double x)
 Truncated natural logarithm function.
double trunc_exp (double x)
 Truncated exponential function.
double log2 (double x)
 Base-2 logarithm.
double logb (double b, double x)
 Base-b logarithm.
double sinc (double x)
 Sinc function. sinc(x) = sin(pi*x)/pi*x.
int round_i (double x)
 Round to nearest integer.
int ceil_i (double x)
 The nearest larger integer.
int floor_i (double x)
 The nearest smaller integer.
double round (double x)
 Round to nearest integer, return result in double.
bool is_int (double x)
 Return true if x is an integer.
bool is_even (int x)
 Return true if x is an even integer.
int int2bits (int n)
 Calculate the number of bits needed to represent an inteager n.
int levels2bits (int n)
 Calculate the number of bits needed to represent n different values (levels).
int needed_bits (int n)
 Deprecated function. Might be removed in future releases. Please use int2bits() or levels2bits() instead.
int needed_bits (double n)
 Deprecated function. Might be removed in future releases. Please use int2bits() or levels2bits() instead.
int pow2i (int x)
 Integer 2^x.
int pow2 (int x)
 Calculate two to the power of x (2^x).
double pow2 (double x)
 Calculate two to the power of x (2^x).
double pow10 (double x)
 Calculate ten to the power of x (10^x).
double dB (double x)
 Decibel of x (10*log10(x)).
double inv_dB (double x)
 Inverse of decibel.
int gray_code (int x)
 Convert to Gray Code.
double rad_to_deg (double x)
 Convert radians to degrees.
double deg_to_rad (double x)
 Convert degrees to radians.
double sqr (double x)
 Square of x.
double sqr (std::complex< double > x)
 Square of complex-valued x, ||x||^2.
double rem (double x, double y)
 The reminder of the division x/y.
double sign (double x)
 The sign of x.
double sgn (double x)
 The sign of x.
signed char abs (signed char x)
 Absolute value.
short abs (short x)
 Absolute value.
int abs (int x)
 Absolute value.
double round_to_zero (double x, double threshold=1e-14)
 Round x to zero if abs(x) is smaller than threshold.

Variables

int signgam
const double pi = 3.14159265358979323846
 Constant pi.
const double m_2pi = 2 * pi
 Constant 2*Pi.
const double eps = std::numeric_limits<double>::epsilon()
 Constant eps.
const double log_double_max = std::log(std::numeric_limits<double>::max())
 Constant definition to speed up trunc_log and trunc_exp functions.
const double log_double_min = std::log(std::numeric_limits<double>::min())
 Constant definition to speed up trunc_log and trunc_exp functions.


Detailed Description

Definitions of scalar functions.

Author:
Tony Ottosson, Pal Frenger and Adam Piatyszek
Date
2007-04-18 08:58:29 +0200 (Wed, 18 Apr 2007)
Revision
1013

-------------------------------------------------------------------------

IT++ - C++ library of mathematical, signal processing, speech processing, and communications classes and functions

Copyright (C) 1995-2007 (see AUTHORS file for a list of contributors)

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

-------------------------------------------------------------------------

Definition in file scalfunc.h.


Function Documentation

double trunc_log double  x  )  [inline]
 

Truncated natural logarithm function.

This truncated function provides a solution in the cases when the logarithm argument is less or equal to zero or infinity. The function checks for such extreme values and use some kind of truncation (saturation) before calculating the logarithm.

The truncated logarithm function can be used for calculation of log-likelihood in soft demodulators, when numerical instability problem might occur.

Definition at line 140 of file scalfunc.h.

double trunc_exp double  x  )  [inline]
 

Truncated exponential function.

This truncated function provides a solution in the case when the exponent function results in infinity. The function checks for an extreme value and use truncation (saturation) before calculating the result.

The truncated exponential function can be used when numerical instability problem occurs for a standard exp function.

Definition at line 162 of file scalfunc.h.


Variable Documentation

const double itpp::pi = 3.14159265358979323846
 

Constant pi.

Definition at line 115 of file scalfunc.h.

const double itpp::m_2pi = 2 * pi
 

Constant 2*Pi.

Definition at line 118 of file scalfunc.h.

const double itpp::eps = std::numeric_limits<double>::epsilon()
 

Constant eps.

Definition at line 121 of file scalfunc.h.

const double itpp::log_double_max = std::log(std::numeric_limits<double>::max())
 

Constant definition to speed up trunc_log and trunc_exp functions.

Definition at line 124 of file scalfunc.h.

const double itpp::log_double_min = std::log(std::numeric_limits<double>::min())
 

Constant definition to speed up trunc_log and trunc_exp functions.

Definition at line 126 of file scalfunc.h.

SourceForge Logo

Generated on Fri Jan 11 08:51:39 2008 for IT++ by Doxygen 1.3.9.1