OpenVDB  12.0.0
Classes | Public Types | Public Member Functions | List of all members
Vector< T > Class Template Reference

Lightweight, variable-length vector. More...

#include <openvdb/math/ConjGradient.h>

Classes

struct  DeterministicDotProductOp
 
struct  InfNormOp
 
struct  IsFiniteOp
 

Public Types

using ValueType = T
 
using Ptr = SharedPtr< Vector >
 

Public Member Functions

 Vector ()
 Construct an empty vector. More...
 
 Vector (SizeType n)
 Construct a vector of n elements, with uninitialized values. More...
 
 Vector (SizeType n, const ValueType &val)
 Construct a vector of n elements and initialize each element to the given value. More...
 
 ~Vector ()
 
 Vector (const Vector &)
 Deep copy the given vector. More...
 
Vectoroperator= (const Vector &)
 Deep copy the given vector. More...
 
SizeType size () const
 Return the number of elements in this vector. More...
 
bool empty () const
 Return true if this vector has no elements. More...
 
void resize (SizeType n)
 Reset this vector to have n elements, with uninitialized values. More...
 
void swap (Vector &other)
 Swap internal storage with another vector, which need not be the same size. More...
 
void fill (const ValueType &value)
 Set all elements of this vector to value. More...
 
ValueType dot (const Vector &) const
 Return the dot product of this vector with the given vector, which must be the same size. More...
 
ValueType infNorm () const
 Return the infinity norm of this vector. More...
 
ValueType l2Norm () const
 Return the L2 norm of this vector. More...
 
bool isFinite () const
 Return true if every element of this vector has a finite value. More...
 
template<typename OtherValueType >
bool eq (const Vector< OtherValueType > &other, ValueType eps=Tolerance< ValueType >::value()) const
 Return true if this vector is equivalent to the given vector to within the specified tolerance. More...
 
std::string str () const
 Return a string representation of this vector. More...
 
template<typename Scalar >
void scale (const Scalar &s)
 Multiply each element of this vector by s. More...
 
template<typename Scalar >
Vectoroperator*= (const Scalar &s)
 Multiply each element of this vector by s. More...
 
T & at (SizeType i)
 Return the value of this vector's ith element. More...
 
const T & at (SizeType i) const
 Return the value of this vector's ith element. More...
 
T & operator[] (SizeType i)
 Return the value of this vector's ith element. More...
 
const T & operator[] (SizeType i) const
 Return the value of this vector's ith element. More...
 
T * data ()
 Return a pointer to this vector's elements. More...
 
const T * data () const
 Return a pointer to this vector's elements. More...
 
const T * constData () const
 Return a pointer to this vector's elements. More...
 

Detailed Description

template<typename T>
class openvdb::v12_0::math::pcg::Vector< T >

Lightweight, variable-length vector.

Member Typedef Documentation

using Ptr = SharedPtr<Vector>
using ValueType = T

Constructor & Destructor Documentation

Vector ( )
inline

Construct an empty vector.

Vector ( SizeType  n)
inline

Construct a vector of n elements, with uninitialized values.

Vector ( SizeType  n,
const ValueType val 
)
inline

Construct a vector of n elements and initialize each element to the given value.

~Vector ( )
inline
Vector ( const Vector< T > &  other)
inline

Deep copy the given vector.

Member Function Documentation

T& at ( SizeType  i)
inline

Return the value of this vector's ith element.

const T& at ( SizeType  i) const
inline

Return the value of this vector's ith element.

const T* constData ( ) const
inline

Return a pointer to this vector's elements.

T* data ( )
inline

Return a pointer to this vector's elements.

const T* data ( ) const
inline

Return a pointer to this vector's elements.

T dot ( const Vector< T > &  ) const
inline

Return the dot product of this vector with the given vector, which must be the same size.

bool empty ( ) const
inline

Return true if this vector has no elements.

bool eq ( const Vector< OtherValueType > &  other,
ValueType  eps = Tolerance<ValueType>::value() 
) const
inline

Return true if this vector is equivalent to the given vector to within the specified tolerance.

void fill ( const ValueType value)
inline

Set all elements of this vector to value.

T infNorm ( ) const
inline

Return the infinity norm of this vector.

bool isFinite ( ) const
inline

Return true if every element of this vector has a finite value.

ValueType l2Norm ( ) const
inline

Return the L2 norm of this vector.

Vector& operator*= ( const Scalar &  s)
inline

Multiply each element of this vector by s.

Vector< T > & operator= ( const Vector< T > &  )
inline

Deep copy the given vector.

T& operator[] ( SizeType  i)
inline

Return the value of this vector's ith element.

const T& operator[] ( SizeType  i) const
inline

Return the value of this vector's ith element.

void resize ( SizeType  n)
inline

Reset this vector to have n elements, with uninitialized values.

Warning
All of this vector's existing values will be lost.
void scale ( const Scalar &  s)
inline

Multiply each element of this vector by s.

SizeType size ( ) const
inline

Return the number of elements in this vector.

std::string str ( ) const
inline

Return a string representation of this vector.

void swap ( Vector< T > &  other)
inline

Swap internal storage with another vector, which need not be the same size.