Changeset: 4060199ea71e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4060199ea71e
Modified Files:
sql/backends/monet5/sql.c
Branch: default
Log Message:
Use array indexing.
diffs (49 lines):
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -3557,18 +3557,18 @@ SQLbat_alpha_cst(bat *res, const bat *de
}
str
-SQLcst_alpha_bat(bat *res, const dbl *decl, const bat *theta)
+SQLcst_alpha_bat(bat *res, const dbl *decl, const bat *thetabid)
{
BAT *b, *bn;
- BATiter bi;
BUN p, q;
dbl s, c1, c2, r;
char *msg = NULL;
-
- if ((b = BATdescriptor(*theta)) == NULL) {
+ dbl *thetas;
+
+ if ((b = BATdescriptor(*thetabid)) == NULL) {
throw(SQL, "alpha", SQLSTATE(HY005) "Cannot access column
descriptor");
}
- bi = bat_iterator(b);
+ thetas = (dbl *) Tloc(b, 0);
bn = COLnew(b->hseqbase, TYPE_dbl, BATcount(b), TRANSIENT);
if (bn == NULL) {
BBPunfix(b->batCacheid);
@@ -3576,16 +3576,16 @@ SQLcst_alpha_bat(bat *res, const dbl *de
}
BATloop(b, p, q) {
dbl d = *decl;
- dbl *theta = (dbl *) BUNtail(bi, p);
+ dbl theta = thetas[p];
if (is_dbl_nil(d))
r = dbl_nil;
- else if (fabs(d) + *theta > 89.9)
+ else if (fabs(d) + theta > 89.9)
r = (dbl) 180.0;
else {
- s = sin(radians(*theta));
- c1 = cos(radians(d - *theta));
- c2 = cos(radians(d + *theta));
+ s = sin(radians(theta));
+ c1 = cos(radians(d - theta));
+ c2 = cos(radians(d + theta));
r = degrees(fabs(atan(s / sqrt(fabs(c1 * c2)))));
}
if (BUNappend(bn, &r, false) != GDK_SUCCEED) {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list