What beats a flat array with strides for variables?


Context - 10.A.1

I am wondering on how to support 10.A.1 on a range of data representations, managed by a dispatch system, for a library of operations (product, marginalization, maximization, reduction, …)

I don’t want the data type scattered into functions and having to dance around DataFrames’ pooling. 10.A.1 has enough behaviors to warrant a data type of its own. As Koller says, indexing the appropriate entries in each factor is a key design decision.

However this is my first attempt at this, hence my post here.


One guess is something involving [code generation for] different data arrangements depending on the factor operation.

I see the data bending itself to the operation, and not the operation losing its identity to access the data.


It would help a lot if you can post some code with what you have tried and what seems to not be working as well as you would want it to.


(removed for violation of Community Standards)


So a type Factor having inner constructors for each operation I think is the answer.