MRORTHO
Updated: 10 May 2016
Use MRORTHO to generate an m-by-m random orthogonal matrix.
Syntax
SELECT [wct].[MRORTHO](
<@m, int,>)
Arguments
@m
the number of rows and columns in returned matrix. @m must be of the type int or of a type that implicitly converts to int.
Return Type
[nvarchar](max)
Remarks
· @m must be greater than zero.
Examples
Example #1
In this example we generate a random 4-by-4 random orthogonal matrix. The returned matrix is a string where the columns are separated by commas and the rows are separated by semicolons. Your results will be different.
SELECT wct.MRORTHO(4) as [Random Ortho]
This produces the following result.
Example #2
In this example we generate a 5-by-5 random orthogonal matrix and use the MATRIX function to convert the output to 3rd normal form. Your results will be different.
SELECT * FROM wct.MATRIX(wct.MRORTHO(5))
This produces the following result.
Example #3
In this example we generate the 5-by-5 random orthogonal matrix and pivot the MATRIX output into 'spreadsheet' format. Your results will be different.
SELECT [0],[1],[2],[3],[4]
FROM wct.MATRIX(wct.MRORTHO(5))d
PIVOT(MAX(ItemValue) FOR ColNum IN([0],[1],[2],[3],[4]))pvt
ORDER BY RowNum
This produces the following result.
See Also