[qfcc] Implement the regressive product

That went surprisingly well (but it is built up from other ops, so
pretty easy, really).
This commit is contained in:
Bill Currie 2023-08-28 20:32:29 +09:00
parent e2d812ab6a
commit 58a1758363
3 changed files with 10 additions and 2 deletions

View file

@ -1342,8 +1342,10 @@ geometric_product (expr_t *e1, expr_t *e2)
static expr_t *
regressive_product (expr_t *e1, expr_t *e2)
{
notice (e1, "not implemented");
return 0;
auto a = algebra_dual (e1);
auto b = algebra_dual (e2);
auto c = outer_product (a, b);
return algebra_dual (c);
}
static expr_t *

View file

@ -1773,6 +1773,7 @@ expr
| expr CROSS expr { $$ = binary_expr (CROSS, $1, $3); }
| expr DOT expr { $$ = binary_expr (DOT, $1, $3); }
| expr WEDGE expr { $$ = binary_expr (WEDGE, $1, $3); }
| expr REGRESSIVE expr { $$ = binary_expr (REGRESSIVE, $1, $3); }
;
texpr

View file

@ -265,5 +265,10 @@ main (void)
s.scalar, s.bvec);
return 1;
}
auto line = bvec bvecb;
if ((dvec3)line != '-11 8 34'd) {
printf ("bvec bvecb != '-11 8 34': %lv\n", line);
return 1;
}
return 0; // to survive and prevail :)
}