SELECT [wct].[SUMXMY2] (
<@Matrix1, nvarchar(max),>
,<@Matrix2, nvarchar(max),>)
DECLARE @a as nvarchar(max) = wct.MATRIX2STRING_q('
SELECT
POWER(n.x,m.p1),
POWER(n.x,m.p2),
POWER(n.x,m.p3),
POWER(n.x,m.p4)
FROM (VALUES (1),(2),(3),(4))n(x)
CROSS APPLY (VALUES (0,1,2,3))m(p1,p2,p3,p4)'
)
DECLARE @B as nvarchar(max) = wct.MUPDATE(@a,NULL,NULL,NULL,NULL,'+',wct.ONES(4,4),NULL,NULL,NULL,NULL)
SELECT
wct.SUMXMY2(@a, @b) as SUMXMY2
This produces the following result.