forked from wozy13/DIAMOND
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bkm_comp.m
89 lines (60 loc) · 1.68 KB
/
bkm_comp.m
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
function bkm = bkm_comp(mmax,u,v)
%
% Name: bkm_comp
%
% Usage: bkm = bkm_comp(m,u,v)
%
% Description: Computes coefficients bkm for conversion
% from Forsythe polynomials back to normal
% polynomials
%
% Version SWD960409
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This matlab source code was originally %
% developed as part of "DIAMOND" at %
% Los Alamos National Laboratory. It may %
% be copied, modified, and distributed in %
% any form, provided: %
% a) This notice accompanies the files and %
% appears near the top of all source %
% code files. %
% b) No payment or commercial services are %
% received in exchange for the code. %
% %
% Original copyright is reserved by the %
% Regents of the University of California, %
% in addition to Scott W. Doebling, Phillip %
% J. Cornwell, Erik G. Straser, and Charles %
% R. Farrar. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for k = 0:mmax,
for m = k:mmax
% First, call bkmcheck to see if recursion formula applies
bv = bkmcheck(k,m);
if bv == -1,
bv1 = bkmcheck(k-1,m-1);
bv2 = bkmcheck(k,m-1);
bv3 = bkmcheck(k,m-2);
if bv1 == -1,
bkm1 = bkm(k,m);
else
bkm1 = bv1;
end
if bv2 == -1,
bkm2 = bkm(k+1,m);
else
bkm2 = bv2;
end
if bv3 == -1,
bkm3 = bkm(k+1,m-1);
else
bkm3 = bv3;
end
bkm(k+1,m+1) = bkm1 - u(m+1)*bkm2 - v(m)*bkm3;
else
bkm(k+1,m+1) = bv;
end
end
end
return