inv_as_solve optimization checks if op is Dot

Previously it checked if node.op == dot where dot was a dot function
I assume that this was a mistake

I've changed this to check if isinstance(node.op, (Dot, Dot22))
I've also added a test