backport 8dfbec3c604101a18039cadd66b432ba3b5f325d (Add mixed product taking 3 double array as arguments)
backport commit 232cee4d79223e234d273ca585008d325d6ed0e3 (Optimize self outer product operator)
backport commit 1118efbf190e3fa1eff8aaf9d9d4bcad67180ecd (Avoid copy of input vectors.)