Is there a NamedArray or DimensionalData type package that can combine orthogonal dimensions?

Lincoln_Hannah
Tue, 01 Nov 2022 10:38:35 +0000
General Usage

Vectorised operations on regular arrays produce a cross product across dimensions. e.g.

x = [1 2 3]

a = reshape( x, (3,1,1))
b = reshape( x, (1,3,1))
c = reshape( x, (1,1,3))

X = @. a + b + c

X[3,3,3]  #  =9

Similarly, is there a package that allows something like:

@dimensions begin
    Currency => [USD, GBP, EUR]
    Date     => [ Date(2022,1,1),  Date(2022,1,2), Date(2022,1,3) ]
    Scenario => [1, 2, 3]
end

a = NammedArray( x, Currency )
b = NammedArray( x, Date     )
c = NammedArray( x, Scenario )

X = @. a + b + c             #NammedArray across Currency, Date and Scenario dimensions

X[EUR,  Date(2022,1,3),  3]  #   =9

5 posts - 3 participants