|
IFEM
90A354
|
A vector class with some added algebraic operations. More...
#include <matrix.h>

Public Types | |
| using | ConstVecIter = typename std::vector< T >::const_iterator |
| Convenience alias for const iterators. | |
| using | VecIter = typename std::vector< T >::iterator |
| Convenience alias for non-const iterators. | |
Public Member Functions | |
| vector () | |
| Constructor creating an empty vector. | |
| vector (size_t n) | |
| Constructor creating a vector of length n. | |
| vector (const T *values, size_t n) | |
| Constructor creating a vector from a C-array. | |
| vector (const std::vector< T > &X) | |
| Overloaded copy constructor. | |
| vector< T > & | operator= (const std::vector< T > &X) |
| Overloaded assignment operator. | |
| T * | ptr () |
| Access through pointer. | |
| const T * | ptr () const |
| Reference through pointer. | |
| size_t | size () const |
| Size of the vector. | |
| bool | empty () const |
| Is the vector empty (zero size)? | |
| bool | zero (T tol=T(0)) const |
| Is the vector elements all zero? | |
| ConstVecIter | begin () const |
| Start of the vector container, for access. | |
| ConstVecIter | end () const |
| End of the vector container, for access. | |
| VecIter | begin () |
| Start of the vector container, for update. | |
| VecIter | end () |
| End of the vector container, for update. | |
| operator const std::vector< T > & () const | |
| Type casting operator, for access. | |
| operator std::vector< T > & () | |
| Type casting operator, for update. | |
| T & | operator[] (size_t i) |
| Index-0 based element access. | |
| const T & | operator[] (size_t i) const |
| Index-0 based element reference. | |
| T & | operator() (size_t i) |
| Index-1 based element access. | |
| const T & | operator() (size_t i) const |
| Index-1 based element reference. | |
| void | fill (T s) |
| Fill the vector with a scalar value. | |
| void | fill (const T *values, size_t n=0) |
| Fill the vector with data from an array. | |
| void | push_back (T c) |
| Append a scalar value to the vector, increasing its size by one. | |
| void | push_back (ConstVecIter i1, ConstVecIter i2) |
| Append a range of values increasing the size by i2-i1. | |
| void | push_back (const T *p, const T *q) |
| Append a range of values increasing the size by q-p. | |
| void | swap (vector< T > &vec) |
| Swap the content with another vector. | |
| vector< T > & | operator*= (T c) |
| Multiplication with a scalar. | |
| vector< T > & | operator/= (T d) |
| Division by a scalar. | |
| vector< T > & | operator*= (const std::vector< T > &X) |
| Component-wise multiplication with a vector. | |
| vector< T > & | operator/= (const std::vector< T > &X) |
| Component-wise division with a vector. | |
| vector< T > & | operator+= (const vector< T > &X) |
| Add the given vector X to *this. | |
| vector< T > & | operator-= (const vector< T > &X) |
| Subtract the given vector X from *this. | |
| vector< T > & | add (const std::vector< T > &X, const T &alfa=T(1), unsigned int ofsx=0, int stridex=1, unsigned int ofsy=0, int stridey=1) |
| Add the given vector X scaled by alfa to *this. | |
| vector< T > & | relax (T alfa, const std::vector< T > &X) |
| Perform \({\bf Y} = \alpha{\bf Y} + (1-\alpha){\bf X} \) where Y = *this. | |
| vector< T > & | relax (T alfa, const std::vector< T > &X, const std::vector< T > &Y) |
| Perform \({\bf Z} = \alpha{\bf Y} + (1-\alpha){\bf X} \) where Z = *this. | |
| T | dot (const T *v, size_t nv, size_t off1=0, int inc1=1, size_t off2=0, int inc2=1) const |
| Dot product between *this and another vector. More... | |
| T | dot (const std::vector< T > &v, size_t off1=0, int inc1=1, size_t off2=0, int inc2=1) const |
| Dot product between *this and another vector. More... | |
| T | norm2 (size_t off=0, int inc=1) const |
| Return the Euclidean norm of the vector. More... | |
| T | normInf (size_t &off, int inc=1, bool sign=false) const |
| Return the infinite norm of the vector, or signed max value. More... | |
| T | normInf (int inc=1) const |
| Return the infinite norm of the vector (no index offset). More... | |
| T | max () const |
| Return the largest element of the vector. | |
| T | min () const |
| Return the smallest element of the vector. | |
| T | asum (size_t off=0, int inc=1) const |
| Return the sum of the absolute value of the vector elements. More... | |
| T | sum (size_t off=0, int inc=1, size_t max=0) const |
| Return the sum of the vector elements. More... | |
| bool | resize (size_t n, char forceClear=0) |
| Resize the vector to length n. More... | |
| void | reserve (size_t n) |
| Pre-allocation of vector length to n. | |
| void | clear () |
| Clear the vector, setting its size to zero. | |
Private Attributes | |
| std::vector< T > | myVec |
| Internal vector storage. | |
A vector class with some added algebraic operations.
The class type T has to be of a numerical type, i.e., float or double.
|
inline |
Return the sum of the absolute value of the vector elements.
| [in] | off | Index offset relative to the first vector component |
| [in] | inc | Increment in the vector component indices |
Referenced by StdVector::L1norm().
|
inline |
Dot product between *this and another vector.
| [in] | v | The vector to dot this vector with |
| [in] | off1 | Offset for this vector |
| [in] | inc1 | Increment for this vector |
| [in] | off2 | Offset for vector v |
| [in] | inc2 | Increment for vector v |
References utl::vector< T >::dot().
|
inline |
Dot product between *this and another vector.
| [in] | v | The vector to dot this vector with |
| [in] | nv | Length of the vector v |
| [in] | off1 | Offset for this vector |
| [in] | inc1 | Increment for this vector |
| [in] | off2 | Offset for vector v |
| [in] | inc2 | Increment for vector v |
Referenced by ASMu2D::computeBasisNurbs(), Mode::computeDamping(), utl::vector< T >::dot(), SAM::dot(), ASMu2D::evaluateBasisNurbs(), StabilizationUtils::getTauNSALEPt(), StabilizationUtils::getTauPt(), NonLinSIM::lineSearch(), utl::operator*(), Mode::orthonormalize(), SIMCoupledSI< T1, T2 >::solveStep(), LRSplineField2D::valueFE(), LRSplineField3D::valueFE(), SplineField2D::valueFE(), SplineField3D::valueFE(), LRSplineFields2Dmx::valueFE(), LRSplineFields3Dmx::valueFE(), SplineField2D::valueGrid(), and SplineField3D::valueGrid().
|
inline |
Return the Euclidean norm of the vector.
| [in] | off | Index offset relative to the first vector component |
| [in] | inc | Increment in the vector component indices |
Referenced by StdVector::L2norm(), SAM::normL2(), and SIMoutput::writeGlvE().
|
inline |
Return the infinite norm of the vector (no index offset).
| [in] | inc | Increment in the vector component indices |
References utl::vector< T >::normInf().
Referenced by utl::vector< T >::normInf().
|
inline |
Return the infinite norm of the vector, or signed max value.
| off | Index offset relative to the first vector component on input, 1-based index of the largest vector component on output | |
| [in] | inc | Increment in the vector component indices |
| [in] | sign | If true, return the sign of the actual max value |
Referenced by DiagMatrix::Linfnorm(), StdVector::Linfnorm(), and SAM::normInf().
|
inline |
Resize the vector to length n.
Will erase the previous content, but only if the size changed, unless forceClear equals 1. If forceClear is larger than 1, the n first previous vector elements are retained.
References utl::vector< T >::fill(), utl::vector< T >::myVec, and utl::RETAIN.
Referenced by SAM::assembleSystem(), DiagMatrix::DiagMatrix(), evalMonomials(), ASMu3D::evaluateBasis(), SAM::expandVector(), SplineUtils::extractBasis(), ASMs2D::extractBasis(), ASMs1D::extractBasis(), SparseMatrix::getColumn(), BlockElmMats::getRHSVector(), LagrangeField3D::gradFE(), LagrangeField2D::gradFE(), DiagMatrix::initAssembly(), HHTSIM::initSol(), NewmarkNLSIM::initSol(), ASMs2D::integrate(), ASMs3D::integrate(), ASMu2D::integrate(), ASMu3D::integrate(), ASMu3Dmx::integrate(), LagrangeField2D::LagrangeField2D(), LagrangeField3D::LagrangeField3D(), LagrangeFields2D::LagrangeFields2D(), LagrangeFields3D::LagrangeFields3D(), LRSplineField2D::LRSplineField2D(), LRSplineField3D::LRSplineField3D(), LRSplineFields2D::LRSplineFields2D(), LRSplineFields2Dmx::LRSplineFields2Dmx(), LRSplineFields3D::LRSplineFields3D(), LRSplineFields3Dmx::LRSplineFields3Dmx(), utl::operator>>(), SparseMatrix::optimiseCols(), SparseMatrix::optimiseRows(), SIMbase::projectAnaSol(), StdVector::redim(), DiagMatrix::redim(), StdVector::resize(), eig::solve(), TimeIntegration::SIMExplicitRK< Solver >::solveRK(), SplineField2D::SplineField2D(), SplineField3D::SplineField3D(), SplineFields2D::SplineFields2D(), SplineFields2Dmx::SplineFields2Dmx(), SplineFields3D::SplineFields3D(), SplineFields3Dmx::SplineFields3Dmx(), LagrangeFields2D::valueFE(), LagrangeFields3D::valueFE(), LRSplineFields2Dmx::valueFE(), LRSplineFields3Dmx::valueFE(), SplineFields1D::valueFE(), SplineFields2Dmx::valueFE(), SplineFields3Dmx::valueFE(), Fields::valueNode(), LagrangeFields2D::valueNode(), LagrangeFields3D::valueNode(), LRSplineFields2D::valueNode(), LRSplineFields3D::valueNode(), SplineFields2D::valueNode(), SplineFields3D::valueNode(), utl::vector< T >::vector(), and HDF5Writer::writeSIM().
|
inline |
Return the sum of the vector elements.
| [in] | off | Index offset relative to the first vector component |
| [in] | inc | Increment in the vector component indices |
| [in] | max | Index after last vector component to sum |
References utl::vector< T >::max(), and utl::vector< T >::myVec.
Referenced by ASMu2D::evaluateBasisNurbs().