Bill 2 years ago
commit cc75e55272

5
.gitignore vendored

@ -45,3 +45,8 @@ server/packages/**
*.stackdump
saves
*.exe
out*.cpp
udf*.hpp

@ -5,7 +5,7 @@ ifeq ($(OS),Windows_NT)
OS_SUPPORT += server/winhelper.cpp
MonetDB_LIB += -Imonetdb/msvc msc-plugin/monetdbe.dll
else
MonetDB_LIB += -lmonetdbe
MonetDB_LIB += -I/usr/include/monetdb -lmonetdbe
endif
info:

@ -1,53 +0,0 @@
#include "./server/libaquery.h"
#include <unordered_map>
#include "./server/monetdb_conn.h"
#include "./server/hasher.h"
#include "./server/aggregations.h"
__AQEXPORT__(int) dll_3V1c8v(Context* cxt) {
using namespace std;
using namespace types;
auto server = static_cast<Server*>(cxt->alt_server);
auto len_5Bixfq = server->cnt;
auto mont_1Mz = ColRef<int>(len_5Bixfq, server->getCol(0));
auto sales_2DN = ColRef<int>(len_5Bixfq, server->getCol(1));
auto out_5Ffhnc = new TableInfo<int,double>("out_5Ffhnc");
out_5Ffhnc->get_col<0>().initfrom(mont_1Mz);
out_5Ffhnc->get_col<1>() = avgw(3, sales_2DN);
print(*out_5Ffhnc);
FILE* fp_57Mh6f = fopen("moving_avg_output.csv", "w");
out_5Ffhnc->printall(";", "\n", nullptr, fp_57Mh6f);
fclose(fp_57Mh6f);
puts("done.");
return 0;
}
__AQEXPORT__(int) dll_frRsQ7(Context* cxt) {
using namespace std;
using namespace types;
auto server = static_cast<Server*>(cxt->alt_server);
auto len_5JydG3 = server->cnt;
auto mont_34m = ColRef<int>(len_5JydG3, server->getCol(0));
auto sales_4wo = ColRef<int>(len_5JydG3, server->getCol(1));
auto out_4Fsh6O = new TableInfo<int,ColRef<int>>("out_4Fsh6O");
decltype(auto) col_4A04Hh = out_4Fsh6O->get_col<0>();
decltype(auto) col_1S5CS2 = out_4Fsh6O->get_col<1>();
auto t4HUjxwQ = mont_34m;
typedef record<decays<decltype(t4HUjxwQ)::value_t>> record_type5PGugsV;
unordered_map<record_type5PGugsV, vector_type<uint32_t>, transTypes<record_type5PGugsV, hasher>> g6HIDqpq;
for (uint32_t ilq = 0; ilq < t4HUjxwQ.size; ++ilq){
g6HIDqpq[forward_as_tuple(t4HUjxwQ[ilq])].emplace_back(ilq);
}
for (auto& i2M : g6HIDqpq) {
auto &key_5JcLJMV = i2M.first;
auto &val_yqDe0lt = i2M.second;
col_4A04Hh.emplace_back(get<0>(key_5JcLJMV));
col_1S5CS2.emplace_back(minw(2, sales_4wo[val_yqDe0lt]));
}
print(*out_4Fsh6O);
FILE* fp_6UC6Yg = fopen("flatten.csv", "w");
out_4Fsh6O->printall(",", "\n", nullptr, fp_6UC6Yg);
fclose(fp_6UC6Yg);
puts("done.");
return 0;
}

@ -3,6 +3,7 @@
#include <cstdio>
#include <string>
#include <limits>
#include <cstring>
template <class ...Types>
std::string generate_printf_string(const char* sep = " ", const char* end = "\n") {
std::string str;

@ -1,8 +1,4 @@
#ifdef _WIN32
#include "monetdbe.h"
#else
#include "monetdb/monetdbe.h"
#endif
struct Context;

@ -1,3 +1,4 @@
#ifdef _WIN32
#include "winhelper.h"
#include <Windows.h>
@ -34,3 +35,4 @@ void SharedMemory::FreeMemoryMap()
if (this->hFileMap)
CloseHandle(this->hFileMap);
}
#endif

@ -1,5 +1,6 @@
#ifndef _WINHELPER_H
#define _WINHELPER_H
#ifdef _WIN32
static constexpr int RTLD_LAZY = 1;
void* dlopen(const char*, int);
void* dlsym(void*, const char*);
@ -12,3 +13,4 @@ struct SharedMemory
void FreeMemoryMap();
};
#endif
#endif

@ -1,56 +0,0 @@
#pragma once
#include "./server/libaquery.h"
#include "./server/aggregations.h"
auto covariances2 = [](auto x, auto y, auto w, uint32_t _builtin_len, auto& _builtin_ret) {
auto xmeans = 0.0;
auto ymeans = 0.0;
auto l = _builtin_len;
if((l > 0)) {
xmeans = x[0];
ymeans = y[0];
_builtin_ret[0] = 0.0;
}
if((w > l))
w = l;
for(auto i = 1, j = 0; (i < w); i = (i + 1)) {
xmeans += x[i];
ymeans += y[i];
_builtin_ret[i] = avg(((x.subvec(0, i) - (xmeans / i)) * (y.subvec(0, i) - (ymeans / i))));
}
xmeans /= w;
ymeans /= w;
for(auto i = w; (i < l); i += 1) {
xmeans += ((x[i] - x[(i - w)]) / w);
ymeans += ((y[i] - y[(i - w)]) / w);
_builtin_ret[i] = avg(((x.subvec((i - w), i) - xmeans) * (y.subvec((i - w), i) - ymeans)));
}
return ;
};
auto covariances2_gettype = [](auto x, auto y, auto w) {
uint32_t _builtin_len = 0;
auto xmeans = 0.0;
auto ymeans = 0.0;
auto l = _builtin_len;
if((l > 0)) {
xmeans = x[0];
ymeans = y[0];
return 0.0;
}
if((w > l))
w = l;
for(auto i = 1, j = 0; (i < w); i = (i + 1)) {
xmeans += x[i];
ymeans += y[i];
return avg(((x.subvec(0, i) - (xmeans / i)) * (y.subvec(0, i) - (ymeans / i))));
}
xmeans /= w;
ymeans /= w;
for(auto i = w; (i < l); i += 1) {
xmeans += ((x[i] - x[(i - w)]) / w);
ymeans += ((y[i] - y[(i - w)]) / w);
return avg(((x.subvec((i - w), i) - xmeans) * (y.subvec((i - w), i) - ymeans)));
}
};
Loading…
Cancel
Save