Login     Register

        Contact Us     Search

XLeratorDB/math Documentation

SQL Server MDETERM function


MDETERM
 
Updated: 17 August 2010

Use MDETERM to calculate the determinant of an N x N matrix, where N specifies the number of columns in the matrix. For matrices in normalized form, use the MDETERMN function.
 
Syntax
SELECT [wctMath].[wct].[MDETERM] (
  <@Matrix_TableName, nvarchar(4000),>
 ,<@ColumnNames, nvarchar(4000),>
 ,<@GroupedColumnName, nvarchar(4000),>
 ,<@GroupedColumnValue, sql_variant,>)
Arguments
@Matrix_TableName
the name, as text, of the table or view that contains the matrix values to be used in the MDETERM calculation.
@ColumnNames
the name, as text, of the columns in the table or view specified by @MatrixTableName that contains the matrix values to be used in the MDETERM calculation. Data returned from the @ColumnNames must be of the type float or of a type that implicitly converts to float.
@GroupedColumnName
the name, as text, of the column in the table or view specified by @Matrix_TableName which will be used for grouping the results.
@GroupedColumnValue
the column value to do the grouping on.
Return Types
float
Remarks
·         If the number of rows in the matrix is not equal to the number of columns, MDETERM will return an error.
·         No GROUP BY is required for this function even though it produces aggregated results.
·         Use the MDETERM_q function for more complex queries.
·         Use MDETERMN for a table in normal form.
·         The function returns an error if the matrix contains NULL.
Examples
CREATE TABLE #m(
      Col1 float,
      Col2 float,
      Col3 float,
      Col4 float
)
 
INSERT INTO #m
SELECT 1,2,3,10 UNION ALL
SELECT 6,4,4,11 UNION ALL
SELECT 7,8,9,12 UNION ALL
SELECT 16,15,14,13
 
SELECT wct.MDETERM('#m'
            ,'Col1, Col2, Col3, Col4'
            ,''
            ,NULL) as [|A|]
 

This produces the following result


                   |A|
----------------------
                   208
 
(1 row(s) affected)


See Also

·         Blog Post - SQL Server Matrix Functions

 



Copyright 2008-2024 Westclintech LLC         Privacy Policy        Terms of Service