PageRenderTime 33ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/itpp/base/math/error.h

https://github.com/girror/itpp
C Header | 104 lines | 20 code | 20 blank | 64 comment | 0 complexity | 0b2731d7bc934590fbad8ad29fe4ba4c MD5 | raw file
Possible License(s): GPL-3.0
  1. /*!
  2. * \file
  3. * \brief Error functions - header file
  4. * \author Tony Ottosson and Adam Piatyszek
  5. *
  6. * -------------------------------------------------------------------------
  7. *
  8. * Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors)
  9. *
  10. * This file is part of IT++ - a C++ library of mathematical, signal
  11. * processing, speech processing, and communications classes and functions.
  12. *
  13. * IT++ is free software: you can redistribute it and/or modify it under the
  14. * terms of the GNU General Public License as published by the Free Software
  15. * Foundation, either version 3 of the License, or (at your option) any
  16. * later version.
  17. *
  18. * IT++ is distributed in the hope that it will be useful, but WITHOUT ANY
  19. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  20. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  21. * details.
  22. *
  23. * You should have received a copy of the GNU General Public License along
  24. * with IT++. If not, see <http://www.gnu.org/licenses/>.
  25. *
  26. * -------------------------------------------------------------------------
  27. */
  28. #ifndef ERROR_H
  29. #define ERROR_H
  30. #include <itpp/base/help_functions.h>
  31. namespace itpp
  32. {
  33. //!\addtogroup errorfunc
  34. //!@{
  35. /*!
  36. * \brief Error function for complex argument
  37. * \author Adam Piatyszek
  38. *
  39. * This function calculates a well known error function \c erf(z)
  40. * for complex \c z. The implementation is based on unofficial
  41. * implementation for Octave. Here is a part of the author's note
  42. * from original sources:
  43. *
  44. * Put together by John Smith john at arrows dot demon dot co dot uk,
  45. * using ideas by others.
  46. *
  47. * Calculate \c erf(z) for complex \c z.
  48. * Three methods are implemented; which one is used depends on z.
  49. *
  50. * The code includes some hard coded constants that are intended to
  51. * give about 14 decimal places of accuracy. This is appropriate for
  52. * 64-bit floating point numbers.
  53. */
  54. std::complex<double> erf(const std::complex<double>& z);
  55. //! Inverse of error function
  56. double erfinv(double x);
  57. //! Q-function
  58. double Qfunc(double x);
  59. // ----------------------------------------------------------------------
  60. // functions for matrices and vectors
  61. // ----------------------------------------------------------------------
  62. //! Error function
  63. vec erf(const vec &x);
  64. //! Error function
  65. mat erf(const mat &x);
  66. //! Error function
  67. cvec erf(const cvec &x);
  68. //! Error function
  69. cmat erf(const cmat &x);
  70. //! Inverse of error function
  71. vec erfinv(const vec &x);
  72. //! Inverse of error function
  73. mat erfinv(const mat &x);
  74. //! Complementary error function
  75. vec erfc(const vec &x);
  76. //! Complementary error function
  77. mat erfc(const mat &x);
  78. //! Q-function
  79. vec Qfunc(const vec &x);
  80. //! Q-function
  81. mat Qfunc(const mat &x);
  82. //!@}
  83. } // namespace itpp
  84. #endif // #ifndef ERROR_H