Pass in only the arguments you need
Many GAUSS procedures used to require passing in all arguments including control structures. Additionally many GAUSS procedures that call a user-defined procedure, such as optimization or integration functions used to require extra data to be passed in as a DS structure.
Question: Will this require me change my code?
No! It is completely backwards compatible.
Question: Does this remove any of the options or flexibility?
No! The control structures and all of their options remain available, you just do not need to use them for cases in which you would use the default settings.
We will use the new GAUSS function, integrate1d with a toy example to illustrate the differences.
//Define procedure to be integrated proc (1) = myProc(x, struct DS d); local y; y = d.dataMatrix; retp(exp( -(x .* x) / (2 .* y) )); endp; //Define limits of integration x_min = -1000; x_max = 1000; //Define extra argument for procedure 'myProc' struct DS d; d = dsCreate(); d.datamatrix = 3; //Define 'ctl' to be a control structure struct integrateControl ctl; //Fill in with default values ctl = integrateControlCreate(); //Calculate integral integral = integrate1d(&myProc, x_min, x_max, d, ctl);
New simpler style
//Define procedure to be integrated proc (1) = myProc(x, z); retp(exp( -(x .* x) / (2 .* z) )); endp; //Define limits of integration x_min = -1000; x_max = 1000; //Define extra arguments for procedure 'myProc' a = 3; //No need for control structure if using default values integral = integrate1d(&myProc, x_min, x_max, a);
This functionality has been added to GAUSS functions such as: csvReadM, csvReadSA,dstatmt, eqsolvemt, glm,
gradmt, gradp, hessmt, hessp, intquad1, intquad2,
intquad3, integrate1d, qnewtonmt, sqpsolvemt, xlsReadM,
xlsWrite and more.