74 #ifndef SLIP_SIGNAL_HPP
75 #define SLIP_SIGNAL_HPP
95 #include <boost/serialization/access.hpp>
96 #include <boost/serialization/split_member.hpp>
97 #include <boost/serialization/string.hpp>
98 #include <boost/serialization/complex.hpp>
99 #include <boost/serialization/version.hpp>
104 template <
typename T>
107 template <
typename T>
120 bool operator<(const Signal<T>& x,
128 bool operator<=(const Signal<T>& x,
152 template <
typename T>
188 static const std::size_t
DIM = 1;
231 template<
typename InputIterator>
234 vector_(new slip::
Vector<T>(first,last))
672 friend std::ostream& operator<< <>(std::ostream & out,
725 std::fill_n(this->
begin(),this->
size(),value);
747 template<
typename InputIterator>
766 friend bool operator== <>(
const Signal<T>& x,
775 friend bool operator!= <>(
const Signal<T>& x,
784 friend bool operator< <>(
const Signal<T>& x,
793 friend bool operator> <>(
const Signal<T>& x,
802 friend bool operator<= <>(
const Signal<T>& x,
811 friend bool operator>= <>(
const Signal<T>& x,
948 std::string
name()
const;
998 return (this->vector_)->Euclidean_norm();
1007 return (this->vector_)->L2_norm();
1017 return (this->vector_)->L1_norm();
1026 return (this->vector_)->L22_norm();
1035 return (this->vector_)->infinite_norm();
1076 template<
class Archive>
1077 void save(Archive & ar,
const unsigned int version)
const
1081 template<
class Archive>
1082 void load(Archive & ar,
const unsigned int version)
1086 BOOST_SERIALIZATION_SPLIT_MEMBER();
1118 template<
typename T>
1128 template<
typename T>
1138 template<
typename T>
1150 template<
typename T>
1160 template<
typename T>
1170 template<
typename T>
1181 template<
typename T>
1191 template<
typename T>
1201 template<
typename T>
1212 template<
typename T>
1222 template<
typename T>
1235 template<
typename T>
1245 template<
typename T>
1255 template<
typename T>
1264 template<
typename T>
1273 template<
typename T>
1304 template<
typename T>
1335 template<
typename T>
1367 template<
typename T>
1376 template<
typename T>
1385 template<
typename T>
1394 template<
typename T>
1403 template<
typename T>
1412 template<
typename T>
1419 template<
typename T>
1422 vector_(new slip::
Vector<T>())
1425 template<
typename T>
1428 vector_(new slip::
Vector<T>(n))
1431 template<
typename T>
1435 vector_(new slip::
Vector<T>(n,val))
1438 template<
typename T>
1442 vector_(new slip::
Vector<T>(n,val))
1445 template<
typename T>
1448 vector_(new slip::
Vector<T>((*rhs.vector_)))
1451 template<
typename T>
1457 *(this->vector_) = *(rhs.vector_);
1462 template<
typename T>
1469 template<
typename T>
1473 (this->vector_)->
operator=(val);
1477 template<
typename T>
1482 (this->vector_)->resize(new_size,val);
1486 template<
typename T>
1490 return vector_->begin();
1493 template<
typename T>
1497 return vector_->end();
1500 template<
typename T>
1508 template<
typename T>
1517 template<
typename T>
1521 return vector_->rbegin();
1524 template<
typename T>
1528 return vector_->rend();
1531 template<
typename T>
1539 template<
typename T>
1548 template<
typename T>
1553 return vector_->begin(range);
1556 template<
typename T>
1561 return vector_->end(range);
1564 template<
typename T>
1570 return tp->
begin(range);
1573 template<
typename T>
1579 return tp->
end(range);
1583 template<
typename T>
1588 return vector_->begin(box);
1591 template<
typename T>
1596 return vector_->end(box);
1599 template<
typename T>
1605 return tp->
begin(box);
1608 template<
typename T>
1614 return tp->
end(box);
1618 template<
typename T>
1622 return vector_->rbegin(box);
1625 template<
typename T>
1630 return vector_->rend(box);
1633 template<
typename T>
1642 template<
typename T>
1648 return tp->
rend(box);
1651 template<
typename T>
1655 return vector_->rbegin(range);
1658 template<
typename T>
1663 return vector_->rend(range);
1666 template<
typename T>
1672 return tp->
rbegin(range);
1675 template<
typename T>
1681 return tp->
rend(range);
1685 template <
typename T>
1694 template<
typename T>
1698 return (*vector_)[i];
1701 template<
typename T>
1705 return (*vector_)[i];
1708 template<
typename T>
1712 return (*vector_)(i);
1715 template<
typename T>
1719 return (*vector_)(i);
1722 template <
typename T>
1724 typename Signal<T>::reference
1727 return (*vector_)(p);
1730 template <
typename T>
1732 typename Signal<T>::const_reference
1735 return (*vector_)(p);
1738 template<
typename T>
1742 assert(this->vector_ != 0);
1744 assert(range.
start() < (int)this->size());
1745 assert(range.
stop() < (int)this->size());
1746 return Signal<T>(vector_->begin(range),vector_->end(range));
1750 template<
typename T>
1755 template<
typename T>
1759 return (this->vector_)->size();
1762 template<
typename T>
1766 return (this->vector_)->max_size();
1769 template<
typename T>
1773 return (this->vector_)->empty();
1776 template<
typename T>
1780 (this->vector_)->swap(*(V.vector_));
1784 template<
typename T>
1788 (this->vector_)->
operator+=(val);
1792 template<
typename T>
1796 (this->vector_)->
operator-=(val);
1800 template<
typename T>
1804 (this->vector_)->
operator*=(val);
1808 template<
typename T>
1812 (this->vector_)->
operator/=(val);
1817 template<
typename T>
1821 *(this->vector_) = (this->vector_)->operator-();
1825 template<
typename T>
1829 (this->vector_)->
operator+=(*(rhs.vector_));
1833 template<
typename T>
1837 (this->vector_)->
operator-=(*(rhs.vector_));
1841 template<
typename T>
1845 (this->vector_)->
operator*=(*(rhs.vector_));
1849 template<
typename T>
1853 (this->vector_)->
operator/=(*(rhs.vector_));
1857 template<
typename T>
1861 return (this->vector_)->min();
1864 template<
typename T>
1868 return (this->vector_)->max();
1871 template<
typename T>
1875 return (this->vector_)->sum();
1878 template<
typename T>
1882 (this->vector_)->
apply(fun);
1887 template<
typename T>
1891 (this->vector_)->
apply(fun);
1899 template<
typename T>
1906 std::transform(V1.
begin(),V1.
end(),V2.
begin(),tmp.begin(),std::plus<T>());
1911 template<
typename T>
1921 template<
typename T>
1929 template<
typename T>
1936 std::transform(V1.
begin(),V1.
end(),V2.
begin(),tmp.begin(),std::minus<T>());
1940 template<
typename T>
1950 template<
typename T>
1958 template<
typename T>
1965 std::transform(V1.
begin(),V1.
end(),V2.
begin(),tmp.begin(),std::multiplies<T>());
1969 template<
typename T>
1979 template<
typename T>
1987 template<
typename T>
1994 std::transform(V1.
begin(),V1.
end(),V2.
begin(),tmp.begin(),std::divides<T>());
1998 template<
typename T>
2010 template<
typename T>
2017 template<
typename T>
2024 template<
typename T>
2034 template<
typename T>
2043 template<
typename T>
2077 template<
typename T>
2112 template<
typename T>
2145 template<
typename T>
2154 template<
typename T>
2163 template<
typename T>
2172 template<
typename T>
2181 template<
typename T>
2190 template<
typename T>
2201 template<
typename T>
2206 return *(x.vector_) == *(y.vector_);
2209 template<
typename T>
2219 template<
typename T>
2221 bool operator<(const Signal<T>& x,
2224 return *(x.vector_) < *(y.vector_);
2227 template<
typename T>
2235 template<
typename T>
2237 bool operator<=(const Signal<T>& x,
2243 template<
typename T>
2253 #endif //SLIP_SIGNAL_HPP
bool empty() const
Returns true if the Signal is empty. (Thus size() == 0)
HyperVolume< T > tanh(const HyperVolume< T > &M)
bool operator!=(const Array< T > &x, const Array< T > &y)
const Signal< T > const_self
slip::stride_iterator< const_pointer > const_iterator_range
Signal< long double > asin(const Signal< long double > &V)
Signal< T > cosh(const Signal< T > &V)
Signal< T > sqrt(const Signal< T > &V)
reverse_iterator rend()
Returns a read/write reverse iterator that points to one before the first element in the Signal...
norm_type Euclidean_norm() const
Returns the Euclidean norm of the elements of the Signal.
norm_type L1_norm() const
Returns the L1 norm ( ) of the elements of the Signal.
slip::Signal< unsigned short > Signal_us
unsigned long alias
slip::Signal< char > Signal_c
char alias
void resize(const size_type new_n, const T &val=T())
Resizes a Signal.
static const std::size_t DIM
slip::Signal< short > Signal_s
short alias
const value_type * const_pointer
void swap(self &M)
Swaps data with another Signal.
iterator end()
Returns a read/write iterator that points one past the last element in the Vector. Iteration is done in ordinary element order.
norm_type L22_norm() const
Returns the L22 norm ( ) of the elements of the Signal.
~Signal()
Destructor of the Signal.
HyperVolume< T > cosh(const HyperVolume< T > &M)
reference operator()(const size_type i)
Subscript access to the data contained in the Signal.
T & min(const GrayscaleImage< T > &M1)
Returns the min element of a GrayscaleImage.
self & operator*=(const T &val)
Signal< T > sinh(const Signal< T > &V)
Color< T > operator+(const Color< T > &V1, const Color< T > &V2)
std::string name() const
Returns the name of the class.
Signal< T > log(const Signal< T > &V)
norm_type infinite_norm() const
Returns the infinite norm ( ) of the elements of the Signal.
HyperVolume< T > atan(const HyperVolume< T > &M)
std::reverse_iterator< iterator > reverse_iterator
void fill(const T *value)
Fills the container range [begin(),begin()+size()) with a copy of the value array.
void fill(const T &value)
Fills the container range [begin(),begin()+size()) with copies of value.
HyperVolume< T > exp(const HyperVolume< T > &M)
self & operator/=(const T &val)
Provides common linear algebra algorithms.
friend class boost::serialization::access
norm_type L2_norm() const
Returns the Euclidean norm of the elements of the Signal.
HyperVolume< T > abs(const HyperVolume< T > &M)
bool operator>(const Array< T > &x, const Array< T > &y)
slip::stride_iterator< pointer > iterator_range
Signal< T > & apply(T(*fun)(T))
Applys the one-parameter C-function fun to each element of the Signal.
void read_ascii(const std::string &file_path_name)
Read the Signal from an ASCII file.
HyperVolume< T > sin(const HyperVolume< T > &M)
std::reverse_iterator< const_iterator > const_reverse_iterator
const_pointer const_iterator
slip::Signal< unsigned int > Signal_ui
unsigned int alias
Signal< typename slip::lin_alg_traits< T >::value_type > abs(const Signal< T > &V)
HyperVolume< T > cos(const HyperVolume< T > &M)
size_type max_size() const
Returns the maximal size (number of elements) in the Signal.
slip::Signal< double > Signal_d
double alias
This is a point1d class, a specialized version of Point<CoordType,DIM> with DIM = 1...
self & operator=(const self &rhs)
Assign a Signal.
std::reverse_iterator< const_iterator_range > const_reverse_iterator_range
This is a Box1d class, a specialized version of slip::Box<CoordType,DIM> with DIM = 1...
slip::Signal< int > Signal_i
int alias
void copy(_II first, _II last, _OI output_first)
Copy algorithm optimized for slip iterators.
Provides some macros which are used for using complex as real.
bool is_valid() const
Returns true if the range is valid :
SubType start() const
Accessor of the start subscript of the Range.
slip::Signal< unsigned long > Signal_ul
unsigned long alias
reverse_iterator rbegin()
Returns a read/write reverse iterator that points to the last element in the Signal. Iteration is done in reverse element order.
Numerical Vector class. This container statisfies the RandomAccessContainer concepts of the Standard ...
slip::Signal< float > Signal_f
float alias
HyperVolume< T > sqrt(const HyperVolume< T > &M)
const value_type & const_reference
HyperVolume< T > sinh(const HyperVolume< T > &M)
size_type size() const
Returns the number of elements in the Signal.
self & operator+=(const T &val)
Add val to each element of the Signal.
std::reverse_iterator< iterator_range > reverse_iterator_range
Signal< T > cos(const Signal< T > &V)
Signal< long double > atan(const Signal< long double > &V)
iterator begin()
Returns a read/write iterator that points to the first element in the Signal. Iteration is done in or...
void fill(InputIterator first, InputIterator last)
Fills the container range [begin(),begin()+size()) with a copy of the range [first,last)
reverse_iterator rbegin()
Returns a read/write reverse iterator that points to the last element in the Vector. Iteration is done in reverse element order.
Signal(InputIterator first, InputIterator last)
Contructs a Signal from a range.
std::ostream & operator<<(std::ostream &out, const Array< T > &a)
Signal< T > sin(const Signal< T > &V)
reverse_iterator rend()
Returns a read/write reverse iterator that points to one before the first element in the Vector...
HyperVolume< T > log(const HyperVolume< T > &M)
Signal< T > exp(const Signal< T > &V)
void write_ascii(const std::string &file_path_name) const
Write the Signal to an ASCII file.
self & operator-=(const T &val)
HyperVolume< T > acos(const HyperVolume< T > &M)
HyperVolume< T > log10(const HyperVolume< T > &M)
Signal< T > tanh(const Signal< T > &V)
iterator default_iterator
slip::lin_alg_traits< value_type >::value_type norm_type
const_iterator const_default_iterator
Provides some algorithms to apply C like functions to ranges.
ptrdiff_t difference_type
Provides a class to iterate a 1d range according to a step.
T & max() const
Returns the max element of the Signal according to the operator >, if T is std::complex, it returns the element of maximum magnitude.
Numerical Signal class. This container statisfies the RandomAccessContainer concepts of the Standard ...
T & min() const
Returns the min element of the Signal according to the operator < if T is std::complex, it returns the element of minimum magnitude.
HyperVolume< T > tan(const HyperVolume< T > &M)
bool operator==(const Array< T > &x, const Array< T > &y)
Signal< long double > acos(const Signal< long double > &V)
HyperVolume< T > asin(const HyperVolume< T > &M)
Signal< T > tan(const Signal< T > &V)
slip::Signal< unsigned char > Signal_uc
unsigned char alias
T sum() const
Returns the sum of the elements of the Signal.
Color< T > operator*(const Color< T > &V1, const Color< T > &V2)
Signal()
Constructs a Signal.
Signal< T > log10(const Signal< T > &V)
Provides a class to manipulate 1d box.
void apply(InputIterator first, InputIterator last, OutputIterator result, typename std::iterator_traits< OutputIterator >::value_type(*function)(typename std::iterator_traits< InputIterator >::value_type))
Applies a C-function to each element of a range.
Provides a class to manipulate numerical vectors.
T & max(const GrayscaleImage< T > &M1)
Returns the max element of a GrayscaleImage.
SubType stop() const
Accessor of the stop subscript of the Range.
iterator begin()
Returns a read/write iterator that points to the first element in the Vector. Iteration is done in or...
Color< T > operator/(const Color< T > &V1, const Color< T > &V2)
bool operator>=(const Array< T > &x, const Array< T > &y)
Color< T > operator-(const Color< T > &V1, const Color< T > &V2)
iterator end()
Returns a read/write iterator that points one past the last element in the Signal. Iteration is done in ordinary element order.
reference operator[](const size_type i)
Subscript access to the data contained in the Signal.
slip::Signal< long > Signal_l
long alias
Provides some algorithms to compute norms.