A matrix can be build as a list of vectors.
In our example two vectors.
Query
WITH
MEMBER [Measures].[val] AS MatrixN( VectorN(2,3),VectorN(2,3) )->length()
SELECT
[Measures].[val] ON 0
FROM
[Sales]
Result
Assertion : Cell Equals
WITH
MEMBER [Measures].[val] AS 4
SELECT
[Measures].[val] ON 0
FROM
[Sales]
MatrixN class support the + operator.
In this example, ( (1,2),(3,4) ) + 2 = ( (3,5),(5,6) )
Query
WITH
MEMBER [Measures].[val] AS MatrixN( VectorN(1,2), VectorN(3,4) ) + 2
SELECT
[Measures].[val] ON 0
FROM
[Sales]
Result
val |
[[3.0, 5.0], [4.0, 6.0]] |
Assertion : Cell Equals
WITH
MEMBER [Measures].[val] AS 2 + MatrixN( VectorN(1,2), VectorN(3,4) )
SELECT
[Measures].[val] ON 0
FROM
[Sales]
Assertion : Cell Equals
WITH
MEMBER [Measures].[val] AS MatrixN( VectorN(1+2,2+2), VectorN(3+2,4+2) )
SELECT
[Measures].[val] ON 0
FROM
[Sales]
MatrixN class support the + operator.
In this example, ( (1,2),(3,4) ) - 2 = ( (-1,0),(1,2) )
Query
WITH
MEMBER [Measures].[val] AS MatrixN( VectorN(1,2), VectorN(3,4) ) - 2
SELECT
[Measures].[val] ON 0
FROM
[Sales]
Result
val |
[[-1.0, 1.0], [0.0, 2.0]] |
Assertion : Cell Equals
WITH
MEMBER [Measures].[val] AS (-2) + MatrixN( VectorN(1,2), VectorN(3,4) )
SELECT
[Measures].[val] ON 0
FROM
[Sales]
Assertion : Cell Equals
WITH
MEMBER [Measures].[val] AS MatrixN( VectorN(1-2,2-2), VectorN(3-2,4-2) )
SELECT
[Measures].[val] ON 0
FROM
[Sales]
MatrixN class support the + operator.
In this example, ( (1,2),(3,4) ) * 2 = ( (2,4),(6,8) )
Query
WITH
MEMBER [Measures].[val] AS MatrixN( VectorN(1,2), VectorN(3,4) ) * 2
SELECT
[Measures].[val] ON 0
FROM
[Sales]
Result
val |
[[2.0, 6.0], [4.0, 8.0]] |
Assertion : Cell Equals
WITH
MEMBER [Measures].[val] AS 2 * MatrixN( VectorN(1,2), VectorN(3,4) )
SELECT
[Measures].[val] ON 0
FROM
[Sales]
Assertion : Cell Equals
WITH
MEMBER [Measures].[val] AS MatrixN( VectorN(1*2,2*2), VectorN(3*2,4*2) )
SELECT
[Measures].[val] ON 0
FROM
[Sales]
MatrixN class support the / operator.
In this example, ( (1,2),(3,4) ) / 2 = ( (1/2,2/2),(3/2,4/2) )
Query
WITH
MEMBER [Measures].[val] AS MatrixN( VectorN(1,2), VectorN(3,4) ) / 2
SELECT
[Measures].[val] ON 0
FROM
[Sales]
Result
val |
[[0.5, 1.5], [1.0, 2.0]] |
Assertion : Cell Equals
WITH
MEMBER [Measures].[val] AS MatrixN( VectorN(1/2,2/2), VectorN(3/2,4/2) )
SELECT
[Measures].[val] ON 0
FROM
[Sales]
MatrixN class support the * operator with a vector
In this example, ( (11,12),(21,22) ) * (1,2) = ( 11*1 + 21*2, 12*1 + 22*2 )
Query
WITH
MEMBER [Measures].[val] AS MatrixN( VectorN(11,12), VectorN(21,22) ) * VectorN(1,2)
SELECT
[Measures].[val] ON 0
FROM
[Sales]
Result
Assertion : Cell Equals
WITH
MEMBER [Measures].[val] AS VectorN( 11*1 + 21*2, 12*1 + 22*2 )
SELECT
[Measures].[val] ON 0
FROM
[Sales]