 |

All
of the examples in this documentation conform to ANSI C. If you
are not using ANSI C, you will need to modify your examples in functions
that are declared or in those arrays that are initialized as type
float.
Non-ANSI C does
not allow for automatic aggregate initialization, and thus all auto
arrays that are initialized as type float in ANSI C must
be initialized as type static float in non-ANSI C. The following
pro gram contains arrays
that are initialized as type float and also a user-defined
function:
- #include <imsls.h>
- float
fcn(int, float[], int, float[]);
- 4
- main()
- {
- int
n_observations = 3,
-
n_parameters = 1,
-
n_independent = 1;
- float
*theta_hat;
- float
x[3] = {1.0, 2.0, 3.0};
- float
y[3] = {2.0, 4.0, 3.0};
-
/* Evaluate the integral */
- theta_hat = imsls_f_nonlinear_regression(fcn,
n_parameters,
-
n_observations, n_independent, x, y, 0);
-
/* Print the result and the exact answer */
- imsls_f_write_matrix("estimated coefficient",
1, 1, theta_hat, 0);
- }
- float fcn(int n_independent, float x[], int n_parameters,
-
float theta[])
- {
- return exp(theta[0]*x[0]);
- }
If using non-ANSI C, you will need to modify lines 3, 11, 12,
and on as follows:
3 float
fcn(); /* Function is not prototyped */
.
.
.
11 static float
x[3] = {1.0, 2.0, 3.0};
12 static float
y[3] = {2.0, 4.0, 3.0};
.
.
.
19 float fcn(n_independent, x, n_parameters,
20
theta) /*Declaration of variable names*/
20a int n_independent;
20b float x[];
20c int n_parameters;
20d float theta[]; /*Type
definitions of variables*/
Both the imsl.h and the imsls.h file
MATH: imsl.h
The included file <imsl.h> is used in all of the examples in
this manual. This file contains prototypes for all IMSL-defined
functions: the spline structures, Imsl_f_ppoly, Imsl_d_ppoly, Imsl_f_spline,
and Imsl_d_spline; enumerated data types, Imsl_quad, Imsl_write_options,
Imsl_page_options, Imsl_ode, and Imsl_error; and the IMSL-defined
data types f_complex (which is the type float complex)
and d_complex (which is the type double complex).
STAT: imsls.h
The included file <imsls.h> is used in all the examples in this
manual. This file contains prototypes for all IMSL-defined functions:
the structures, Imsls_f_regression, Imsls_d_regression, Imsls_f_poly_regression,
Imsls_d_poly_regression, Imsls_f_arma and Imsls_d_arma; and the
enu-merated data types, Imsls_arma_method, Imsls_permute, Imsls_dummy_method,
Imsls_write_options, Imsls_page_options and Imsls_error.
|