Login     Register

        Contact Us     Search

XLeratorDB/math Documentation

SQL Server SUMX2MY2 function


SUMX2MY2
Updated: 25 April 2017

Use the scalar function SUMX2MY2 to calculate the sum of the difference of squares of corresponding values in two matrices.

Syntax
SELECT [wct].[SUMX2MY2] (
   <@Matrix1, nvarchar(max),>
  ,<@Matrix2, nvarchar(max),>)
Arguments
Input NameDescription
@Matrix1The string representation of the lhs matrix with columns separated by commas and rows separated by semi-colons.
@Matrix2The string representation of the rhs matrix with columns separated by commas and rows separated by semi-colons.
Return Type
float
Remarks
  • @Matrix1 and @Matrix2 must have the same number of rows and columns or NULL is returned.
  • Available in XLeratorDB / math 2008 only
Examples
Example #1
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.SUMX2MY2(@a, @b) as SUMX2MY2

This produces the following result.

See Also


Copyright 2008-2024 Westclintech LLC         Privacy Policy        Terms of Service