13 #ifndef __UT_Vector_H__
14 #define __UT_Vector_H__
54 int isInit()
const {
return myVector ? 1 : 0; }
93 return (myNH - myNL) > 4999;
147 const UT_VectorT<T> &, v)
148 void addScaledVecPartial(T s,
const UT_VectorT<T> &v,
162 const UT_VectorT<T> &, v)
163 void scaleAddVecPartial(T s,
const UT_VectorT<T> &v,
171 void multAndSetPartial(
const UT_VectorT<T> &a,
186 const UT_VectorT<T> &, a,
187 const UT_VectorT<T> &, b)
188 void divAndSetPartial(
const UT_VectorT<T> &a,
189 const UT_VectorT<T> &b,
195 const UT_VectorT<T> &, a)
196 void safeInvertAndSetPartial(
const UT_VectorT<T> &a,
200 const UT_VectorT<T> &, a)
201 void invertAndSetPartial(
const UT_VectorT<T> &a,
208 const UT_VectorT<T> &, v)
209 void copyFromPartial(const UT_VectorT<T> &v,
215 UT_VectorT &operator= (const UT_VectorT<T> &v);
216 UT_VectorT &operator+= (const UT_VectorT<T> &v);
217 UT_VectorT &operator-= (const UT_VectorT<T> &v);
220 UT_VectorT &operator*= (const UT_VectorT<T> &v);
221 UT_VectorT &operator/= (const UT_VectorT<T> &v);
224 UT_VectorT &operator*= (T scalar);
225 UT_VectorT &operator/= (T scalar);
236 std::ostream &
save(std::ostream &os) const;
237 friend std::ostream &operator<<(std::ostream &os, const UT_VectorT<T> &v)
238 { v.save(os);
return os; }
255 const UT_VectorT<
T> &,
v)
256 void distance2InternalPartial(fpreal64 *result, const UT_VectorT<T> &
v, const
UT_JobInfo &
info) const;
261 const UT_VectorT<T> &, v)
262 void dotInternalPartial(fpreal64 *result,
263 const UT_VectorT<T> &v,
266 THREADED_METHOD3(UT_VectorT, shouldMultiThread(), addScaledVecNorm2Internal,
268 const UT_VectorT<T> &, v,
270 void addScaledVecNorm2InternalPartial(T s, const UT_VectorT<T> &v,
273 THREADED_METHOD4(UT_VectorT, shouldMultiThread(), addScaledVecNorm2UpToInternal,
275 const UT_VectorT<T> &, v,
278 void addScaledVecNorm2UpToInternalPartial(T s, const UT_VectorT<T> &v,
281 THREADED_METHOD4(UT_VectorT<T>, shouldMultiThread(), multSetAndDotUpToInternal,
282 const UT_VectorT<T> &,
a,
283 const UT_VectorT<T> &,
b,
286 void multSetAndDotUpToInternalPartial(
287 const UT_VectorT<T> &a, const UT_VectorT<T> &b,
292 exint, nl, exint, nh, T,
c);
315 template <typename T>
320 UT_PermutationT(exint nl, exint nh);
331 exint
getNL()
const {
return myNL; }
334 exint
getNH()
const {
return myNH; }
336 exint
length()
const {
return myNH - myNL + 1; }
418 template<
typename T>
inline size_t
void zero()
Initialize to zeros.
int const UT_JobInfo &info const
void getPartialRange(exint &start, exint &end, const UT_JobInfo &info) const
Determines the [start,end) interval that should be worked on.
void negPartial(const UT_JobInfo &info)
Negate.
const UT_VectorT< T > fpreal64 * dot_aba
void setShallowNH(exint nh)
UT_VectorT< fpreal64 > UT_VectorD
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
void init(exint nl, exint nh)
Initialize nl, nh and allocate space.
UT_VectorT< fpreal64 > UT_Vector
T & operator()(exint i)
For retrieving data.
exint getNH() const
Get the high index.
void setShallowNL(exint nl)
GLboolean GLboolean GLboolean GLboolean a
void getPartialBlockRange(exint &startblock, exint &endblock, const exint blocksize, const UT_JobInfo &info) const
void addScaledVecNorm2(T s, const UT_VectorT< T > &v, fpreal64 *norm2)
Add scaled vector and compute the squared L2 norm.
THREADED_METHOD2_CONST(UT_VectorT, shouldMultiThread(), normInternal, fpreal64 *, result, int, type) void normInternalPartial(fpreal64 *result
void constantInternalPartial(exint nl, exint nh, T c, const UT_JobInfo &info)
UT_VectorT< fpreal32 > UT_VectorF
**But if you need a result
UT_PermutationT< int > UT_Permutation
GLfloat GLfloat GLfloat v2
T dot(const UT_VectorT< T > &v) const
void multSetAndDotUpTo(const UT_VectorT< T > &a, const UT_VectorT< T > &b, fpreal64 *dot_aba, exint dotlimit)
void addScaledVecNorm2UpTo(T s, const UT_VectorT< T > &v, fpreal64 *norm2, exint normlimit)
THREADED_METHOD4(UT_VectorT, shouldMultiThread(), addScaledVecNorm2UpToInternal, T, s, const UT_VectorT< T > &, v, fpreal64 *, norm2, exint, normlimit) void addScaledVecNorm2UpToInternalPartial(T s
THREADED_METHOD3(UT_VectorT, shouldMultiThread(), addScaledVecNorm2Internal, T, s, const UT_VectorT< T > &, v, fpreal64 *, norm2) void addScaledVecNorm2InternalPartial(T s
void changeNL(exint nl)
Change the low index, and the high index will adjust itself.
THREADED_METHOD2(UT_VectorT, nh-nl > 4999, zero, exint, nl, exint, nh)
void zeroPartial(exint nl, exint nh, const UT_JobInfo &info)
UT_VectorT()
Input the index range [nl..nh].
std::ostream & save(std::ostream &os) const
Output.
void getSubvector4(UT_Vector4 &v, exint idx) const
T distance2(const UT_VectorT< T > &v) const
static const exint PARALLEL_BLOCK_SIZE
T norm2() const
Square of L2-norm.
GLboolean GLboolean GLboolean b
void setSubvector3(exint idx, const UT_Vector3 &v)
T operator()(exint i) const
UT_VectorT< fpreal > UT_VectorR
void getSubvector2(UT_Vector2 &v, exint idx) const
size_t format(char *buffer, size_t buffer_size, const UT_VectorT< T > &v)
const UT_VectorT< T > fpreal64 exint dotlimit
void setShallowNL(exint nl)
THREADED_METHOD1(UT_VectorT, shouldMultiThread(), negPlus, const UT_VectorT< T > &, v) void negPlusPartial(const UT_VectorT< T > &v
void setSubvector4(exint idx, const UT_Vector4 &v)
void setSubvector2(exint idx, const UT_Vector2 &v)
void getSubvector3(UT_Vector3 &v, exint idx) const
const UT_VectorT< T > fpreal64 exint normlimit
void subvector(const UT_VectorT< T > &v, exint nl, exint nh)
Steal from another vector, resulting vector has origin at 1.
void assign(const fpreal32 *data, exint nl, exint nh)
UT_VectorT & operator=(const UT_VectorT< T > &v)
T operator()(exint i) const
bool shouldMultiThread() const
exint length() const
Get dimension of this vector.
void constant(T c)
Initialize to the given constant.
void setShallowNH(exint nh)
#define THREADED_METHOD(CLASSNAME, DOMULTI, METHOD)
bool isEqual(const UT_VectorT< T > &v, int64 ulps)
exint getNL() const
Get the low index.