Skip to content

Allocate TVectorD only once #63

Closed
Closed

Description

@fredRos

Browsing the code, I stumbled on this line
https://github.com/bat/bat/blob/master/src/BCEngineMCMC.cxx#L1408

bool BCEngineMCMC::MCMCGetProposalPointMetropolis(unsigned chain, std::vector<double>& x)
{
    x = fMCMCx[chain];

    // generate N-Free N(0,1) random values
    TVectorD y(GetNFreeParameters());
...
}

@greenwald, is there any good reason to allocate a new TVectorD in every iteration? I guess not and suggest we allocate this once in MCMCInitialize

Activity

  1. self-assigned this
    on Sep 3, 2015
  2. greenwald commented on Sep 3, 2015

    @greenwald
    Contributor

    Nope. Feel free to optimize.

  3. added a commit that references this issue on Sep 3, 2015
    3e53e5a
  4. added a commit that references this issue on Oct 20, 2015
    2e980c7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions