MBB-team / VBA-toolbox

The VBA toolbox
GNU General Public License v3.0
130 stars 67 forks source link

bug in multisource option #25

Closed nicoborderies closed 7 years ago

nicoborderies commented 7 years ago

Hello, after synchronizing my VBA version with the latest version on GitHub, there is a bug when using the multisource option. It seems to me that the "VBA_check" subfunction doesn't tolerate anymore to have different hyperpriors for different sources. The "demo_multisource" script does'nt work neither. I am working Under MATLAB 2017a but the bug is also present in MATLAB 2014b.

The error message is the following: Assignment has more non-singleton rhs dimensions than non-singleton subscripts

Error in VBA_check (line 137) options.isYout(options.sources(gsi(i)).out,t) = ~diQ;

Error in simulateNLSS (line 87) [options,u,dim] = VBA_check(zeros(dim.p,dim.n_t),u,f_fname,g_fname,dim,options);

Error in demo_multisource (line 45) [y,x,x0,eta,e] = simulateNLSS(T,[],g_fname,[],phi,u,Inf,sigma,options,[]);

NicoB

lionel-rigoux commented 7 years ago

Hey Nico, Thanks for pointing out this bug. I'll check into this and commit a fix as soon as possible (this afternoon probably). Cheers

lionel-rigoux commented 7 years ago

The bug comes from the VBA_fillInPriors that Jean commited (1a717f91538ba8a93d7b76d2b5835e7e20e24aca) beginning of March . This function fill in default priors disregarding any source specification (a default source struct('binomial',0) is hardcoded instead). It is however properly done in VBA_priors if called with the user defined option structure.

A workaround would be to rewrite VBA_fillInPriors to avoid any code redundancy with VBA_priors. In particular, it could call VBA_priors to get default (using a correct option structure) and copy the fields (instead of computing them again) that are missing in the original prior.

I will initiate a pull request with a suggestion.

lionel-rigoux commented 7 years ago

I rolled back the master branch so it is now free of bug. Unless you need the functionalities introduced after the 15th February, you can use the master and it should work. The issue is now relocated in the developement branch and a fix will be applied as soon as Jean check if it is compatible with his version.

nicoborderies commented 7 years ago

Thanks a lot Lionel for all your efforts of structuring the development workflow. It is very clear and it solved my current practical issue. NicoB

lionel-rigoux commented 7 years ago

This has been fixed by #26