Ignore:
Timestamp:
Sep 3, 2009, 10:42:50 PM (17 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
e7e91d9
Parents:
f16fdcd
Message:

Ensuring that all members are well initialized at method build in all possible cases

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol/stdlib/math/stat/models/bayesian/bysMcmc/_partialSampler.tol

    rf16fdcd r40b58f9  
    169169  ////////////////////////////////////////////////////////////////////////////
    170170  {
     171  //WriteLn("TRACE BlockPartialSampler::build 1");
    171172    Real _.N := Card(blockParam);
    172173    BysMcmc::McmcPartialHandler _.mcmcPartialHandler := mcmcPartialHandler;
    173174    Set fixedParamIdx = Copy(Empty);
    174175    Set reloadParamIdx = Copy(Empty);
     176    Real   _.fixedParamNum  := 0;
     177    Real   _.reloadParamNum := 0;
     178    Real   _.freeParamNum   := 0;
     179    Matrix _.fixedParamIdx  := Rand(0,1,0,0);
     180    Matrix _.reloadParamIdx := Rand(0,1,0,0);
     181    Matrix _.freeParamIdx   := Rand(0,1,0,0);
     182    Set    _.fixedParam     := Copy(Empty);
     183    Set    _.reloadParam    := Copy(Empty);
     184    Set    _.freeParam      := Copy(Empty);
     185    Set    _.reloadParamIdxOrig := Copy(Empty);
    175186    If(!_.N,
    176187    {
    177       Matrix _.fixedParamIdx  := Rand(0,1,0,0);
    178       Matrix _.reloadParamIdx := Rand(0,1,0,0);
    179       Matrix _.freeParamIdx   := Rand(0,1,0,0);
    180       Set    _.fixedParam     := Copy(Empty);
    181       Set    _.reloadParam    := Copy(Empty);
    182       Set    _.freeParam      := Copy(Empty);
    183       Real   _.fixedParamNum  := 0;
    184       Real   _.reloadParamNum := 0;
    185       Real   _.freeParamNum   := 0;
    186188      1
    187189    },
    … …  
    191193        Set   fixedParamAll  = _.mcmcPartialHandler::_.fixedParam;
    192194        Set   fixedParamAux  = SelectIndexByName(blockParam, fixedParamAll);
    193         Set _.fixedParam    := ExtractByIndex(fixedParamAll, fixedParamAux);
    194         Real SetIndexByName(_.fixedParam);
    195         Set fixedParamIdx := SelectIndexByName(_.fixedParam, blockParam);
    196         Matrix _.fixedParamIdx := SetCol(fixedParamIdx);
    197         1
     195        Real If(!Card(fixedParamAux),
     196        {
     197          Set _.fixedParam    := ExtractByIndex(fixedParamAll, fixedParamAux);
     198          Real SetIndexByName(_.fixedParam);
     199          Set fixedParamIdx := SelectIndexByName(_.fixedParam, blockParam);
     200          Matrix _.fixedParamIdx := SetCol(fixedParamIdx);
     201          1
     202        })
    198203      });
    199204      Real If(Card(_.mcmcPartialHandler::_.reloadParam),
    … …  
    201206        Set   reloadParamAll  = _.mcmcPartialHandler::_.reloadParam;
    202207        Set   reloadParamAux  = SelectIndexByName(blockParam, reloadParamAll);
    203         Set _.reloadParam    := ExtractByIndex(reloadParamAll, reloadParamAux);
    204         Real SetIndexByName(_.reloadParam);
    205         Set reloadParamIdx := SelectIndexByName(_.reloadParam, blockParam);
    206         Matrix _.reloadParamIdx := SetCol(reloadParamIdx);
    207         Set _.reloadParamIdxOrig :=
    208          _.mcmcPartialHandler::_.reloader::selectIndexes(_.reloadParam);
    209         1
     208        Real If(Card(reloadParamAux),
     209        {
     210          Set _.reloadParam    := ExtractByIndex(reloadParamAll, reloadParamAux);
     211          Real SetIndexByName(_.reloadParam);
     212          Set reloadParamIdx := SelectIndexByName(_.reloadParam, blockParam);
     213          Matrix _.reloadParamIdx := SetCol(reloadParamIdx);
     214          Set _.reloadParamIdxOrig :=
     215           _.mcmcPartialHandler::_.reloader::selectIndexes(_.reloadParam);
     216          1
     217        })
    210218      });
    211219      Set freeParamIdx = Range(1,_.N,1)-(fixedParamIdx << reloadParamIdx);
Note: See TracChangeset for help on using the changeset viewer.