This file is indexed.

/usr/include/shark/Rng/Cauchy.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
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*!
 * 
 *
 * \brief       Standard Cauchy distribution
 * 
 * 
 *
 * \author      O. Krause
 * \date        2010-01-01
 *
 *
 * \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_CAUCHY_H
#define SHARK_RNG_CAUCHY_H

#include <shark/Core/Math.h>
#include <shark/Rng/Rng.h>

#include <boost/random.hpp>
#include <boost/random/cauchy_distribution.hpp>
#include <cmath>

namespace shark{

	/*!
	*  \brief Cauchy distribution
	*
	*  This class is a thin wrapper for the boost::cauchy_distribution class.
	*  The %Cauchy distribution (aka "Lorentzian") is defined by:
	*
	*  \f$
	*      f(x) = \frac{1}{\pi \sigma (1 + \left[\frac {(x-x_0)} \sigma\right]^2 )}
	*  \f$
	*
	*  <br>
	*  The %Cauchy distribution is important as an example of a pathological
	*  case. The %Cauchy distribution looks similar to a Normal distribution,
	*  but has much heavier tails. When studying hypothesis tests that assume
	*  normality, seeing how the tests perform on data from a %Cauchy
	*  distribution is a good indicator of how sensitive the tests are to
	*  heavy-tail departures from normality. Likewise, it is a good check
	*  for robust techniques that are designed to work well under a wide
	*  variety of distributional assumptions.
	*/
	template<typename RngType = shark::DefaultRngType>
	class Cauchy:public boost::variate_generator<RngType*,boost::cauchy_distribution<> >
	{
	private:
		typedef boost::variate_generator<RngType*,boost::cauchy_distribution<> > Base;
	public:

		/*!
		*  \brief Creates a new %Cauchy random generator instance
		*
		*\param median the median of the distribution
		*\param sigma the width of the distribution
		*\param rng the used random number generator
		*/
		Cauchy(RngType& rng,double median=0,double sigma=1)
			:Base(&rng,boost::cauchy_distribution<>(median,sigma))
		{}

		//! creates a cauchy distributed number using the preset parameters
		using Base::operator();

		/*!
		*\brief creates a cauchy distributed number from parameters
		*
		*\param median the median of the distribution
		*\param sigma the width of the distribution
		*/
		double operator()(double median,double sigma)
		{
			boost::cauchy_distribution<> dist(median,sigma);
			return dist(Base::engine());
		}

		//! returns the current median of the distribution
		double median()const
		{
			return Base::distribution().median();
		}

		//! returns the width of the distribution
		double sigma()const
		{
			return Base::distribution().sigma();
		}
		//! sets the median of the distribution
		//! \param newMedian the new value for the Median
		void median(double newMedian)
		{
			Base::distribution()=boost::cauchy_distribution<>(newMedian,sigma());
		}
		//! sets the width of the distribution
		//! \param newSigma the new value for sigma
		void sigma(double newSigma)
		{
			Base::distribution()=boost::cauchy_distribution<>(median(),newSigma);
		}
		//! Returns the probability for the occurrence of random number "x".
		//! \param x the point for which to calculate the propability
		double p(double x)const {
			return 1.0/(sigma()*M_PI*(1+shark::sqr((x-median())/sigma())));
		}


	};
	//! Returns the entropy of the Cauchy distribution
	template<typename RngType>
	double entropy(const Cauchy<RngType> & distribution);
}
#endif