update
This commit is contained in:
@@ -380,14 +380,17 @@ auto corr(const VT<T>& x, const VT2<T2>&y) {
|
||||
sxy += x[i] * y[i];
|
||||
sy2 += y[i] * y[i];
|
||||
}
|
||||
return (sxy - FPType(sx*sy))
|
||||
return (len*sxy - FPType(sx*sy))
|
||||
/
|
||||
(len * sqrt(
|
||||
(sx2 - FPType(sx*sx)/len) * (sy2 - FPType(sy*sy)/len)
|
||||
(sqrt(
|
||||
(len*sx2 - FPType(sx*sx)) * (len*sy2 - FPType(sy*sy))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
void pow(auto x, auto y, auto& z) {
|
||||
z = pow(x, y);
|
||||
}
|
||||
|
||||
template<class T, template<typename ...> class VT>
|
||||
inline types::GetFPType<types::GetLongType<decays<T>>> stddev(const VT<T>& arr) {
|
||||
|
||||
+2
-1
@@ -85,7 +85,8 @@ public:
|
||||
|
||||
start_deamon();
|
||||
GC::gc_handle = this;
|
||||
this->scratch.init(1);
|
||||
this->scratch.init(65536);
|
||||
GC::scratch_space = &this->scratch;
|
||||
} // 256 MB
|
||||
|
||||
~GC(){
|
||||
|
||||
@@ -300,4 +300,21 @@ inline _This_Type* AQ_DupObject(_This_Type* __val) {
|
||||
|
||||
void print_monetdb_results(void* _srv, const char* sep, const char* end, uint32_t limit);
|
||||
StoredProcedure get_procedure(Context* cxt, const char* name);
|
||||
|
||||
#define AQTIMER(x) auto __timer##x = std::chrono::high_resolution_clock::now();
|
||||
|
||||
#define __AQTIMERLAP__IMPL(x, y) \
|
||||
printf(#y": %llu\n", (unsigned long long)( \
|
||||
std::chrono::high_resolution_clock::now() - __timer##x \
|
||||
).count()); \
|
||||
__timer##x = std::chrono::high_resolution_clock::now();
|
||||
|
||||
#define __AQTIMERLAP_STRIP(X, Y, IMPL, ...) IMPL
|
||||
|
||||
#define AQTIMERLAP(...) \
|
||||
__AQTIMERLAP_STRIP(__VA_ARGS__, \
|
||||
__AQTIMERLAP__IMPL(__VA_ARGS__), \
|
||||
__AQTIMERLAP__IMPL(, __VA_ARGS__), \
|
||||
__AQTIMERLAP__IMPL(,) \
|
||||
)
|
||||
#endif
|
||||
|
||||
+11
-11
@@ -149,18 +149,18 @@ public:
|
||||
return *this;
|
||||
|
||||
}
|
||||
ColView<_Ty> operator [](vector_type<uint32_t>& idxs) const {
|
||||
return ColView<_Ty>(*this, std::move(idxs));
|
||||
// ColView<_Ty> operator [](vector_type<uint32_t>& idxs) const {
|
||||
// return ColView<_Ty>(*this, idxs);
|
||||
// }
|
||||
// ColView<_Ty> operator [](const vector_type<uint32_t>& idxs) const {
|
||||
// return ColView<_Ty>(*this, idxs);
|
||||
// }
|
||||
vector_type<_Ty> operator[](vector_type<uint32_t>& idxs) const {
|
||||
vector_type<_Ty> ret(idxs.size);
|
||||
for (uint32_t i = 0; i < idxs.size; ++i)
|
||||
ret.container[i] = this->container[idxs[i]];
|
||||
return ret;
|
||||
}
|
||||
ColView<_Ty> operator [](const vector_type<uint32_t>& idxs) const {
|
||||
return ColView<_Ty>(*this, idxs);
|
||||
}
|
||||
//vector_type<_Ty> operator[](vector_type<uint32_t>& idxs) const {
|
||||
// vector_type<_Ty> ret(idxs.size);
|
||||
// for (uint32_t i = 0; i < idxs.size; ++i)
|
||||
// ret.container[i] = this->container[idxs[i]];
|
||||
// return ret;
|
||||
//}
|
||||
vector_type<_Ty> operator [](const std::vector<bool>& idxs) const {
|
||||
vector_type<_Ty> ret (this->size);
|
||||
uint32_t i = 0;
|
||||
|
||||
@@ -27,13 +27,19 @@ template <typename _Ty>
|
||||
class vector_type : public vector_base<_Ty>{
|
||||
public:
|
||||
typedef vector_type<_Ty> Decayed_t;
|
||||
void inline _ref(vector_type<_Ty>& vt) {
|
||||
// make a reference of vt
|
||||
this->size = vt.size;
|
||||
this->capacity = 0;
|
||||
this->container = vt.container;
|
||||
}
|
||||
void inline _copy(const vector_type<_Ty>& vt) {
|
||||
// quick init while using malloc
|
||||
//if (capacity > 0) free(container);
|
||||
this->size = vt.size;
|
||||
this->capacity = vt.capacity;
|
||||
if (capacity) {
|
||||
//puts("copy");
|
||||
puts("copy");
|
||||
this->container = (_Ty*)malloc(size * sizeof(_Ty));
|
||||
memcpy(container, vt.container, sizeof(_Ty) * size);
|
||||
}
|
||||
@@ -63,7 +69,7 @@ public:
|
||||
container = (_Ty*)GC::scratch_space->alloc(size * sizeof(_Ty));
|
||||
this->capacity = 0;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
container = (_Ty*)malloc(size * sizeof(_Ty));
|
||||
}
|
||||
// TODO: calloc for objects.
|
||||
@@ -84,7 +90,7 @@ public:
|
||||
_copy(vt);
|
||||
}
|
||||
constexpr vector_type(vector_type<_Ty>& vt) noexcept : capacity(0) {
|
||||
_move(std::move(vt));
|
||||
_ref(vt);
|
||||
}
|
||||
constexpr vector_type(vector_type<_Ty>&& vt) noexcept : capacity(0) {
|
||||
_move(std::move(vt));
|
||||
|
||||
Reference in New Issue
Block a user