OpenVDB 13.0.0

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

## Detailed Description

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

Lightweight, variable-length vector.

## Member Typedef Documentation

## ◆ Ptr

template<typename T>

using Ptr = SharedPtr<Vector>

## ◆ ValueType

template<typename T>

using ValueType = T

## Constructor & Destructor Documentation

## ◆ Vector() [1/4]

template<typename T>

Vector | ( |  | ) |
| inline

Construct an empty vector.

## ◆ Vector() [2/4]

template<typename T>

Vector | ( | SizeType | n | ) |
| inline

Construct a vector of n elements, with uninitialized values.

## ◆ Vector() [3/4]

template<typename T>

Vector | ( | SizeType | n,
|  | const ValueType & | val )
| inline

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

## ◆ ~Vector()

template<typename T>

~Vector | ( |  | ) |
| inline

## ◆ Vector() [4/4]

template<typename T>

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

Deep copy the given vector.

## Member Function Documentation

## ◆ at() [1/2]

template<typename T>

T & at | ( | SizeType | i | ) |
| inline

Return the value of this vector's ith element.

## ◆ at() [2/2]

template<typename T>

const T & at | ( | SizeType | i | ) | const
| inline

## ◆ constData()

template<typename T>

const T * constData | ( |  | ) | const
| inline

## ◆ data() [1/2]

template<typename T>

T * data | ( |  | ) |
| inline

Return a pointer to this vector's elements.

## ◆ data() [2/2]

template<typename T>

const T * data | ( |  | ) | const
| inline

## ◆ dot()

template<typename T>

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

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

## ◆ empty()

template<typename T>

bool empty | ( |  | ) | const
| inline

Return `true` if this vector has no elements.

## ◆ eq()

template<typename T>
template<typename OtherValueType>

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.

## ◆ fill()

template<typename T>

void fill | ( | const ValueType & | value | ) |
| inline

Set all elements of this vector to value.

## ◆ infNorm()

template<typename T>

T infNorm | ( |  | ) | const
| inline

Return the infinity norm of this vector.

## ◆ isFinite()

template<typename T>

bool isFinite | ( |  | ) | const
| inline

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

## ◆ l2Norm()

template<typename T>

ValueType l2Norm | ( |  | ) | const
| inline

Return the L2 norm of this vector.

## ◆ operator*=()

template<typename T>
template<typename Scalar>

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

## ◆ operator=()

template<typename T>

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

Deep copy the given vector.

## ◆ operator[]() [1/2]

template<typename T>

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

## ◆ operator[]() [2/2]

template<typename T>

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

## ◆ resize()

template<typename T>

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.

## ◆ scale()

template<typename T>
template<typename Scalar>

void scale | ( | const Scalar & | s | ) |
| inline

Multiply each element of this vector by s.

## ◆ size()

template<typename T>

SizeType size | ( |  | ) | const
| inline

Return the number of elements in this vector.

## ◆ str()

template<typename T>

std::string str | ( |  | ) | const
| inline

Return a string representation of this vector.

## ◆ swap()

template<typename T>

void swap | ( | Vector< T > & | other | ) |
| inline

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