outer-product and inner-product API functions
square function