/usr/include/shark/Rng/AbstractDistribution.h is in libshark-dev 3.0.1+ds1-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | //===========================================================================
/*!
*
*
* \brief Abstract class for statistical distributions
*
*
*
*
* \author B. Li
* \date 2012
*
*
* \par Copyright 1995-2015 Shark Development Team
*
* <BR><HR>
* This file is part of Shark.
* <http://image.diku.dk/shark/>
*
* Shark is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Shark 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Shark. If not, see <http://www.gnu.org/licenses/>.
*
*/
//===========================================================================
#ifndef SHARK_RNG_ABSTRACT_DISTRIBUTION_H
#define SHARK_RNG_ABSTRACT_DISTRIBUTION_H
#include "shark/Core/Exception.h"
#include "shark/Core/Math.h"
namespace shark {
/// Abstract class for distributions
class AbstractDistribution
{
public:
/// Dtor
virtual ~AbstractDistribution() {}
/// Calculate probability for a given input
/// @param x the input for calculating probability
/// @return probability of input
virtual double p(double x) const = 0;
/// Calculate log(p(x))
///
/// std::log can get -inf before it returns NaN. shark::safeLog tries to save the day, however is not perfect.
/// The only real solution is to implement a function logP inside the distributions which returns the energy of the state
/// @note subclasses should implement their own version of this function instead of replying on the default
/// implementation unless you are pretty sure what you are doing.
///
/// @param x the input for calculating log of probability
/// @return log of probability of input
virtual double logP(double x) const { return safeLog(p(x)); }
};
} // namespace shark {
#endif // SHARK_RNG_ABSTRACT_DISTRIBUTION_H
|