Introduction

Getting Started

To use any of the C Stat Library functions, you must first write a program in C to call the function. Each function conforms to established conventions in programming and documentation. First pri­ority in development is given to efficient algorithms, clear documentation, and accurate results. The uniform design of the functions makes it easy to use more than one function in a given application. Also, you will find that the design consistency enables you to apply your experience with one C Stat Library function to all other C functions that you use.

ANSI C vs. Non-ANSI C

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 program contains arrays that are initialized as type float and also a user-defined function:

1 #include <imsls.h>
2
3 float           fcn(int, float[], int, float[]);
4
5 main()
6 {
7     int         n_observations = 3,
8                 n_parameters = 1,
9                 n_independent = 1;
10    float       *theta_hat;
11    float       x[3] = {1.0, 2.0, 3.0};
12    float       y[3] = {2.0, 4.0, 3.0};
13                     /* Evaluate the integral */
14    theta_hat = imsls_f_nonlinear_regression(fcn, n_parameters,
15                n_observations, n_independent, x, y, 0);
16                     /* Print the result and the exact answer */
17    imsls_f_write_matrix("estimated coefficient", 1, 1, theta_hat, 0);
18 }
19 float fcn(int n_independent, float x[], int n_parameters,
20           float theta[])
21 {
22    return exp(theta[0]*x[0]);
23 }

If using non-ANSI C, you will need to modify lines 3, 11, 12, 19, and 20 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*/

The imsls.h File

The include file <imsls.h> is used in all the examples in this manual. This file contains proto­types 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.


Visual Numerics, Inc.
Visual Numerics - Developers of IMSL and PV-WAVE
http://www.vni.com/
PHONE: 713.784.3131
FAX:713.781.9260