Skip to content

Commit

Permalink
Squashed commits:
Browse files Browse the repository at this point in the history
[77d2742] BF: catch for situation where legacy rng is active (issue #32)
[fcd3c0c] Bump StanModel version
[8cfc934] correct license
  • Loading branch information
brian-lau committed May 15, 2017
1 parent d99f570 commit 5831c78
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 27 deletions.
4 changes: 2 additions & 2 deletions Examples/variational.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
% 1 chains, each with iter=2000, warmup=0, thin=1;
% post-warmup draws per chain=2000, total post-warmup draws=2000.
%
% mean sd 2.5% 25% 50% 75% 97.5%
% mu 7.75 4.63 -1.46 4.78 7.73 10.83 16.88
% mean sd 2.5% 25% 50% 75% 97.5%
% mu 7.75 4.63 -1.46 4.78 7.73 10.83 16.88
% tau 4.61 3.73 0.87 2.17 3.61 5.83 14.79
% eta[1] 0.34 0.99 -1.70 -0.33 0.37 0.99 2.26
% eta[2] -0.10 0.87 -1.74 -0.68 -0.11 0.48 1.59
Expand Down
45 changes: 24 additions & 21 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
Copyright (c) 2015, Brian Lau
Copyright (c) 2017, Brian Lau
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2 changes: 1 addition & 1 deletion StanModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
model_name_
end
properties(SetAccess = protected)
version = '0.6.1';
version = '0.7.0';
end

methods
Expand Down
10 changes: 7 additions & 3 deletions mcmc.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
rng_state % This is for the Matlab RNG
end
properties(GetAccess = public, SetAccess = protected)
version = '0.3.1';
version = '0.3.2';
end

methods
Expand Down Expand Up @@ -70,7 +70,6 @@

function ind = get.permute_index(self)
% https://github.com/stan-dev/pystan/pull/26
% TODO : cache this
if ~isempty(self.samples)
curr = rng;
rng(self.rng_state); % state at object construction
Expand All @@ -87,13 +86,18 @@
function set.rng_state(self,r)
if nargin == 2
if (isstruct(r)) || (isscalar(r) && (r>=0))
curr = rng;
if strcmp(curr.Type,'Legacy')
rng('default');
end
rng(r);
self.rng_state = rng;
else
error('mcmc:rng:InputFormat','Not a valid seed or struct for RNG.');
end
else
% Default to seed&state of current rng
% Default seed&state
rng('default');
self.rng_state = rng;
end
end
Expand Down

0 comments on commit 5831c78

Please sign in to comment.