aboutsummaryrefslogtreecommitdiff
path: root/pkg/xtools/inlfit/inguaxesr.x
blob: 53905563cc05c50f91d207ecf4842c8f388c8d2f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
include	<math/nlfit.h>
include	<pkg/inlfit.h>


# ING_UAXES -- Set user axis

procedure ing_uaxesr (keynum, in, nl, x, y, z, npts, nvars)

int	keynum				# Key number for axes
pointer	in				# INLFIT pointer
pointer	nl				# NLFIT pointer
real	x[ARB]				# Independent variable
real	y[npts]				# Dependent variable
real	z[npts]				# Output values
int	npts				# Number of points
int	nvars				# Number of variables

int	npars				# number of parameters
int	uaxes				# user defined procedure
pointer	params				# parameter values
pointer	sp

int	nlstati()
int	in_geti()

begin
	# Check if equation is defined
	uaxes = in_geti (in, INLUAXES)
	if (!IS_INDEFI (uaxes)) {

	    # Get number of parameters, allocate space
	    # for parameter values, and get parameter values
	    npars = nlstati (nl, NLNPARAMS)
	    call smark (sp)
	    call salloc (params, npars, TY_REAL)
	    call nlpgetr (nl, Memr[params], npars)

	    # Call user plot functions
	    call zcall8 (uaxes, keynum, Memr[params], npars,
			 x, y, z, npts, nvars)

	    # Free memory
	    call sfree (sp)

	} else
	    call eprintf ("Warning: User plot function not defined\n")
end