Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

Provide high-level syntax for creating factors #141

Open
antoine-dedieu opened this issue May 3, 2022 · 0 comments
Open

Provide high-level syntax for creating factors #141

antoine-dedieu opened this issue May 3, 2022 · 0 comments

Comments

@antoine-dedieu
Copy link
Contributor

One of the speed bottleneck in creating a FactorGraph is the time to create the variables_for_factors list, which is currently slow as we loop through the individual variables.

However, in the case where all the variable groups are NDVarArr we can speed up this step a lot proposing a generic get_factors interface where the user would define the general rule for the factors and the corresponding list would be generated with numba.

One options is to have a first argument which consists of variable groups for which we loop over dimensions, and a second argument which consists of variable groups for do not loop over,
For, example get_factors({x:(i, j), y:(k, l)}, {z:(i+k, j+l)}) would mean

factors = []
for i in range(x.shape[0]):
    for j in range(x.shape[1]):
        for k in range(y.shape[0]):
            for l in range(y.shape[1]): 
                factors.append((x[i, j], y[k, l], z[i+k, j+l]))
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant