/usr/include/itpp/signal/source.h is in libitpp-dev 4.2-4.
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 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | /*!
* \file
* \brief Deterministic sources - header file
* \author Tobias Ringstrom and Tony Ottosson
*
* -------------------------------------------------------------------------
*
* Copyright (C) 1995-2010 (see AUTHORS file for a list of contributors)
*
* This file is part of IT++ - a C++ library of mathematical, signal
* processing, speech processing, and communications classes and functions.
*
* IT++ 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 3 of the License, or (at your option) any
* later version.
*
* IT++ 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 IT++. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef SOURCE_H
#define SOURCE_H
#include <itpp/base/vec.h>
namespace itpp
{
//! \addtogroup detsource
/*!
\brief Sine-wave source
\ingroup detsource
*/
class Sine_Source
{
public:
//! Constructor. Set frequency, mean, amplitude, and start phase
Sine_Source(double freq, double mean = 0.0, double ampl = 1.0, double inphase = 0.0);
//! Return a single sample
double operator()() { return sample(); }
//! Get a sample vector.
vec operator()(int n);
//! Get a sample matrix.
mat operator()(int h, int w);
protected:
private:
double sample();
double m, A, theta, dtheta;
};
/*!
\brief Square-wave source
\ingroup detsource
*/
class Square_Source
{
public:
//! Constructor. Set frequency, mean, amplitude, and start phase
Square_Source(double freq, double mean = 0.0, double ampl = 1.0, double inphase = 0.0);
//! Return a single sample
double operator()() { return sample(); }
//! Get a sample vector.
vec operator()(int n);
//! Get a sample matrix.
mat operator()(int h, int w);
protected:
private:
double sample();
double m, A, theta, dtheta;
};
/*!
\brief Triangle-wave source
\ingroup detsource
*/
class Triangle_Source
{
public:
//! Constructor. Set frequency, mean, amplitude and start phase
Triangle_Source(double freq, double mean = 0.0, double ampl = 1.0, double inphase = 0.0);
//! Return a single sample
double operator()() { return sample(); }
//! Get a sample vector.
vec operator()(int n);
//! Get a sample matrix.
mat operator()(int h, int w);
protected:
private:
double sample();
double m, A, theta, dtheta;
};
/*!
\brief Sawtooth-wave source
\ingroup detsource
*/
class Sawtooth_Source
{
public:
//! Constructor. Set frequency, mean, amplitude, and start phase
Sawtooth_Source(double freq, double mean = 0.0, double ampl = 1.0, double inphase = 0.0);
//! Return a single sample
double operator()() { return sample(); }
//! Get a sample vector.
vec operator()(int n);
//! Get a sample matrix.
mat operator()(int h, int w);
protected:
private:
double sample();
double m, A, theta, dtheta;
};
/*!
\brief Impulse source
\ingroup detsource
*/
class Impulse_Source
{
public:
//! Constructor. Set frequency, amplitude and start phase
Impulse_Source(double freq, double ampl = 1.0, double inphase = 0.0);
//! Return a single sample
double operator()() { return sample(); }
//! Get a sample vector.
vec operator()(int n);
//! Get a sample matrix.
mat operator()(int h, int w);
protected:
private:
double sample();
double A, pos, dtheta;
};
/*!
\brief Pattern source
\ingroup detsource
*/
class Pattern_Source
{
public:
//! Constructor. Set pattern and start position
Pattern_Source(const vec &pattern, int start_pos = 0);
//! Destructor
virtual ~Pattern_Source() { }
//! Return a single sample
double operator()() { return sample(); }
//! Get a sample vector.
vec operator()(int n);
//! Get a sample matrix.
mat operator()(int h, int w);
protected:
private:
double sample();
int pos;
vec pat;
double mean, var;
};
} //namespace itpp
#endif // #ifndef SOURCE_H
|