Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93474730
polint.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 29, 01:36
Size
698 B
Mime Type
text/x-c
Expires
Sun, Dec 1, 01:36 (2 d)
Engine
blob
Format
Raw Data
Handle
22648531
Attached To
R1448 Lenstool-HPC
polint.c
View Options
#include <math.h>
#define NRANSI
#include "nrutil.h"
void
polint
(
double
xa
[],
double
ya
[],
int
n
,
double
x
,
double
*
y
,
double
*
dy
)
{
int
i
,
m
,
ns
=
1
;
double
den
,
dif
,
dift
,
ho
,
hp
,
w
;
double
*
c
,
*
d
;
dif
=
fabs
(
x
-
xa
[
1
]);
c
=
vector
(
1
,
n
);
d
=
vector
(
1
,
n
);
for
(
i
=
1
;
i
<=
n
;
i
++
)
{
if
(
(
dift
=
fabs
(
x
-
xa
[
i
]))
<
dif
)
{
ns
=
i
;
dif
=
dift
;
}
c
[
i
]
=
ya
[
i
];
d
[
i
]
=
ya
[
i
];
}
*
y
=
ya
[
ns
--
];
for
(
m
=
1
;
m
<
n
;
m
++
)
{
for
(
i
=
1
;
i
<=
n
-
m
;
i
++
)
{
ho
=
xa
[
i
]
-
x
;
hp
=
xa
[
i
+
m
]
-
x
;
w
=
c
[
i
+
1
]
-
d
[
i
];
if
(
(
den
=
ho
-
hp
)
==
0.0
)
nrerror
(
"Error in routine polint"
);
den
=
w
/
den
;
d
[
i
]
=
hp
*
den
;
c
[
i
]
=
ho
*
den
;
}
*
y
+=
(
*
dy
=
(
2
*
ns
<
(
n
-
m
)
?
c
[
ns
+
1
]
:
d
[
ns
--
]));
}
free_vector
(
d
,
1
,
n
);
free_vector
(
c
,
1
,
n
);
}
#undef NRANSI
Event Timeline
Log In to Comment