Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

colvarmodule::vector1d Class Template Reference

\brief Arbitrary size array (one dimensions) suitable for linear algebra operations (i.e. for floating point numbers it can be used with library functions). More...

#include <colvartypes.h>

List of all members.

Public Methods

 vector1d (size_t const n=0)
 Default constructor. More...

 vector1d (size_t const n, T const *t)
 Constructor from C array. More...

T * c_array ()
 Return a pointer to the data location. More...

std::vector< T > & data_array ()
 Return a reference to the data. More...

 ~vector1d ()
void reset ()
 Set all elements to zero. More...

size_t size () const
void resize (size_t const n)
void clear ()
T & operator[] (size_t const i)
T const & operator[] (size_t const i) const
void operator+= (vector1d< T > const &v)
void operator-= (vector1d< T > const &v)
void operator *= (cvm::real a)
void operator/= (cvm::real a)
cvm::real norm2 () const
 Squared norm. More...

cvm::real norm () const
cvm::real sum () const
vector1d< T > const slice (size_t const i1, size_t const i2) const
 Slicing. More...

void sliceassign (size_t const i1, size_t const i2, vector1d< T > const &v)
 Assign a vector to a slice of this vector. More...

size_t output_width (size_t real_width) const
 Formatted output. More...

std::string to_simple_string () const
int from_simple_string (std::string const &s)

Static Public Methods

void check_sizes (vector1d< T > const &v1, vector1d< T > const &v2)

Protected Attributes

std::vector< T > data

Friends

vector1d< T > operator+ (vector1d< T > const &v1, vector1d< T > const &v2)
vector1d< T > operator- (vector1d< T > const &v1, vector1d< T > const &v2)
vector1d< T > operator * (vector1d< T > const &v, cvm::real a)
vector1d< T > operator * (cvm::real a, vector1d< T > const &v)
vector1d< T > operator/ (vector1d< T > const &v, cvm::real a)
operator * (vector1d< T > const &v1, vector1d< T > const &v2)
 Inner product. More...

std::istream & operator>> (std::istream &is, cvm::vector1d< T > &v)
std::ostream & operator<< (std::ostream &os, cvm::vector1d< T > const &v)


Detailed Description

template<class T>
class colvarmodule::vector1d< T >

\brief Arbitrary size array (one dimensions) suitable for linear algebra operations (i.e. for floating point numbers it can be used with library functions).

Definition at line 30 of file colvartypes.h.


Constructor & Destructor Documentation

template<class T>
colvarmodule::vector1d< T >::vector1d size_t const    n = 0 [inline]
 

Default constructor.

Definition at line 39 of file colvartypes.h.

References data, n, and colvarmodule::reset.

template<class T>
colvarmodule::vector1d< T >::vector1d size_t const    n,
T const *    t
[inline]
 

Constructor from C array.

Definition at line 46 of file colvartypes.h.

References data, n, colvarmodule::reset, and colvarmodule::size.

template<class T>
colvarmodule::vector1d< T >::~vector1d   [inline]
 

Definition at line 72 of file colvartypes.h.

References data.


Member Function Documentation

template<class T>
T* colvarmodule::vector1d< T >::c_array   [inline]
 

Return a pointer to the data location.

Definition at line 57 of file colvartypes.h.

References data, and NULL.

template<class T>
void colvarmodule::vector1d< T >::check_sizes vector1d< T > const &    v1,
vector1d< T > const &    v2
[inline, static]
 

Definition at line 106 of file colvartypes.h.

References colvarmodule::error, and colvarmodule::to_str.

template<class T>
void colvarmodule::vector1d< T >::clear   [inline]
 

Definition at line 93 of file colvartypes.h.

References data.

template<class T>
std::vector<T>& colvarmodule::vector1d< T >::data_array   [inline]
 

Return a reference to the data.

Definition at line 67 of file colvartypes.h.

References data.

template<class T>
int colvarmodule::vector1d< T >::from_simple_string std::string const &    s [inline]
 

Definition at line 326 of file colvartypes.h.

References COLVARS_ERROR, data, and colvarmodule::size.

template<class T>
cvm::real colvarmodule::vector1d< T >::norm   const [inline]
 

Definition at line 220 of file colvartypes.h.

References colvarmodule::sqrt.

template<class T>
cvm::real colvarmodule::vector1d< T >::norm2   const [inline]
 

Squared norm.

Definition at line 210 of file colvartypes.h.

References result, and colvarmodule::size.

template<class T>
void colvarmodule::vector1d< T >::operator *= cvm::real    a [inline]
 

Definition at line 132 of file colvartypes.h.

References colvarmodule::size.

template<class T>
void colvarmodule::vector1d< T >::operator+= vector1d< T > const &    v [inline]
 

Definition at line 114 of file colvartypes.h.

References colvarmodule::size.

template<class T>
void colvarmodule::vector1d< T >::operator-= vector1d< T > const &    v [inline]
 

Definition at line 123 of file colvartypes.h.

References colvarmodule::size.

template<class T>
void colvarmodule::vector1d< T >::operator/= cvm::real    a [inline]
 

Definition at line 140 of file colvartypes.h.

References colvarmodule::size.

template<class T>
T const& colvarmodule::vector1d< T >::operator[] size_t const    i const [inline]
 

Definition at line 102 of file colvartypes.h.

References data.

template<class T>
T& colvarmodule::vector1d< T >::operator[] size_t const    i [inline]
 

Definition at line 98 of file colvartypes.h.

References data.

template<class T>
size_t colvarmodule::vector1d< T >::output_width size_t    real_width const [inline]
 

Formatted output.

Definition at line 264 of file colvartypes.h.

References colvarmodule::size.

template<class T>
void colvarmodule::vector1d< T >::reset   [inline]
 

Set all elements to zero.

Definition at line 78 of file colvartypes.h.

References data.

template<class T>
void colvarmodule::vector1d< T >::resize size_t const    n [inline]
 

Definition at line 88 of file colvartypes.h.

References data, and n.

template<class T>
size_t colvarmodule::vector1d< T >::size   const [inline]
 

Definition at line 83 of file colvartypes.h.

References data.

template<class T>
vector1d<T> const colvarmodule::vector1d< T >::slice size_t const    i1,
size_t const    i2
const [inline]
 

Slicing.

Definition at line 236 of file colvartypes.h.

References colvarmodule::error, result, and colvarmodule::size.

template<class T>
void colvarmodule::vector1d< T >::sliceassign size_t const    i1,
size_t const    i2,
vector1d< T > const &    v
[inline]
 

Assign a vector to a slice of this vector.

Definition at line 250 of file colvartypes.h.

References colvarmodule::error, and colvarmodule::size.

template<class T>
cvm::real colvarmodule::vector1d< T >::sum   const [inline]
 

Definition at line 225 of file colvartypes.h.

References result, and colvarmodule::size.

template<class T>
std::string colvarmodule::vector1d< T >::to_simple_string   const [inline]
 

Definition at line 312 of file colvartypes.h.

References colvarmodule::size, and string.


Friends And Related Function Documentation

template<class T>
T operator * vector1d< T > const &    v1,
vector1d< T > const &    v2
[friend]
 

Inner product.

Definition at line 198 of file colvartypes.h.

template<class T>
vector1d<T> operator * cvm::real    a,
vector1d< T > const &    v
[friend]
 

Definition at line 182 of file colvartypes.h.

template<class T>
vector1d<T> operator * vector1d< T > const &    v,
cvm::real    a
[friend]
 

Definition at line 172 of file colvartypes.h.

template<class T>
vector1d<T> operator+ vector1d< T > const &    v1,
vector1d< T > const &    v2
[friend]
 

Definition at line 148 of file colvartypes.h.

template<class T>
vector1d<T> operator- vector1d< T > const &    v1,
vector1d< T > const &    v2
[friend]
 

Definition at line 160 of file colvartypes.h.

template<class T>
vector1d<T> operator/ vector1d< T > const &    v,
cvm::real    a
[friend]
 

Definition at line 187 of file colvartypes.h.

template<class T>
std::ostream& operator<< std::ostream &    os,
cvm::vector1d< T > const &    v
[friend]
 

Definition at line 294 of file colvartypes.h.

template<class T>
std::istream& operator>> std::istream &    is,
cvm::vector1d< T > &    v
[friend]
 

Definition at line 269 of file colvartypes.h.


Member Data Documentation

template<class T>
std::vector<T> colvarmodule::vector1d::data [protected]
 

Definition at line 34 of file colvartypes.h.


The documentation for this class was generated from the following file:
Generated on Wed Apr 24 02:44:40 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002