Signal/Geometry Processing Library (SPL) 1.1.24 |

Classes | Typedefs | Functions
One-Dimensional Sequences
Arrays and Sequences

One-dimensional sequences. More...

## Classes
class | SPL::Sequence1< T >
| A one-dimensional sequence class with lazy copying and reference counting. More...

## Typedefs
typedef Sequence1< double > | SPL::RealSequence1
| Real sequence. More...
typedef Sequence1< int > | SPL::IntSequence1
| Integer sequence. More...

## Functions
template<class T >
std::ostream & | SPL::operator<< (std::ostream &out, const Sequence1< T > &f)
| Output a sequence to a stream. More...
template<class T >
std::istream & | SPL::operator>> (std::istream &in, Sequence1< T > &f)
| Input a sequence from a stream. More...
template<class T >
SPL_SEQUENCE1_INLINE Sequence1< T > | SPL::operator+ (const Sequence1< T > &f, const Sequence1< T > &g)
| Compute the sum of two sequences. More...
template<class T >
SPL_SEQUENCE1_INLINE Sequence1< T > | SPL::operator- (const Sequence1< T > &f, const Sequence1< T > &g)
| Compute the difference of two sequences. More...
template<class T >
SPL_SEQUENCE1_INLINE Sequence1< T > | SPL::operator* (const Sequence1< T > &f, const Sequence1< T > &g)
| Compute the (element-wise) product of two sequences. More...
template<class T >
SPL_SEQUENCE1_INLINE Sequence1< T > | SPL::operator/ (const Sequence1< T > &f, const Sequence1< T > &g)
| Compute the (element-wise) quotient of two sequences. More...
template<class T >
Sequence1< T > | SPL::add (const Sequence1< T > &f, const Sequence1< T > &g)
| Compute the sum of two sequences with potentially differing domains. More...
template<class T >
SPL_SEQUENCE1_INLINE Sequence1< T > | SPL::operator+ (const T &a, const Sequence1< T > &f)
| Add a value to a sequence. More...
template<class T >
SPL_SEQUENCE1_INLINE Sequence1< T > | SPL::operator+ (const Sequence1< T > &f, const T &a)
| Add a value to a sequence. More...
template<class T >
SPL_SEQUENCE1_INLINE Sequence1< T > | SPL::operator- (const Sequence1< T > &f, const T &a)
| Subtract a value from a sequence. More...
template<class T >
SPL_SEQUENCE1_INLINE Sequence1< T > | SPL::operator* (const T &a, const Sequence1< T > &f)
| Compute a scalar multiple of a sequence. More...
template<class T >
SPL_SEQUENCE1_INLINE Sequence1< T > | SPL::operator* (const Sequence1< T > &f, const T &a)
| Compute a scalar multiple of a sequence. More...
template<class T >
SPL_SEQUENCE1_INLINE Sequence1< T > | SPL::operator/ (const Sequence1< T > &f, const T &a)
| Divide a sequence by a scalar. More...
template<class T >
SPL_SEQUENCE1_INLINE bool | SPL::operator== (const Sequence1< T > &f, const Sequence1< T > &g)
| Test two sequences for equality. More...
template<class T >
SPL_SEQUENCE1_INLINE bool | SPL::operator!= (const Sequence1< T > &f, const Sequence1< T > &g)
| Test two sequences for inequality. More...
template<class T >
SPL_SEQUENCE1_INLINE bool | SPL::approxEqual (const Sequence1< T > &f, const Sequence1< T > &g, T threshold=1e-9)
| Test two sequences for approximate equality. More...
template<class T >
Sequence1< T > | SPL::subsequence (const Sequence1< T > &f, int startInd, int size)
| Extract a subsequence from a sequence. More...
template<class T >
SPL_SEQUENCE1_INLINE Sequence1< T > | SPL::translate (const Sequence1< T > &f, int delta)
| Translate a sequence by the specified amount. More...
template<class T >
Sequence1< T > | SPL::convolve (const Sequence1< T > &f, const Sequence1< T > &g, int mode=ConvolveMode::full)
| Compute the convolution of two sequences. More...
template<class T >
Sequence1< T > | SPL::downsample (const Sequence1< T > &f, int factor)
| Downsample a sequence by the specified factor. More...
template<class T >
Sequence1< T > | SPL::upsample (const Sequence1< T > &f, int factor, int pad=0)
| Upsample a sequence by the specified factor. More...
template<class T >
Array1< Sequence1< T > > | SPL::polyphaseSplit (const Sequence1< T > &seq, int type, int numPhases)
| Split a sequence into its polyphase components. More...
template<class T >
Sequence1< T > | SPL::polyphaseJoin (const Array1< Sequence1< T > > &comps, int type)
| Reassemble a sequence from its polyphase components. More...
| SPL::Sequence1< T >::Sequence1 ()
| The default constructor. More...
| SPL::Sequence1< T >::Sequence1 (int startInd, int size)
| Construct a sequence with the specified start index and size. More...
| SPL::Sequence1< T >::Sequence1 (int startInd, int size, const T &value)
| Construct a sequence with the specified start index and size, with all elements set to the given value. More...
| SPL::Sequence1< T >::Sequence1 (const Array1< T > &data)
| Create a sequence from an array. More...
| SPL::Sequence1< T >::Sequence1 (int startInd, const Array1< T > &data)
| Create a sequence from an array using the given starting index. More...
| SPL::Sequence1< T >::Sequence1 (const Sequence1 &f)
| The copy constructor. More...
| SPL::Sequence1< T >::~Sequence1 ()
| The destructor. More...
Sequence1 & | SPL::Sequence1< T >::operator= (const Sequence1 &f)
| The assignment operator. More...
Sequence1 & | SPL::Sequence1< T >::operator+= (const Sequence1 &f)
| Add another sequence to this one. More...
Sequence1 & | SPL::Sequence1< T >::operator-= (const Sequence1 &f)
| Subtract another sequence from this one. More...
Sequence1 & | SPL::Sequence1< T >::operator*= (const Sequence1 &f)
| Multiply elementwise this sequence by another one. More...
Sequence1 & | SPL::Sequence1< T >::operator/= (const Sequence1 &f)
| Divide elementwise this sequence by another one. More...
Sequence1 & | SPL::Sequence1< T >::operator+= (const T &value)
| Add a value to each element of this sequence. More...
Sequence1 & | SPL::Sequence1< T >::operator-= (const T &value)
| Subtract a value from each element of this sequence. More...
Sequence1 & | SPL::Sequence1< T >::operator*= (const T &value)
| Multiply each element of this sequence by the specified value. More...
Sequence1 & | SPL::Sequence1< T >::operator/= (const T &value)
| Divide each element of the sequence by the given value. More...
int | SPL::Sequence1< T >::getStartInd () const
| Get the start index for the sequence. More...
int | SPL::Sequence1< T >::getEndInd () const
| Get the end index for the sequence. More...
int | SPL::Sequence1< T >::getSize () const
| Get the length of the sequence. More...
bool | SPL::Sequence1< T >::isShared () const
| Is the array for this sequence shared with another array? More...
const T & | SPL::Sequence1< T >::operator() (int i) const
| Get the specified element in the sequence. More...
T & | SPL::Sequence1< T >::operator() (int i)
| Get the specified element in the sequence. More...
ConstIterator | SPL::Sequence1< T >::begin () const
| Get an iterator referencing the first element in the sequence. More...
ConstIterator | SPL::Sequence1< T >::end () const
| Get an iterator referencing just after the last element in the sequence. More...
Iterator | SPL::Sequence1< T >::begin ()
| Get an iterator referencing the first element in the sequence. More...
Iterator | SPL::Sequence1< T >::end ()
| Get an iterator referencing just after the last element in the sequence. More...
T | SPL::Sequence1< T >::min () const
| Get the minimum element in the sequence. More...
T | SPL::Sequence1< T >::max () const
| Get the maximum element in the sequence. More...
T | SPL::Sequence1< T >::sum () const
| Get the sum of the elements in the sequence. More...
void | SPL::Sequence1< T >::swapArray (Array1< T > &data)
| Swap the data for the underlying array and the specified array. More...
void | SPL::Sequence1< T >::fill (const T &value)
| Set all of the elements in the sequence to the specified value. More...
Array1< T > | SPL::Sequence1< T >::getArray () const
| Get a copy of the underlying array. More...
Sequence1 & | SPL::Sequence1< T >::translate (int delta)
| Translate (i.e., shift) a sequence by the specified displacement. More...

## Detailed Description

One-dimensional sequences.

## Typedef Documentation

typedef Sequence1<int> SPL::IntSequence1

Integer sequence.

typedef Sequence1<double> SPL::RealSequence1

Real sequence.

## Function Documentation

template<class T >

Sequence1<T> SPL::add | ( | const Sequence1< T > & | f,
|  | const Sequence1< T > & | g
| ) |  |

Compute the sum of two sequences with potentially differing domains.

Effects: The sum of the sequences f and g is computed. The domain of the sum is taken to be the smallest domain that contains the domains of both of the sequences being summed.

Returns: The sum is returned.

template<class T >

SPL_SEQUENCE1_INLINE bool SPL::approxEqual | ( | const Sequence1< T > & | f,
|  | const Sequence1< T > & | g,
|  | T | threshold = `1e-9`
| ) |  |

Test two sequences for approximate equality.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1< T >::ConstIterator SPL::Sequence1< T >::begin | ( |  | ) | const

Get an iterator referencing the first element in the sequence.

Returns: An iterator referencing the first element in the sequence (i.e., the element with index getStartInd()) is returned.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1< T >::Iterator SPL::Sequence1< T >::begin | ( |  | ) |

Get an iterator referencing the first element in the sequence.

Returns: An iterator referencing the first element in the sequence (i.e., the element with index getStartInd()) is returned.

template<class T >

Sequence1<T> SPL::convolve | ( | const Sequence1< T > & | f,
|  | const Sequence1< T > & | g,
|  | int | mode = `ConvolveMode::full`
| ) |  |

Compute the convolution of two sequences.

Effects: The convolution of the sequences f and g is computed. The domain of the resulting sequence (as well as how boundaries are handled) depends on the convolution mode mode. The "full" mode is the same as the "full" mode in MATLAB. The "sameDomainZeroExt" mode is the same as the "same" mode in MATLAB.

Returns: A sequence containing the convolution result is returned.

template<class T >

Sequence1<T> SPL::downsample | ( | const Sequence1< T > & | f,
|  | int | factor
| ) |  |

Downsample a sequence by the specified factor.

Effects: The sequence f is downsampled by the factor factor.

Returns: The downsampled sequence is returned.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1< T >::ConstIterator SPL::Sequence1< T >::end | ( |  | ) | const

Get an iterator referencing just after the last element in the sequence.

Returns: An iterator for the end of the sequence (i.e., one past the last element) is returned.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1< T >::Iterator SPL::Sequence1< T >::end | ( |  | ) |

Get an iterator referencing just after the last element in the sequence.

Returns: An iterator for the end of the sequence (i.e., one past the last element) is returned.

template<class T >

SPL_SEQUENCE1_INLINE void SPL::Sequence1< T >::fill | ( | const T & | value | ) |

Set all of the elements in the sequence to the specified value.

Effects: Each elements in the sequence is set to the value value.

template<class T >

SPL_SEQUENCE1_INLINE Array1< T > SPL::Sequence1< T >::getArray | ( |  | ) | const

Get a copy of the underlying array.

template<class T >

SPL_SEQUENCE1_INLINE int SPL::Sequence1< T >::getEndInd | ( |  | ) | const

Get the end index for the sequence.

Returns: The ending index (i.e., one past the last valid index) is returned.

template<class T >

SPL_SEQUENCE1_INLINE int SPL::Sequence1< T >::getSize | ( |  | ) | const

Get the length of the sequence.

Returns: The number of elements in the sequence is returned. This value is equivalent to getEndInd() - getStartInd().

template<class T >

SPL_SEQUENCE1_INLINE int SPL::Sequence1< T >::getStartInd | ( |  | ) | const

Get the start index for the sequence.

Returns: The starting index for the sequence is returned.

template<class T >

SPL_SEQUENCE1_INLINE bool SPL::Sequence1< T >::isShared | ( |  | ) | const

Is the array for this sequence shared with another array?

template<class T >

SPL_SEQUENCE1_INLINE T SPL::Sequence1< T >::max | ( |  | ) | const

Get the maximum element in the sequence.

The sequence must contain at least one element.

template<class T >

SPL_SEQUENCE1_INLINE T SPL::Sequence1< T >::min | ( |  | ) | const

Get the minimum element in the sequence.

The sequence must contain at least one element.

template<class T >

SPL_SEQUENCE1_INLINE bool SPL::operator!= | ( | const Sequence1< T > & | f,
|  | const Sequence1< T > & | g
| ) |  |

Test two sequences for inequality.

template<class T >

SPL_SEQUENCE1_INLINE const T & SPL::Sequence1< T >::operator() | ( | int | i | ) | const

Get the specified element in the sequence.

Returns: A reference to the i-th element in the sequence is returned.

template<class T >

SPL_SEQUENCE1_INLINE T & SPL::Sequence1< T >::operator() | ( | int | i | ) |

Get the specified element in the sequence.

Returns: A reference to the i-th element in the sequence is returned.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1<T> SPL::operator* | ( | const Sequence1< T > & | f,
|  | const Sequence1< T > & | g
| ) |  |

Compute the (element-wise) product of two sequences.

Returns: The element-wise product of the sequences f and g is returned. Both sequences must have the same domain.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1<T> SPL::operator* | ( | const T & | a,
|  | const Sequence1< T > & | f
| ) |  |

Compute a scalar multiple of a sequence.

Returns: The sequence f multiplied by the value a is returned.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1<T> SPL::operator* | ( | const Sequence1< T > & | f,
|  | const T & | a
| ) |  |

Compute a scalar multiple of a sequence.

Returns: The sequence f multiplied by the value a is returned.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1< T > & SPL::Sequence1< T >::operator*= | ( | const Sequence1< T > & | f | ) |

Multiply elementwise this sequence by another one.

Effects: This sequence is multiplied (element-wise) by the sequence f. Both sequences must have the same domain.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1< T > & SPL::Sequence1< T >::operator*= | ( | const T & | value | ) |

Multiply each element of this sequence by the specified value.

Effects: This sequence is multiplied by the element value value.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1<T> SPL::operator+ | ( | const Sequence1< T > & | f,
|  | const Sequence1< T > & | g
| ) |  |

Compute the sum of two sequences.

Returns: The sum of the sequences f and g is returned. Both sequences must have the same domain.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1<T> SPL::operator+ | ( | const T & | a,
|  | const Sequence1< T > & | f
| ) |  |

Add a value to a sequence.

Returns: The sequence f with a added to each of its elements is returned.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1<T> SPL::operator+ | ( | const Sequence1< T > & | f,
|  | const T & | a
| ) |  |

Add a value to a sequence.

Returns: The sequence f with a added to each of its elements is returned.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1< T > & SPL::Sequence1< T >::operator+= | ( | const Sequence1< T > & | f | ) |

Add another sequence to this one.

Effects: The sequence f is added to this sequence. Both sequences must have the same domain.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1< T > & SPL::Sequence1< T >::operator+= | ( | const T & | value | ) |

Add a value to each element of this sequence.

Effects: The value value is added to each element of the sequence.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1<T> SPL::operator- | ( | const Sequence1< T > & | f,
|  | const Sequence1< T > & | g
| ) |  |

Compute the difference of two sequences.

Returns: The difference between the sequence f and sequence g (i.e., f - g) is returned. Both sequences must have the same domain.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1<T> SPL::operator- | ( | const Sequence1< T > & | f,
|  | const T & | a
| ) |  |

Subtract a value from a sequence.

Returns: The sequence f with a subtracted from each of its elements is returned.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1< T > & SPL::Sequence1< T >::operator-= | ( | const Sequence1< T > & | f | ) |

Subtract another sequence from this one.

Effects: The sequence f is subtracted from this sequence. Both sequences must have the same domain.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1< T > & SPL::Sequence1< T >::operator-= | ( | const T & | value | ) |

Subtract a value from each element of this sequence.

Effects: The value value is subtracted from each element of the sequence.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1<T> SPL::operator/ | ( | const Sequence1< T > & | f,
|  | const Sequence1< T > & | g
| ) |  |

Compute the (element-wise) quotient of two sequences.

Returns: The element-wise quotient of the sequences f and g is returned. Both sequences must have the same domain.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1<T> SPL::operator/ | ( | const Sequence1< T > & | f,
|  | const T & | a
| ) |  |

Divide a sequence by a scalar.

Returns: The sequence f divided by the value a is returned.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1< T > & SPL::Sequence1< T >::operator/= | ( | const Sequence1< T > & | f | ) |

Divide elementwise this sequence by another one.

Effects: This sequence is divided (element-wise) by the sequence f. Both sequences must have the same domain.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1< T > & SPL::Sequence1< T >::operator/= | ( | const T & | value | ) |

Divide each element of the sequence by the given value.

Effects: Each element of the sequence is divided by the value value.

template<class T >

std::ostream& SPL::operator<< | ( | std::ostream & | out,
|  | const Sequence1< T > & | f
| ) |  |

Output a sequence to a stream.

Effects: The sequence f is written to the output stream out. The output consists of the following information in order: 1) the starting index of the sequence 2) the size of the sequence 3) the elements of the sequence in increasing order of index

Returns: A reference to the stream out is returned.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1< T > & SPL::Sequence1< T >::operator= | ( | const Sequence1< T > & | f | ) |

The assignment operator.

template<class T >

SPL_SEQUENCE1_INLINE bool SPL::operator== | ( | const Sequence1< T > & | f,
|  | const Sequence1< T > & | g
| ) |  |

Test two sequences for equality.

In order for two sequences to be deemed equal, they must be defined on the same domain and have their element values match everywhere in this domain.

template<class T >

std::istream& SPL::operator>> | ( | std::istream & | in,
|  | Sequence1< T > & | f
| ) |  |

Input a sequence from a stream.

Effects: The sequence f is read from the input stream in. The data is read in a format consistent with that used by operator<<.

Returns: A reference to the stream in is returned.

template<class T >

Sequence1<T> SPL::polyphaseJoin | ( | const Array1< Sequence1< T > > & | comps,
|  | int | type
| ) |  |

Reassemble a sequence from its polyphase components.

Effects: A sequence is recomposed from its polyphase components comps. A polyphase decomposition of type type is assumed.

Returns: The recomposed sequence is returned.

template<class T >

Array1<Sequence1<T> > SPL::polyphaseSplit | ( | const Sequence1< T > & | seq,
|  | int | type,
|  | int | numPhases
| ) |  |

Split a sequence into its polyphase components.

Effects: The polyphase decomposition of the sequence seq is computed. In particular, the polyphase decomposition with numPhases phases and type type is computed.

Returns: An array containing the polyphase components is returned.

template<class T >

SPL_SEQUENCE1_INLINE SPL::Sequence1< T >::Sequence1 | ( |  | ) |

The default constructor.

template<class T >

SPL_SEQUENCE1_INLINE SPL::Sequence1< T >::Sequence1 | ( | int | startInd,
|  | int | size
| ) |  |

Construct a sequence with the specified start index and size.

Effects: A sequence with a starting index of startInd and size size is created. The elements in the sequence are default constructed!

template<class T >

SPL_SEQUENCE1_INLINE SPL::Sequence1< T >::Sequence1 | ( | int | startInd,
|  | int | size,
|  | const T & | value
| ) |  |

Construct a sequence with the specified start index and size, with all elements set to the given value.

Effects: A sequence with a starting index of startInd and size size is created, with all elements initialized to the value value.

template<class T >

SPL_SEQUENCE1_INLINE SPL::Sequence1< T >::Sequence1 | ( | const Sequence1< T > & | f | ) |

The copy constructor.

template<class T >

SPL_SEQUENCE1_INLINE SPL::Sequence1< T >::Sequence1 | ( | const Array1< T > & | data | ) |

Create a sequence from an array.

template<class T >

SPL_SEQUENCE1_INLINE SPL::Sequence1< T >::Sequence1 | ( | int | startInd,
|  | const Array1< T > & | data
| ) |  |

Create a sequence from an array using the given starting index.

template<class T >

Sequence1<T> SPL::subsequence | ( | const Sequence1< T > & | f,
|  | int | startInd,
|  | int | size
| ) |  |

Extract a subsequence from a sequence.

Effects: The subsequence with start index startInd and size size is extracted from the sequence f.

Returns: The extracted subsequence is returned.

template<class T >

SPL_SEQUENCE1_INLINE T SPL::Sequence1< T >::sum | ( |  | ) | const

Get the sum of the elements in the sequence.

template<class T >

SPL_SEQUENCE1_INLINE void SPL::Sequence1< T >::swapArray | ( | Array1< T > & | data | ) |

Swap the data for the underlying array and the specified array.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1< T > & SPL::Sequence1< T >::translate | ( | int | delta | ) |

Translate (i.e., shift) a sequence by the specified displacement.

template<class T >

SPL_SEQUENCE1_INLINE Sequence1<T> SPL::translate | ( | const Sequence1< T > & | f,
|  | int | delta
| ) |  |

Translate a sequence by the specified amount.

Effects: The sequence f is translated (i.e., time shifted) by i. For example, if the sequence f is defined on the domain a, a+1, ..., b, then the translated sequence will be defined on the domain a+i, a+i+1, ..., b+i.

Returns: The translated sequence is returned.

template<class T >

Sequence1<T> SPL::upsample | ( | const Sequence1< T > & | f,
|  | int | factor,
|  | int | pad = `0`
| ) |  |

Upsample a sequence by the specified factor.

Effects: The sequence f is upsampled by the factor factor. If pad is zero, new samples will only be added between the first and last sample. Up to (factor - 1) extra new samples can be added at the end of the new sequence, by specifying a nonzero value for pad. The default is no padding.

Returns: The upsampled sequence is returned.

template<class T >

SPL_SEQUENCE1_INLINE SPL::Sequence1< T >::~Sequence1 | ( |  | ) |

The destructor.