Type:
Template class providing operations common to vectors and images Template parameters: T - vector element type eg. int R - return type for norms etc. S - dimension specifying class eg. ImageSize |
ProtoVector | (const S& init_size) ; |
Construct given desired size |
ProtoVector | (const S& init_size, T elt) ; |
Construct given desired vsize and initial value |
~ProtoVector | () ; |
ProtoVector | (const ProtoVector<unsigned short, real, S>& ip) ; |
Copy constructor and conversions between types with different T |
ProtoVector | (const ProtoVector<float, float, S>& ip) ; |
template <class P, class Q> ProtoVector | (const ProtoVector<P, Q, S>& v) ; |
ProtoVector<T, R, S>& operator= | (const ProtoVector<T, R, S>& v) ; |
Assignment operator |
T& pv_elt | (unsigned int i) const ; |
Return reference to vector element |
const S& size | () const ; |
Return object vsize |
bool operator== | (ProtoVector<T, R, S>& u) const ; |
Swap internals of two objects Equality check |
bool operator!= | (ProtoVector<T, R, S>& u) const ; |
Inquality check |
ProtoVector<T, R, S>& sum | (const ProtoVector<T, R, S>& u, const ProtoVector<T, R, S>& v) ; |
Add two vectors (*this is the destination of the sum) |
ProtoVector<T, R, S>& dif | (const ProtoVector<T, R, S>& u, const ProtoVector<T, R, S>& v) ; |
Subtract one vector from another |
ProtoVector<T, R, S>& sum | (const ProtoVector<T, R, S>& u, T k) ; |
Add a scalar to all elements of a vector |
ProtoVector<T, R, S>& dif | (const ProtoVector<T, R, S>& u, T k) ; |
Subtract a scalar from all elements of a vector |
ProtoVector<T, R, S>& dif | (T k, const ProtoVector<T, R, S>& u) ; |
Subtract all elements of a vector from a scalar |
ProtoVector<T, R, S>& prod | (const ProtoVector<T, R, S>& u, R k) ; |
Multiply a vector by a scalar |
ProtoVector<T, R, S>& abs | (const ProtoVector<T, R, S>& u) ; |
Absolute value of all elements |
ProtoVector<T, R, S>& clip | (const ProtoVector<T, R, S>& u, T lower, T upper) ; |
Clip range of elements |
R normL1 | () const ; |
Inner product L_1 norm |
R normL2 | () const ; |
L_2 norm |
R normLp | (R p) const ; |
L_p norm |
R sum | () const ; |
Sum of elements in vector |
R sum2 | () const ; |
Sum of squares of elements in a vector |
R mean | () const ; |
Deterministic mean of vector elements |
R variance | () const ; |
Deterministic variance of vector elements |
R origin_moment | (unsigned int k) const ; |
Deterministic moment about the origin |
R mean_moment | (unsigned int k) const ; |
Deterministic moment about the mean |
T min | () const ; |
Minimum element in vector |
T max | () const ; |
Maximum element in vector |
T rank | (unsigned int k) const ; |
Element of rank k in vector |
bool raw_write | (ofstream& ofs) const ; |
Write file in raw format. Returns true on success, false on failure |
bool raw_write | (char* filename) const ; |
bool raw_read | (ifstream& ifs) ; |
Read file in raw format (vector on disk assumed same size as *this) |
bool raw_read | (char* filename) ; |
Allocate memory for vector of specified size. Returns false on failure, true on success. No memory allocated if none required for init_size, in which case method returns successfully |
Re-allocates memory for vector if specified size differs from existing size (in which case previous contents deleted). Returns false on failure, true on success. |
De-allocate memory |
Return pointer to array containing vector data |
Set pointer to array containing vector data |
Set recorded vector size without changing actual data |
Construct given a size and a block of data |