![]() | SQXVisualizeMatrixTableFromQuery Method |
Namespace: sqx
public static int VisualizeMatrixTableFromQuery( SqlChars Query, SqlBoolean OrderByMax )
declare @Query nvarchar(max) = N' select a.Value [1],b.Value [2],c.Value [3],d.Value [4] from sqx.VectorTable(sqx.RandomVector(10,1)) a inner join sqx.VectorTable(sqx.RandomVector(10,2)) b ON a.ID = b.ID inner join sqx.VectorTable(sqx.RandomVector(10,3)) c ON a.ID = c.ID inner join sqx.VectorTable(sqx.RandomVector(10,4)) d ON a.ID = d.ID ' declare @R sqx.Matrix exec sqx.CorrelationMatrix @Query = @Query , @Population = 1, @SnapShot = 0, @CorrelationMatrix = @R OUTPUT drop table if exists #tmpmatrix; create table #tmpmatrix (ID int not null primary key, [1] float,[2] float,[3] float,[4] float) insert #tmpmatrix exec sqx.MatrixToTable @R set @Query = 'select ID,[1],[2],[3],[4] from #tmpmatrix' select * from #tmpmatrix exec sqx.VisualizeMatrixTableFromQuery @Query, 1 drop table if exists #tmpmatrix; /* ID 1 2 3 4 ----------- ---------------------- ---------------------- ---------------------- ------------------ 1 1 0.0171373794175597 0.258705024392653 -0.431665058767189 2 0.0171373794175597 1 -0.394987971874921 0.233818402745601 3 0.258705024392653 -0.394987971874921 1 0.129561546992729 4 -0.431665058767189 0.233818402745601 0.129561546992729 1 Position ByMax1 ByMax2 ByMax3 ByMax4 ----------- ----------- ----------- ----------- ----------- 1 1 2 3 4 2 3 4 1 2 3 2 1 4 3 4 4 3 2 1*/