ovector_view_tlate Class Template Reference

#include <ovector_tlate.h>

Inheritance diagram for ovector_view_tlate:

omatrix_col_tlate omatrix_const_col_tlate omatrix_const_row_tlate omatrix_diag_tlate omatrix_row_tlate ovector_array_stride_tlate ovector_array_tlate ovector_const_array_stride_tlate ovector_const_array_tlate ovector_const_reverse_tlate ovector_const_subvector_reverse_tlate ovector_const_subvector_tlate ovector_cx_imag_tlate ovector_cx_real_tlate ovector_reverse_tlate ovector_subvector_reverse_tlate ovector_subvector_tlate ovector_tlate ovector_tlate< double, gsl_vector, gsl_block >

Detailed Description

template<class data_t, class vparent_t, class block_t>
class ovector_view_tlate< data_t, vparent_t, block_t >

A vector view with finite stride.

Todo:
Check about self assignment as noted in http://www.cs.caltech.edu/courses/cs11/material/cpp/donnie/cpp-ops.html
Todo:
Need to double-check and ensure operator[] and operator() are properly available on all of the various ovector_view children.
Idea for future:
Consider an operator== ?

Definition at line 59 of file ovector_tlate.h.


Public Member Functions

Copy constructors
 ovector_view_tlate (const ovector_view_tlate &v)
 Shallow copy constructor - create a new view of the same vector.
ovector_view_tlateoperator= (const ovector_view_tlate &v)
 Shallow copy constructor - create a new view of the same vector.
 ovector_view_tlate (const uvector_view_tlate< data_t > &v)
 Shallow copy constructor - view a unit-stride vector.
ovector_view_tlateoperator= (const uvector_view_tlate< data_t > &v)
 Shallow copy constructor - view a unit-stride vector.
Get and set methods
data_t & operator[] (size_t i)
 Array-like indexing.
const data_t & operator[] (size_t i) const
 Array-like indexing.
data_t & operator() (size_t i)
 Array-like indexing.
const data_t & operator() (size_t i) const
 Array-like indexing.
data_t get (size_t i) const
 Get (with optional range-checking).
data_t * get_ptr (size_t i)
 Get pointer (with optional range-checking).
const data_t * get_const_ptr (size_t i) const
 Get pointer (with optional range-checking).
int set (size_t i, data_t val)
 Set (with optional range-checking).
int set_all (double val)
 Set all of the value to be the value val.
size_t size () const
 Method to return vector size.
size_t capacity () const
 Method to return capacity.
size_t stride () const
 Method to return vector stride.
Arithmetic
ovector_view_tlate< data_t,
vparent_t, block_t > & 
operator+= (const ovector_view_tlate< data_t, vparent_t, block_t > &x)
 operator+=
ovector_view_tlate< data_t,
vparent_t, block_t > & 
operator-= (const ovector_view_tlate< data_t, vparent_t, block_t > &x)
 operator-=
ovector_view_tlate< data_t,
vparent_t, block_t > & 
operator+= (data_t &x)
 operator+=
ovector_view_tlate< data_t,
vparent_t, block_t > & 
operator-= (data_t &x)
 operator-=
ovector_view_tlate< data_t,
vparent_t, block_t > & 
operator*= (const data_t &y)
 operator*=
data_t norm () const
 Norm.
Other methods
int swap (ovector_view_tlate< data_t, vparent_t, block_t > &x)
 Swap vectors.
bool is_owner () const
 Return true if this object owns the data it refers to.
size_t lookup (const data_t x0) const
 Exhaustively look through the array for a particular value.
data_t max () const
 Find the maximum element.
size_t max_index () const
 Find the location of the maximum element.
data_t min () const
 Find the minimum element.
size_t min_index () const
 Find the location of the minimum element.
vparent_t * get_gsl_vector ()
 Return a gsl vector.
const vparent_t * get_gsl_vector_const () const
 Return a const gsl vector.

Protected Member Functions

 ovector_view_tlate ()
 Empty constructor provided for use by ovector_tlate(const ovector_tlate &v).

Member Function Documentation

size_t size (  )  const [inline]

Method to return vector size.

If no memory has been allocated, this will quietly return zero.

Definition at line 253 of file ovector_tlate.h.

size_t capacity (  )  const [inline]

Method to return capacity.

Analogous to std::vector<>.capacity()

Definition at line 262 of file ovector_tlate.h.

size_t stride (  )  const [inline]

Method to return vector stride.

If no memory has been allocated, this will quietly return zero.

Definition at line 273 of file ovector_tlate.h.

bool is_owner (  )  const [inline]

Return true if this object owns the data it refers to.

This can be used to determine if an object is a "vector_view", or a legitmate "vector". If is_owner() is true, then it is an ovector_tlate object.

If any O2scl class creates a ovector_tlate object in which is_owner() returns false, then it is a bug and should be reported.

Definition at line 370 of file ovector_tlate.h.

size_t lookup ( const data_t  x0  )  const [inline]

Exhaustively look through the array for a particular value.

This can only fail if all of the entries in the array are not finite, in which case it calls set_err() and returns 0.

Definition at line 381 of file ovector_tlate.h.


The documentation for this class was generated from the following file:

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page