/* 1 2 dot product (inner product) of two ranges */ #define DOT_R d[0] static void rf_dot_callback( Data *d) { d->DOT_R += eval_cell( d->cp_to, &d->to) * eval_cell( d->cp_from, &d->from); } double rf_dot(const Node *n, const Cell *c) { Data d; Node *r1 = Right(n); Node *r2 = r1->next; if( check_range( r1, "dot: first argument")) return 0; if( check_range( r2, "dot: second argument")) return 0; d.DOT_R = 0; ss_traverse_range2_adjust( &r1->u.r, &r2->u.r, c, rf_dot_callback, &d); return d.DOT_R; }