Commit Graph

125 Commits (7dd2dd5e24a343fbeaf3522ea5e535c27d8b9f95)

Author SHA1 Message Date
Sébastien Villemot 188d6296d7
Dynare++: finish to apply Dynare C++ coding style and extensions (.cc/.hh) 2019-01-08 17:12:05 +01:00
Sébastien Villemot ce1ef47093
dynare++ / tensor library (TL): move away from CWEB
By the way apply Dynare C++ coding style and extensions (.cc/.hh).
2019-01-08 16:09:25 +01:00
Sébastien Villemot df772325a2
dynare++/kord: move away from CWEB
By the way apply Dynare C++ coding style and extensions (.cc/.hh).
2019-01-04 16:32:05 +01:00
Sébastien Villemot 331a27398a
Fix another memory leak in k-order DLL
Re Dynare/dynare#1490.
2018-11-08 17:30:48 +01:00
Sébastien Villemot 50a09a687e
C++11 modernization
Incidentally, fix a memory leak related to DynamicModelAC instantiation, using
a std::unique_ptr (see Dynare/dynare#1490).
2018-11-08 17:24:19 +01:00
Sébastien Villemot 59642c3312 C output of preprocessor now splits generated fcts into several smaller fcts
Adapt the k-order DLL as a consequence.
2018-10-01 16:13:12 +02:00
Sébastien Villemot cb46a2697e Fix invalid memory write in k-order DLL
The bug would show at order 3 when the last output argument (derivs) is not
requested (in practice every 3rd order solution without pruning). The DLL would
still attempt to write into it, causing an invalid memory access.
2018-07-02 16:37:46 +02:00
Sébastien Villemot a1b8bd39b2 Move the location of various generated files on the filesystem
- M and MEX files are now under +${MODELNAME}/
- bytecode, C source and JSON now under ${MODELNAME}/model/
2018-06-27 17:03:39 +02:00
Stéphane Adjemian (Charybdis) 1bf81c9f5a Fixed copyright notices. 2017-05-18 18:36:38 +02:00
Stéphane Adjemian (Charybdis) b4448937cc Fixed indentation of c/h/cc/hh files. 2017-05-16 16:30:27 +02:00
Stéphane Adjemian (Charybdis) a53636e24e Fixed copyright notices. 2017-05-16 14:11:15 +02:00
Michel Juillard 5d38280f27 remove one instance of dynamic exception specification
closes issue #1250
2016-07-16 00:13:47 +02:00
Sébastien Villemot 41295ad602 Minor cleanups in k_order_perturbation DLL. 2014-03-21 17:26:55 +01:00
Sébastien Villemot 050b495a52 Fix an invalid memory access in k_order_perturbation DLL.
In the case where a 2nd/3rd derivative is symbolically not zero but numerically
zero at the evaluation point, the last lines of the g2/g3 matrices (in
KordpDynare::calcDerivativesAtSteady()) where uninitialized (these matrices
store the sparse hessian/3rd-deriv in coordinate list form, i.e. with 3 columns
and as many rows as non-zero elements). When reconstructing the dense
hessian/3rd-deriv matrix out of g2/g3, this would result in invalid memory
accesses.
2014-03-21 17:26:48 +01:00
Sébastien Villemot e5d4defb41 Fix handling of qz_criterium in k_order_perturbation MEX.
If the MEX file was called with options_.qz_criterium=[], it would not use a
correct default value (but would use NaN).

Closes #574
2014-01-27 15:33:37 +01:00
Sébastien Villemot 61485ab809 Fix copyright notices 2013-06-12 17:04:46 +02:00
Sébastien Villemot f1c8ec60c7 Remove various compilation warnings 2013-06-12 16:05:35 +02:00
Sébastien Villemot c121aa14b1 Remove oo_.dr.{nstatic,npred,nboth,nfwrd,nspred,nsfwrd}
Replace them by equivalents in M_ (and an extra one: M_.dynamic).

IMPORTANT POINT: oo_.dr.npred used to count both purely backward and mixed/both
variables. This was the cause of lots of confusion. The new M_.npred only
counts purely backward variables.

We now have the following indentities:

M_.npred + M_.nboth + M_.nfwrd + M_.nstatic = M_.endo_nbr
M_.nspred = M_.npred + M_.nboth
M_.nsfwrd = M_.nfwrd + M_.nboth
M_.ndynamic = M_.npred + M_.nboth + M_.nfwrd
2012-11-16 20:05:13 +01:00
Michel Juillard f5f5ca1a83 removing printing used for debugging 2012-08-01 18:38:42 +02:00
Michel Juillard 2244af9c62 adding pruning option for 3rd order 2012-07-31 21:50:59 +02:00
Michel Juillard 84164dc57e adding possibility to pass derivative matrices to k_order_perturbation
MEX function
2012-07-07 21:21:28 +02:00
Michel Juillard 287b134884 k_order mex: added derivatives as members of KorderpDynare 2012-07-06 13:52:17 +02:00
Sébastien Villemot 02efbd31a8 Convert files to Unix EOL 2012-06-08 19:10:19 +02:00
Sébastien Villemot 1f9cea669a Update copyright notices 2012-06-08 18:22:34 +02:00
Sébastien Villemot a66594caed Add MEXEXT define to build system, adapt relevant DLL and Windows packaging
Closes: #235
2012-01-09 12:39:09 +01:00
Sébastien Villemot 5fa666e448 k-order perturbation: cosmetic change related to mxGetPr/mxGetData 2011-05-20 10:59:40 +02:00
Sébastien Villemot f5b35df24f k-order perturbation: fixed bug in M-file evaluation 2011-05-20 10:59:40 +02:00
Michel Juillard 55bb27c5f6 new correction for steady_state operator bug. Steady_state vector is passed as argument to *_dynamic model function. As a result, bytecode is currently broken. 2011-03-13 17:06:57 +01:00
Sébastien Villemot 7717da4316 K-order DLL: remove warning about NOMINMAX 2011-02-07 12:37:47 +01:00
Sébastien Villemot 0f9ec8b2dc K-order DLL: add test for NaN/Inf in param/steady-state vectors to avoid crashes (thanks to J. Pfeifer for reporting this) 2011-02-07 11:12:57 +01:00
Sébastien Villemot 02652f6eb8 Updated copyright notices 2011-02-04 17:27:33 +01:00
Sébastien Villemot cc2a9d90ac Global reindentation of MEX source files 2011-02-04 16:53:12 +01:00
Houtan Bastani a11817cfa4 k-order: added support for m-files, added tests and modified manual 2010-12-22 09:48:05 +01:00
Houtan Bastani d0853e1658 k-order: removed unnecessary check 2010-12-22 09:48:05 +01:00
Houtan Bastani d69d225b82 k-order: removed unused variable from class definition 2010-12-17 12:16:32 +01:00
Houtan Bastani b63590712c fixed bug in argument number check and removed unused variable 2010-12-14 18:42:29 +01:00
Sébastien Villemot 2d84d8dc49 K-order DLL: code simplification 2010-12-06 17:01:06 +01:00
Sébastien Villemot a9b4331a95 Bugfix at order 3 (hopefully was not affecting final results, thanks to Pablo Winant for spotting this):
- in the 3rd derivatives matrix, among symmetric elements, the first one had
the right values but the following ones were set to zero
- moreover, the k-order DLL was trying to add all the symmetric elements in the
folded tensor, instead of only keeping one value among all the symmetric ones
- hopefully, Ondra's tensor library was (silently) refusing to add symmetric
elements after the first (and right) value had been added
- so the final result was correct
2010-12-06 17:00:46 +01:00
Sébastien Villemot dbe288e3ca Make sure "min" and "max" macros are never defined under Windows, this can create conflicts with "std::min" and "std::max" 2010-10-29 12:01:47 +02:00
Sébastien Villemot eea1bcc27c k-order DLL: fix bug related to number of rows of matrix of endogenous
(nb_row_x was incorrectly initialized in dynamic C file)
2010-10-05 15:28:15 +02:00
Houtan Bastani e32c8b1b76 k_order_perturbation: remove instances of mexErrMsgTxt and mexErrMsgIdAndTxt 2010-09-23 10:44:39 +02:00
Sébastien Villemot aa8963c1db K-order DLL: code simplification 2010-09-20 19:24:23 +02:00
Sébastien Villemot d7754ca288 K-order DLL: make it compatible with changes introduced in
648c3cd177
2010-09-20 18:30:00 +02:00
Sébastien Villemot 8589be3d4b K-order DLL: cosmetic changes
- remove unused argument of the DLL
- fix documentation inside source file
2010-08-30 17:11:58 +02:00
Sébastien Villemot a4769fc80d K-order DLL: no longer create an extra MAT file (useless and undocumented) 2010-08-30 17:11:26 +02:00
Michel Juillard 89bdc81ada suppressed computation of steady state inside k_order_perturbation 2010-07-17 10:18:25 +02:00
Michel Juillard 96bdf8c371 make sure that 2nd and 3rd order derivatives that haven't been computed are not taken to be zero. 2010-07-17 10:14:22 +02:00
Sébastien Villemot f34c31307b K-order: minor fix for order of initialization of data members 2010-06-25 15:40:36 +02:00
Michel Juillard a3d798836e k_order_perturbation: fixing bug in making of tensor of 3rd order derivatives
modifying tests and adding a new test against dynare++ output (fs2000k4.mod)
2010-05-22 16:12:39 +02:00
Sébastien Villemot 2449a4365c K-order DLL, DynareNameList class: removed memory leaks 2010-03-09 18:30:23 +01:00
Sébastien Villemot d95b0cf6d7 K-order DLL, KordpDynare class: removed memory leaks 2010-03-09 18:30:23 +01:00
Sébastien Villemot bb3675e75c K-order DLL, DynamicDLL class: removed memory leaks 2010-03-09 18:30:23 +01:00
Sébastien Villemot 1b3bc4a825 K-order DLL: removed useless stuff 2010-03-09 18:30:23 +01:00
Sébastien Villemot cf8f793c55 k_order_perturbation: give a value to model residuals, otherwise valgrind logs are cluttered with unitialized value errors 2010-02-09 14:32:40 +01:00
Sébastien Villemot 34ab1a5686 k_order_perturbation: fixed illegal cast 2010-02-09 14:24:16 +01:00
sebastien 65fc856710 k_order_perturbation: renamed source files with *.cc and *.hh extensions, for compliance with Dynare coding standards + adapted the build system accordingly
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3260 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-12-17 11:00:50 +00:00
sebastien f3549b4c64 Beautified MEX source code
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3251 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-12-16 17:18:38 +00:00
sebastien fb8406ef0a USE_DLL option now works with MSVC + Added new options for Windows to 'dynare' command, to select the compiler: 'cygwin' and 'msvc' + Added the mexopts.bat for Cygwin in the SVN
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3223 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-12-11 14:46:21 +00:00
sebastien 4bcbd06980 k_order_perturbation: cosmetic change
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3207 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-12-08 10:01:41 +00:00
george effee9ffab removed more leaks
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3205 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-12-07 17:03:59 +00:00
george 5c75c9aaee removed more leaks in calcDerivatives
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3204 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-12-07 12:48:18 +00:00
george 12d7abab24 removed leaks in calcDerivatives
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3203 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-12-07 12:35:55 +00:00
michel 8198b1a1eb 4.1 k_order_perturbation: correcting bug in releasing _dynamic.DLL (Windows version)
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3200 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-12-06 21:21:06 +00:00
michel 5031122649 4.1 k_order_perturbation: simplifying dynamic_dll code
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3199 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-12-06 14:10:43 +00:00
michel f22fa8979c 4.1 k_order_perturbation: fixing typos
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3198 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-12-06 13:21:52 +00:00
george c6ed380a08 Additional #if !defined(__CYGWIN32__) && !defined(_WIN32)
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3197 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-12-06 12:21:38 +00:00
michel e690320b1d 4.1: more defined __CYGWIN32__
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3196 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-12-06 11:56:11 +00:00
george 684d8ac822 Cleared up DynareMxArrayToString in k_order_perturbation.cpp and changed #ifdef to #if defined() in dynamic_dll.cpp
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3195 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-12-06 00:03:22 +00:00
sebastien 0dd2bdf39a k_order_perturbation: fix for compilation with MS Visual C++
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3185 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-12-01 15:18:48 +00:00
sebastien ad71ee53c2 k_order_perturbation: cosmetic changes for the sake of clarity
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3180 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-11-30 20:31:11 +00:00
sebastien 03600d9131 k_order_perturbation DLL:
* no longer use mexPrintf()/mexErrMsgTxt() outside mexFunction(): use exceptions to report errors, in order to be able to integrate the code in a standalone executable
* fixed a few memory leaks (other still remain)
* fixed a buffer overflow issue in the filename of the dynamic MEX (using C++ string object)
* various cosmetic cleanups


git-svn-id: https://www.dynare.org/svn/dynare/trunk@3177 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-11-30 16:31:27 +00:00
michel 5f05a14b17 v4.1: fixing k_order_perturbation DLL for order == 3
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3170 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-11-29 20:50:39 +00:00
sebastien 295f998503 Dynare++ and k_order_perturbation DLL:
* support Microsoft Visual C++ 2008 compiler (necessary for 64-bit 
platforms)
* use standard C++ headers for C Standard Library support


git-svn-id: https://www.dynare.org/svn/dynare/trunk@3121 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-11-03 14:16:18 +00:00
sebastien 11230eec3f Build system: added k_order_perturbation to the build_matlab script
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3106 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-10-30 17:29:50 +00:00
sebastien 9ab04f3323 Renamed kordepert to k_order_perturbation
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3070 ac1d8469-bf42-47a9-8791-bf33cf982152
2009-10-23 09:07:47 +00:00