Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion cuBQL/math/box.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,16 @@ namespace cuBQL {
inline __cubql_both vec_t center() const
{ return (this->lower+this->upper)/scalar_t(2); }

/*! return a vector that give the size of the box in x,y,...etc */
inline __cubql_both vec_t size() const
{ return this->upper - this->lower; }


/*! return a vector that give the size of the box in x,y,...etc
(also known as the 'span' of a box, due to the it being the
vector that spans the box from lower to upper) */
inline __cubql_both vec_t span() const
{ return this->upper - this->lower; }

/*! returns TWICE the center (which happens to be the SUM of lower
an dupper). Note this 'conceptually' the same as 'center()',
but without the nasty division that may lead to rounding
Expand Down
6 changes: 6 additions & 0 deletions cuBQL/math/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# include <sys/time.h>
#endif
#if defined(__HIPCC__)
# include <hip/hip_runtime.h>
# include <hip/driver_types.h>
# include <hip/hip_runtime.h>
#elif defined(__CUDACC__)
Expand Down Expand Up @@ -62,7 +63,12 @@
# define CUBQL_INTERFACE /* nothing - currently not building any special 'cubql.dll' */

#ifndef __PRETTY_FUNCTION__
# if defined(__func__)
# define __PRETTY_FUNCTION__ __func__
// # define __PRETTY_FUNCTION__ __FILE__##"::"##__LINE__##": "##__FUNCTION__
# else
# define __PRETTY_FUNCTION__ __FUNCTION__
# endif
#endif


Expand Down
13 changes: 13 additions & 0 deletions cuBQL/math/vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ namespace cuBQL {
inline __cubql_both vec_t(const vec_t_data<T,4> &o)
{ this->x = (o.x); this->y = (o.y); this->z = (o.z); this->w = (o.w); }

inline __cubql_both vec_t(const vec_t_data<T,3> &o, T w)
{ this->x = (o.x); this->y = (o.y); this->z = (o.z); this->w = w; }

template<typename OT>
explicit __cubql_both vec_t(const vec_t_data<OT,4> &o)
{ this->x = T(o.x); this->y = T(o.y); this->z = T(o.z); this->w = T(o.w); }
Expand Down Expand Up @@ -310,6 +313,16 @@ namespace cuBQL {
vec_t<T,D> operator+(vec_t<T,D> v)
{ return v; }

template<typename T, int D>
inline __cubql_both
vec_t<T,D> &operator-=(vec_t<T,D> &self, vec_t<T,D> v)
{ self = self-v; return self; }

template<typename T, int D>
inline __cubql_both
vec_t<T,D> &operator+=(vec_t<T,D> &self, vec_t<T,D> v)
{ self = self+v; return self; }


#if CUBQL_SUPPORT_CUDA_VECTOR_TYPES
# define CUBQL_OPERATOR_CUDA_T(long_op, op) \
Expand Down