Changeset ee53e55 in tol


Ignore:
Timestamp:
Jun 10, 2010, 9:37:12 AM (16 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
3bace1f
Parents:
d144998
Message:

Fixes #917
Merging linear blocks of child modules has to accept repeated variables when the InitialValue is the same in all redefinitions.
The Unique operator checks for all fields of structure @BSR.LinearBlock including 'Used' field that is not relevant

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@2216 be4846ae-f051-483a-831f-b64e7d08527f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol/stdlib/math/stat/models/bayesian/bysMcmc/bsr/modularSchema/_monophasic.tol

    rd144998 ree53e55  
    4747    Set LinearBlock =
    4848    {
    49       Set aux.1 = EvalSet(subModule, Set(@BSR.ModelDef module)
     49      Set defined = Copy(Empty);
     50      Set EvalSet(subModule, Real(@BSR.ModelDef module)
    5051      {
    5152        Set sel = Select(module->LinearBlock, Real(@BSR.LinearBlock v)
    5253        {
    53           Not(v->Extern)
    54         })
    55       });
    56       Set aux.2 = Unique(SetConcat(aux.1));
    57       Real If(Card(aux.2), SetIndexByName(aux.2));
    58       aux.2
     54          If(v->Extern, False,
     55          {
     56            Real found = FindIndexByName(defined,Name(v));
     57            If(!found, True,
     58            {
     59              Real oldDef = defined[found]->InitialValue;
     60              Real newDef = v->InitialValue;
     61              If(oldDef==newDef,
     62              {
     63                Real v->Extern := True;
     64                False
     65              },
     66              {
     67                Error("Linear block variable "+Name(v)+" <- "<<newDef+
     68                      "is already defined as "+Name(v)+" <- "<<oldDef);
     69                True
     70              })
     71            })
     72          })
     73        });
     74        Set Append(defined,sel,True);
     75        True
     76      });
     77    //Set aux.2 = Unique(SetConcat(aux.1));
     78    //Real If(Card(defined), SetIndexByName(defined));
     79      defined
    5980    }; 
    6081    Real n = Card(LinearBlock);
Note: See TracChangeset for help on using the changeset viewer.