1/*
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 *
6 * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
7 */
8
9#ifndef ALGEBRA_H
10#define ALGEBRA_H
11
12#include "gdk.h"
13#include "mal_exception.h"
14#include "mal_interpreter.h"
15
16mal_export str ALGstdev(dbl *res, const bat *bid);
17mal_export str ALGstdevp(dbl *res, const bat *bid);
18mal_export str ALGvariance(dbl *res, const bat *bid);
19mal_export str ALGvariancep(dbl *res, const bat *bid);
20
21mal_export str ALGminany(ptr result, const bat *bid);
22mal_export str ALGmaxany(ptr result, const bat *bid);
23mal_export str ALGminany_skipnil(ptr result, const bat *bid, const bit *skipnil);
24mal_export str ALGmaxany_skipnil(ptr result, const bat *bid, const bit *skipnil);
25mal_export str ALGgroupby(bat *res, const bat *gids, const bat *cnts);
26mal_export str ALGcard(lng *result, const bat *bid);
27mal_export str ALGselect1(bat *result, const bat *bid, const void *low, const void *high, const bit *li, const bit *hi, const bit *anti);
28mal_export str ALGselect2(bat *result, const bat *bid, const bat *sid, const void *low, const void *high, const bit *li, const bit *hi, const bit *anti);
29mal_export str ALGselect1nil(bat *result, const bat *bid, const void *low, const void *high, const bit *li, const bit *hi, const bit *anti, const bit *unknown);
30mal_export str ALGselect2nil(bat *result, const bat *bid, const bat *sid, const void *low, const void *high, const bit *li, const bit *hi, const bit *anti, const bit *unknown);
31mal_export str ALGthetaselect1(bat *result, const bat *bid, const void *val, const char **op);
32mal_export str ALGthetaselect2(bat *result, const bat *bid, const bat *sid, const void *val, const char **op);
33
34mal_export str ALGjoin(bat *r1, bat *r2, const bat *l, const bat *r, const bat *sl, const bat *sr, const bit *nil_matches, const lng *estimate);
35mal_export str ALGjoin1(bat *r1, const bat *l, const bat *r, const bat *sl, const bat *sr, const bit *nil_matches, const lng *estimate);
36mal_export str ALGleftjoin(bat *r1, bat *r2, const bat *l, const bat *r, const bat *sl, const bat *sr, const bit *nil_matches, const lng *estimate);
37mal_export str ALGleftjoin1(bat *r1, const bat *l, const bat *r, const bat *sl, const bat *sr, const bit *nil_matches, const lng *estimate);
38mal_export str ALGouterjoin(bat *r1, bat *r2, const bat *l, const bat *r, const bat *sl, const bat *sr, const bit *nil_matches, const lng *estimate);
39mal_export str ALGsemijoin(bat *r1, bat *r2, const bat *l, const bat *r, const bat *sl, const bat *sr, const bit *nil_matches, const lng *estimate);
40mal_export str ALGthetajoin(bat *r1, bat *r2, const bat *l, const bat *r, const bat *sl, const bat *sr, const int *op, const bit *nil_matches, const lng *estimate);
41mal_export str ALGbandjoin(bat *r1, bat *r2, const bat *lid, const bat *rid, const bat *slid, const bat *srid, const void *low, const void *high, const bit *li, const bit *hi, const lng *estimate);
42mal_export str ALGrangejoin(bat *r1, bat *r2, const bat *lid, const bat *rlid, const bat *rhid, const bat *slid, const bat *srid, const bit *li, const bit *hi, const bit *anti, const bit *symmetric, const lng *estimate);
43mal_export str ALGdifference(bat *r1, const bat *lid, const bat *rid, const bat *slid, const bat *srid, const bit *nil_matches, const bit *not_in, const lng *estimate);
44mal_export str ALGintersect(bat *r1, const bat *lid, const bat *rid, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate);
45
46/* legacy join functions */
47mal_export str ALGcrossproduct2(bat *l, bat *r, const bat *lid, const bat *rid);
48/* end legacy join functions */
49
50mal_export str ALGfirstn(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
51
52mal_export str ALGcopy(bat *result, const bat *bid);
53mal_export str ALGunique2(bat *result, const bat *bid, const bat *sid);
54mal_export str ALGunique1(bat *result, const bat *bid);
55mal_export str ALGprojection(bat *result, const bat *lid, const bat *rid);
56
57mal_export str ALGsort11(bat *result, const bat *bid, const bit *reverse, const bit *nilslast, const bit *stable);
58mal_export str ALGsort12(bat *result, bat *norder, const bat *bid, const bit *reverse, const bit *nilslast, const bit *stable);
59mal_export str ALGsort13(bat *result, bat *norder, bat *ngroup, const bat *bid, const bit *reverse, const bit *nilslast, const bit *stable);
60mal_export str ALGsort21(bat *result, const bat *bid, const bat *order, const bit *reverse, const bit *nilslast, const bit *stable);
61mal_export str ALGsort22(bat *result, bat *norder, const bat *bid, const bat *order, const bit *reverse, const bit *nilslast, const bit *stable);
62mal_export str ALGsort23(bat *result, bat *norder, bat *ngroup, const bat *bid, const bat *order, const bit *reverse, const bit *nilslast, const bit *stable);
63mal_export str ALGsort31(bat *result, const bat *bid, const bat *order, const bat *group, const bit *reverse, const bit *nilslast, const bit *stable);
64mal_export str ALGsort32(bat *result, bat *norder, const bat *bid, const bat *order, const bat *group, const bit *reverse, const bit *nilslast, const bit *stable);
65mal_export str ALGsort33(bat *result, bat *norder, bat *ngroup, const bat *bid, const bat *order, const bat *group, const bit *reverse, const bit *nilslast, const bit *stable);
66mal_export str ALGcount_bat(lng *result, const bat *bid);
67mal_export str ALGcount_nil(lng *result, const bat *bid, const bit *ignore_nils);
68mal_export str ALGcount_no_nil(lng *result, const bat *bid);
69mal_export str ALGcountCND_bat(lng *result, const bat *bid, const bat *cnd);
70mal_export str ALGcountCND_nil(lng *result, const bat *bid, const bat *cnd, const bit *ignore_nils);
71mal_export str ALGcountCND_no_nil(lng *result, const bat *bid, const bat *cnd);
72mal_export str ALGslice(bat *ret, const bat *bid, const lng *start, const lng *end);
73mal_export str ALGslice_int(bat *ret, const bat *bid, const int *start, const int *end);
74mal_export str ALGslice_lng(bat *ret, const bat *bid, const lng *start, const lng *end);
75mal_export str ALGslice_oid(bat *ret, const bat *bid, const oid *start, const oid *end);
76mal_export str ALGsubslice_lng(bat *ret, const bat *bid, const lng *start, const lng *end);
77mal_export str ALGfetchoid(ptr ret, const bat *bid, const oid *pos);
78mal_export str ALGexist(bit *ret, const bat *bid, const void *val);
79mal_export str ALGfind(oid *ret, const bat *bid, ptr val);
80mal_export str ALGselectNotNil(bat *result, const bat *bid);
81mal_export str ALGprojecttail(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
82mal_export str ALGreuse(bat *ret, const bat *bid);
83#endif
84