added matrix <-> scalar |, &, ~
reduced code redundancy via code generator