Changeset 3666c07 in tol


Ignore:
Timestamp:
May 15, 2009, 7:46:34 AM (17 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
ce02ff8
Parents:
7ee3411
Message:

Specializations of methods define and get.draw in SubMasterBlockSampler

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

File:
1 edited

Legend:

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

    r7ee3411 r3666c07  
    3737    };
    3838    BinGroup("<<",EvalSet(_.blocks, grp))
     39  };
     40
     41  ////////////////////////////////////////////////////////////////////////////
     42  Text _.autodoc.member.define =
     43  "Creates common information handler about each MCMC block"
     44  "Arguments are:\n"
     45  "  Text name: Identifies the block.\n"
     46  "  Set colNames: Identifiers of block parameters that must be all unique.\n"
     47  "  McmcPartialHandler mcmcPartialHandler: partial simulation info.\n"
     48  "  Real numBlock: The position of this block in full MCMC.\n"
     49  "  Real firstCol: First column of this block in full MCMC\n"
     50  "  NameBlock config: User configuration parameters\n";
     51  Real define(Text name,
     52              Set colNames,
     53              BysMcmc::McmcPartialHandler mcmcPartialHandler,
     54              Real numBlock,
     55              Real firstCol,
     56              BysMcmc::Config config)
     57  ////////////////////////////////////////////////////////////////////////////
     58  {
     59    Text _.name := name;
     60    Text _MID := "[MasterSampler "+name+"] ";
     61    Real _.N := Card(colNames);
     62    Real If(_.N, {
     63      Real GT0 (Real idx) { idx>0 };
     64      Set _.colNames := SetTolNameAndIndex(colNames);
     65      Real SetIndexByName(_.colNames);
     66      1
     67    });
     68    Real _.numBlock := numBlock;
     69    Real _.firstCol := firstCol;
     70    Real _.lastCol  := firstCol+_.N-1;
     71    Set _.colIdx := Range(_.firstCol, _.lastCol, 1);
     72    BysMcmc::Config _.config := config;
     73    VMatrix If(Or(!_.N, VRows(_.store)!=_.N), _.store := Rand(_.N,1,0,0), _.store);
     74    WriteLn(_MID+" created with "<<
     75       _.N+" parameters from "<<_.firstCol+" to "<<_.lastCol+"");
     76    1
    3977  };
    4078
    … …  
    5593      Real _.reloadParamNum := _.reloadParamNum +
    5694                              Card(blk::_.partialSampler::_.reloadParam);
    57       Real _.N := _.N + blk::_.N;
    5895      blk::initialize(0)
    5996    };
    … …  
    107144  {
    108145    draw.blocks(numSim)
     146  };
     147
     148  ////////////////////////////////////////////////////////////////////////////
     149  VMatrix get.draw(Real numSim, Real force)
     150  ////////////////////////////////////////////////////////////////////////////
     151  {
     152    draw(numSim)
    109153  };
    110154
Note: See TracChangeset for help on using the changeset viewer.