⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 algebra.c

📁 一个内存数据库的源代码这是服务器端还有客户端
💻 C
📖 第 1 页 / 共 5 页
字号:
			break;		} else {			result *= *value;		}	}	*res = result;	return GDK_SUCCEED;}#line 978 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#line 869 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDprod_int_lng(lng* res, BAT *b){	BUN p,q;	int xx;	lng result=1;	BATcheck(b,"BATprodInt");	BATloopFast(b, p, q, xx) {		int *value = (int*) BUNtloc(b, p);		if (*value == int_nil) {			result = lng_nil;			break;		} else {			result *= *value;		}	}	*res = result;	return GDK_SUCCEED;}#line 979 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#line 869 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDprod_lng_lng(lng* res, BAT *b){	BUN p,q;	int xx;	lng result=1;	BATcheck(b,"BATprodInt");	BATloopFast(b, p, q, xx) {		lng *value = (lng*) BUNtloc(b, p);		if (*value == lng_nil) {			result = lng_nil;			break;		} else {			result *= *value;		}	}	*res = result;	return GDK_SUCCEED;}#line 980 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#line 869 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDprod_flt_flt(flt* res, BAT *b){	BUN p,q;	int xx;	flt result=1.0;	BATcheck(b,"BATprodInt");	BATloopFast(b, p, q, xx) {		flt *value = (flt*) BUNtloc(b, p);		if (*value == flt_nil) {			result = flt_nil;			break;		} else {			result *= *value;		}	}	*res = result;	return GDK_SUCCEED;}#line 981 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#line 869 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDprod_flt_dbl(dbl* res, BAT *b){	BUN p,q;	int xx;	dbl result=1.0;	BATcheck(b,"BATprodInt");	BATloopFast(b, p, q, xx) {		flt *value = (flt*) BUNtloc(b, p);		if (*value == flt_nil) {			result = dbl_nil;			break;		} else {			result *= *value;		}	}	*res = result;	return GDK_SUCCEED;}#line 982 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#line 869 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDprod_dbl_dbl(dbl* res, BAT *b){	BUN p,q;	int xx;	dbl result=1.0;	BATcheck(b,"BATprodInt");	BATloopFast(b, p, q, xx) {		dbl *value = (dbl*) BUNtloc(b, p);		if (*value == dbl_nil) {			result = dbl_nil;			break;		} else {			result *= *value;		}	}	*res = result;	return GDK_SUCCEED;}#line 983 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#line 894 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDavg_sht(dbl* res, BAT *b){	int cnt = BATcount(b);	dbl result=0.0;	CMDsum_sht_dbl(&result, b);	*res = result/cnt;	return GDK_SUCCEED;}#line 985 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#line 894 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDavg_int(dbl* res, BAT *b){	int cnt = BATcount(b);	dbl result=0.0;	CMDsum_int_dbl(&result, b);	*res = result/cnt;	return GDK_SUCCEED;}#line 986 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#line 894 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDavg_lng(dbl* res, BAT *b){	int cnt = BATcount(b);	dbl result=0.0;	CMDsum_lng_dbl(&result, b);	*res = result/cnt;	return GDK_SUCCEED;}#line 987 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#line 894 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDavg_flt(dbl* res, BAT *b){	int cnt = BATcount(b);	dbl result=0.0;	CMDsum_flt_dbl(&result, b);	*res = result/cnt;	return GDK_SUCCEED;}#line 988 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#line 894 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDavg_dbl(dbl* res, BAT *b){	int cnt = BATcount(b);	dbl result=0.0;	CMDsum_dbl_dbl(&result, b);	*res = result/cnt;	return GDK_SUCCEED;}#line 989 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#line 913 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDmin_sht(sht* result, BAT *b){	return BATmin(b, result)?GDK_SUCCEED:GDK_FAIL;}intCMDmax_sht(sht* result, BAT *b){	return BATmax(b, result)?GDK_SUCCEED:GDK_FAIL;}#line 991 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#line 913 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDmin_int(int* result, BAT *b){	return BATmin(b, result)?GDK_SUCCEED:GDK_FAIL;}intCMDmax_int(int* result, BAT *b){	return BATmax(b, result)?GDK_SUCCEED:GDK_FAIL;}#line 992 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#line 913 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDmin_flt(flt* result, BAT *b){	return BATmin(b, result)?GDK_SUCCEED:GDK_FAIL;}intCMDmax_flt(flt* result, BAT *b){	return BATmax(b, result)?GDK_SUCCEED:GDK_FAIL;}#line 993 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#line 913 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDmin_dbl(dbl* result, BAT *b){	return BATmin(b, result)?GDK_SUCCEED:GDK_FAIL;}intCMDmax_dbl(dbl* result, BAT *b){	return BATmax(b, result)?GDK_SUCCEED:GDK_FAIL;}#line 994 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#line 913 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDmin_lng(lng* result, BAT *b){	return BATmin(b, result)?GDK_SUCCEED:GDK_FAIL;}intCMDmax_lng(lng* result, BAT *b){	return BATmax(b, result)?GDK_SUCCEED:GDK_FAIL;}#line 995 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDminany(ptr result, BAT *b){	if (!ATOMlinear(b->ttype))		return GDKerror("CMDminANY: atom '%s' cannot be ordered linearly\n", ATOMname(b->ttype));	if (ATOMvarsized(b->ttype)) {			*(ptr *) result = BATmin(b, NULL);			return (result)?GDK_SUCCEED:GDK_FAIL;	}	if (BATmin(b, result)) {		if (b->ttype == TYPE_bat)			*(BAT **) result = BATdescriptor(*(bat *) result);		return GDK_SUCCEED;	}	return GDK_FAIL;}intCMDmaxany(ptr result, BAT *b){	if (!ATOMlinear(b->ttype))		return GDKerror("CMDmaxANY: atom '%s' cannot be ordered linearly\n", ATOMname(b->ttype));	if (ATOMvarsized(b->ttype)) {			*(ptr *) result = BATmax(b, NULL);			return (result)?GDK_SUCCEED:GDK_FAIL;	}	if (BATmax(b, result)) {		if (b->ttype == TYPE_bat)			*(BAT **) result = BATdescriptor(*(bat *) result);		return GDK_SUCCEED;	}	return GDK_FAIL;}#line 1036 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDselect1(BAT **result, BAT *b, ptr value){	ptr v = (b->ttype == TYPE_bat) ? (ptr) &((BAT *) value)->batCacheid : value;	return (*result = BATselect(b, v, 0)) ? GDK_SUCCEED : GDK_FAIL;}intCMDuselect1(BAT **result, BAT *b, ptr value){	ptr v = (b->ttype == TYPE_bat) ? (ptr) &((BAT *) value)->batCacheid : value;	return (*result = BATuselect(b, v, 0)) ? GDK_SUCCEED : GDK_FAIL;}intCMDselect(BAT **result, BAT *b, ptr low, ptr high){	ptr l = (b->ttype == TYPE_bat) ? (ptr) &((BAT *) low )->batCacheid : low ;	ptr h = (b->ttype == TYPE_bat) ? (ptr) &((BAT *) high)->batCacheid : high;	if (b->ttype == TYPE_bat && l != h ) {		GDKerror("CMDselect: range-selects on type BAT are not supported\n");		return GDK_FAIL;	}	return (*result = BATselect(b, l, h)) ? GDK_SUCCEED : GDK_FAIL;}intCMDuselect(BAT **result, BAT *b, ptr low, ptr high){	ptr l = (b->ttype == TYPE_bat) ? (ptr) &((BAT *) low )->batCacheid : low ;	ptr h = (b->ttype == TYPE_bat) ? (ptr) &((BAT *) high)->batCacheid : high;	if (b->ttype == TYPE_bat && l != h ) {		GDKerror("CMDuselect: range-selects on type BAT are not supported\n");		return GDK_FAIL;	}	return (*result = BATuselect(b, l, h)) ? GDK_SUCCEED : GDK_FAIL;}intCMDselect_(BAT **result, BAT *b, ptr low, ptr high, bit *l_in, bit *h_in){	int tt = b->ttype;	ptr nil = ATOMnilptr(tt);	ptr l = (b->ttype == TYPE_bat) ? (ptr) &((BAT *) low )->batCacheid : low ;	ptr h = (b->ttype == TYPE_bat) ? (ptr) &((BAT *) high)->batCacheid : high;	if (b->ttype == TYPE_bat && l != h ) {		GDKerror("CMDselect: range-selects on type BAT are not supported\n");		return GDK_FAIL;	}	if (*l_in == bit_nil && ATOMcmp(tt, l, nil)) {		GDKerror("CMDselect: flag 'l_in' must not be NIL, unless boundary 'low' is NIL\n");		return GDK_FAIL;	}	if (*h_in == bit_nil && ATOMcmp(tt, h, nil)) {		GDKerror("CMDselect: flag 'h_in' must not be NIL, unless boundary 'high' is NIL\n");		return GDK_FAIL;	}	return (*result = BATselect_(b, l, h, *l_in, *h_in)) ? GDK_SUCCEED : GDK_FAIL;}intCMDuselect_(BAT **result, BAT *b, ptr low, ptr high, bit *l_in, bit *h_in){	int tt = b->ttype;	ptr nil = ATOMnilptr(tt);	ptr l = (b->ttype == TYPE_bat) ? (ptr) &((BAT *) low )->batCacheid : low ;	ptr h = (b->ttype == TYPE_bat) ? (ptr) &((BAT *) high)->batCacheid : high;	if (b->ttype == TYPE_bat && l != h ) {		GDKerror("CMDuselect: range-selects on type BAT are not supported\n");		return GDK_FAIL;	}	if (*l_in == bit_nil && ATOMcmp(tt, l, nil)) {		GDKerror("CMDuselect: flag 'l_in' must not be NIL, unless boundary 'low' is NIL\n");		return GDK_FAIL;	}	if (*h_in == bit_nil && ATOMcmp(tt, h, nil)) {		GDKerror("CMDuselect: flag 'h_in' must not be NIL, unless boundary 'high' is NIL\n");		return GDK_FAIL;	}	return (*result = BATuselect_(b, l, h, *l_in, *h_in)) ? GDK_SUCCEED : GDK_FAIL;}intCMDfragment(BAT **result, BAT *b, ptr hlow, ptr hhigh, ptr tlow, ptr thigh){	return (*result = BATrestrict(b, hlow, hhigh, tlow, thigh)) ? GDK_SUCCEED : GDK_FAIL;}intCMDthetajoin(BAT **result, BAT *left, BAT *right, int *mode, lng *estimate){	return (*result = BATthetajoin(left, right, *mode, (*estimate == lng_nil) ? oid_nil : (size_t) * estimate)) ? GDK_SUCCEED : GDK_FAIL;}intCMDbandjoin(BAT **result, BAT *left, BAT *right, ptr minus, ptr plus){	return (*result = BATbandjoin(left, right, minus, plus)) ? GDK_SUCCEED : GDK_FAIL;}#line 1176 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#define BATtdiff(l,r) BATmirror(BATkdiff(BATmirror(l),BATmirror(r)))#define BATtintersect(l,r) BATmirror(BATkintersect(BATmirror(l),BATmirror(r)))#define BATtsort(b) BATmirror(BATsort(BATmirror(b)))#define BATtsort_rev(b) BATmirror(BATsort_rev(BATmirror(b)))#define BAThistogram_rev(b) BAThistogram(BATmirror(b))#define BATmark_default(b) BATmark(b,OIDnew(BATcount(b)))#define BATtmark_default(b) BATmirror(BATmark(BATmirror(b),OIDnew(BATcount(b))))#define BAThmark_default(b) BATmirror(BATmark(b,OIDnew(BATcount(b))))#define BATwcopy(b) BATcopy(b, b->htype, b->ttype, 1)#define BATrcopy(b) BATcopy(b, b->htype, b->ttype, 2)#line 1151 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDcount(int *result, BAT *b){	*result = BATcount(b);	return GDK_SUCCEED;}#line 1187 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#line 1145 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDhistogram(BAT **result, BAT *b){	return (*result = BAThistogram(b))?GDK_SUCCEED:GDK_FAIL;}#line 1188 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#line 1145 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDhistogram_rev(BAT **result, BAT *b){	return (*result = BAThistogram_rev(b))?GDK_SUCCEED:GDK_FAIL;}#line 1189 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#line 1145 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDsort(BAT **result, BAT *b){	return (*result = BATsort(b))?GDK_SUCCEED:GDK_FAIL;}#line 1190 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#line 1145 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDsort_rev(BAT **result, BAT *b){	return (*result = BATsort_rev(b))?GDK_SUCCEED:GDK_FAIL;}#line 1191 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#line 1145 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDtsort(BAT **result, BAT *b){	return (*result = BATtsort(b))?GDK_SUCCEED:GDK_FAIL;}#line 1192 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"#line 1145 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/kernel/algebra.mx"intCMDtsort_rev(BAT **result, BAT *b)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -