VectorN.h
Go to the documentation of this file.
30 static_assert(std::is_floating_point<T>::value, "VectorN only can be instantiated with floating point types");
T * data()
Returns the raw pointer to the vector data.
Definition: VectorN-Impl.h:123
bool operator!=(const E &v) const
Returns true if other is the not same as this vector.
Definition: VectorN-Impl.h:682
T At(size_t i) const
Returns const reference to the i -th element of the vector.
Definition: VectorN-Impl.h:171
void ForEach(Callback func) const
Iterates the vector and invoke given func for each element.
Definition: VectorN-Impl.h:545
void ParallelForEachIndex(Callback func) const
Iterates the vector and invoke given func for each index in parallel using multi-threading.
Definition: VectorN-Impl.h:566
void ISub(const T &s)
Computes this -= (s, s, ... , s).
Definition: VectorN-Impl.h:505
ConstArrayAccessor1< T > ConstAccessor() const
Returns the const array accessor.
Definition: VectorN-Impl.h:165
VectorN & operator*=(const T &s)
Computes this *= (s, s, ... , s)
Definition: VectorN-Impl.h:644
void ForEachIndex(Callback func) const
Iterates the vector and invoke given func for each index.
Definition: VectorN-Impl.h:552
VectorTypeCast< U, VectorN< T >, T > CastTo() const
Returns a vector with different value type.
Definition: VectorN-Impl.h:348
VectorScalarRDiv< T, VectorN > RDiv(const T &s) const
Computes (s, s, ... , s) / this.
Definition: VectorN-Impl.h:479
T DistanceTo(const E &other) const
Returns the distance to the other vector.
Definition: VectorN-Impl.h:320
VectorN & operator/=(const T &s)
Computes this /= (s, s, ... , s)
Definition: VectorN-Impl.h:659
void IDiv(const T &s)
Computes this /= (s, s, ... , s).
Definition: VectorN-Impl.h:531
VectorScalarRSub< T, VectorN > RSub(const T &s) const
Computes (s, s, ... , s) - this.
Definition: VectorN-Impl.h:466
VectorN & operator=(const std::initializer_list< U > &list)
Sets vector with given initializer list.
1-D read-only array accessor class.
Definition: ArrayAccessor1.h:185
void ParallelForEach(Callback func)
Iterates the vector and invoke given func for each element in parallel using multi-threading.
Definition: VectorN-Impl.h:559
VectorN & operator+=(const T &s)
Computes this += (s, s, ... , s)
Definition: VectorN-Impl.h:614
size_t DominantAxis() const
Returns the index of the dominant axis.
Definition: VectorN-Impl.h:278
Definition: pybind11Utils.h:24
void IAdd(const T &s)
Computes this += (s, s, ... , s).
Definition: VectorN-Impl.h:492
ContainerType::iterator end()
Returns the end iterator of the vector.
Definition: VectorN-Impl.h:147
size_t size() const
Returns the size of the vector.
Definition: VectorN-Impl.h:117
T Sum() const
Returns the sum of all the elements.
Definition: VectorN-Impl.h:183
T Length() const
Returns the length of the vector.
Definition: VectorN-Impl.h:307
T Avg() const
Returns the average of all the elements.
Definition: VectorN-Impl.h:200
std::vector< double > ContainerType
Definition: VectorN.h:32
T LengthSquared() const
Returns the squared length of the vector.
Definition: VectorN-Impl.h:313
T DistanceSquaredTo(const E &other) const
Returns the squared distance to the other vector.
Definition: VectorN-Impl.h:327
bool operator==(const E &v) const
Returns true if other is the same as this vector.
Definition: VectorN-Impl.h:675
VectorScalarDiv< T, VectorN > Normalized() const
Returns normalized vector.
Definition: VectorN-Impl.h:300
T operator[](size_t i) const
Returns the i -th element.
Definition: VectorN-Impl.h:572
ContainerType::iterator begin()
Returns the begin iterator of the vector.
Definition: VectorN-Impl.h:135
void Resize(size_t n, const T &val=0)
Resizes to n dimensional vector with initial value val.
Definition: VectorN-Impl.h:57
T AbsMax() const
Returns the absolute maximum element.
Definition: VectorN-Impl.h:261
void IMul(const T &s)
Computes this *= (s, s, ... , s).
Definition: VectorN-Impl.h:518
bool IsEqual(const E &other) const
Returns true if other is the same as this vector.
Definition: VectorN-Impl.h:355
size_t SubdominantAxis() const
Returns the index of the subdominant axis.
Definition: VectorN-Impl.h:289
bool IsSimilar(const E &other, T epsilon=std::numeric_limits< T >::epsilon()) const
Returns true if other is similar to this vector.
Definition: VectorN-Impl.h:375
Vector expression for matrix-scalar binary operation.
Definition: VectorExpression.h:114
VectorN & operator-=(const T &s)
Computes this -= (s, s, ... , s)
Definition: VectorN-Impl.h:629
void Clear()
Clears the vector and make it zero-dimensional.
Definition: VectorN-Impl.h:63
ArrayAccessor1< T > Accessor()
Returns the array accessor.
Definition: VectorN-Impl.h:159
void Swap(VectorN &other)
Swaps the content of the vector with other vector.
Definition: VectorN-Impl.h:99
T AbsMin() const
Returns the absolute minimum element.
Definition: VectorN-Impl.h:244