I am working with terms of the form
A**B1**B2
where A
, B1
, and B2
are at this point abstract operators and **
means NonCommutativeMultiply
.
I'd like to manipulate these expressions at an abstract level, and then only later substitute explicit matrix operations. Specifically, $A$ will be a square matrix, while $B1$ and $B2$ will be commensurate vectors.
The trick is that at this point the specific meanings of the two occurrences of **
will change. Specifically, A ** B1
will become a matrix multiplication, and B1 ** B2
will become an outer product.
I'm using a package (NCAlgebra
) to simplify the expressions at an abstract level, and I want the special handling of NonCommutativeMultiply
to apply then. So it would be good if there were some way to create an operation that behaves in all respects as NonCommutativeMultiply
(so that the package still recognizes it as such), except in a certain function of my design (so that it gets substituted for the correct explicit operation).
Is there a way I can accomplish this?
Edit: A perhaps-important complication is that in the general case, once made explicit the matrix dimensions will be such that the matrix multiplication A ** B1 will not be defined until the outer product B1 ** B2 has been performed.
A**B1**B2
and the two**
look the same to me. How are we supposed to know that they are supposed to be different? $\endgroup$