jessegrabowski / gEconpy

A collection of tools for working with DSGE models in python, inspired by the R package gEcon
https://geconpy.readthedocs.io/en/latest/index.html
GNU General Public License v3.0
23 stars 3 forks source link

Add indexing syntax to GCN parser for construction of multiple similar blocks #11

Open jessegrabowski opened 1 year ago

jessegrabowski commented 1 year ago

The gEcon R package allows for (something like) the following:

<i=(1,3)>
block HOUSEHOLD_<i>
{
    identities
        {
            C_<i>[] + I_<i>[] = r[] * K_<i>[-1] + w[] * L_<i>[] + Div_<i>[];
        };
};

This will automatically generate 3 household blocks with indices 1,2,3, along with the associated variables. It also allows for automatic summation across indexed variables, like:

Div[] = Sum<i>(Div_<i>[]);

This would be a nice feature when thinking about e.g. multiple sectors.