Elessar wrote:I have a 2-dim cube with equivalent dimensions (an NxN matrix) and need to calculate it's determinant.
If N was only going to be 2, or 3, then you could do something like this with the inclusion of a measures dimension:
Code: Select all
SKIPCHECK;
['Measure':'Input'] = N: STET;
# 2x2 grid
['Row':'a', 'Column':'a', 'Measure':'Output'] = N:
IF ( DB ( 'Calc Control', 'Grid Size', 'Number' ) = 2,
( ['Row':'a','Column':'a','Measure':'Input'] * ['Row':'b','Column':'b','Measure':'Input'] )
-
( ['Row':'a','Column':'b','Measure':'Input'] * ['Row':'b','Column':'a','Measure':'Input'] ),
CONTINUE
);
# 3x3 grid
['Row':'a', 'Column':'a', 'Measure':'Output'] = N:
IF ( DB ( 'Calc Control', 'Grid Size', 'Number' ) = 3,
( ['Row':'a','Column':'a','Measure':'Input']
*
( ['Row':'b','Column':'b','Measure':'Input'] * ['Row':'c','Column':'c','Measure':'Input'] )
-
( ['Row':'b','Column':'c','Measure':'Input'] * ['Row':'c','Column':'b','Measure':'Input'] ) )
-
( ['Row':'a','Column':'b','Measure':'Input']
*
( ['Row':'b','Column':'a','Measure':'Input'] * ['Row':'b','Column':'c','Measure':'Input'] )
-
( ['Row':'b','Column':'c','Measure':'Input'] * ['Row':'c','Column':'a','Measure':'Input'] ) )
+
( ['Row':'a','Column':'c','Measure':'Input']
*
( ['Row':'b','Column':'a','Measure':'Input'] * ['Row':'c','Column':'b','Measure':'Input'] )
-
( ['Row':'b','Column':'b','Measure':'Input'] * ['Row':'c','Column':'a','Measure':'Input'] ) ),
CONTINUE
);
# no calcs where grid size is > 3 % non-a and non-a combos
['Measure':'Output'] = N: STET;
FEEDERS;
['Measure':'Input'] => ['a', 'a', 'Output'];
If you don't know N, then I'd prefer to use TI as it is likely you can write one TI to handle any N.
Why don't you know N?