21 ocoff(0)=
sqrt(
double(n));
22 for (
int is=1; is<=deg; is++)
24 for (
int j=1; j<=n; j++)
26 ocoff(is,j)=
pow(
double(j),is);
29 for (
int is=0; is<=deg; is++)
31 for (
int ik=0; ik<=is-1; ik++)
33 sum=ocoff(is)*ocoff(ik);
34 ocoff(is)-=sum*ocoff(ik);
37 ocoff(is)=ocoff(is)/
sqrt(sum);
50 ocoff(0)=
sqrt(
double(n));
51 for (
int is=1; is<=deg; is++)
53 for (
int j=1; j<=n; j++)
55 ocoff(is,j)=
pow(
double(j),is);
58 for (
int is=0; is<=deg; is++)
60 for (
int ik=0; ik<=is-1; ik++)
62 sum=ocoff(is)*ocoff(ik);
63 ocoff(is)-=sum*ocoff(ik);
66 ocoff(is)=ocoff(is)/
sqrt(sum);
79 ocoff(0)=
sqrt(
double(n));
82 cerr <<
"nconst too large in orthpoly_constant_begin"
87 cerr <<
"deg too large in orthpoly_constant_begin"
90 for (
int is=1; is<=deg; is++)
94 for (
int j=1; j<=nconst; j++)
98 for (
int j=nconst+1; j<=n; j++)
100 ocoff(is,j)=
pow(
double(j-nconst+1),is);
105 for (
int j=1; j<=n; j++)
107 ocoff(is,j)=
pow(
double(j),is);
111 for (
int is=0; is<=deg; is++)
113 for (
int ik=0; ik<=is-1; ik++)
115 sum=ocoff(is)*ocoff(ik);
116 ocoff(is)-=sum*ocoff(ik);
118 sum=
norm2(ocoff(is));
119 ocoff(is)=ocoff(is)/
sqrt(sum);
126 for (
int i=0;i<=deg;i++)
128 for (
int j=0;j<=deg;j++)
130 tmp(i,j)=ocoff(i)*ocoff(j);
144 int end_degree,
int nconst_end)
148 ocoff(0)=
sqrt(
double(n));
149 if (nconst_begin>n-1)
151 cerr <<
"nconst_begin too large in orthpoly_constant_begin"
154 if (deg>n-nconst_begin)
156 cerr <<
"deg too large in orthpoly_constant_begin"
159 for (
int is=1; is<=deg; is++)
163 for (
int j=1; j<=nconst_begin; j++)
167 for (
int j=nconst_begin+1; j<=n; j++)
170 if (j>n-nconst_end+1 && is>=end_degree)
174 ocoff(is,j)=
pow(
double(jj-nconst_begin+1)/n,is);
179 for (
int j=1; j<=n; j++)
182 if (j>n-nconst_end+1 && is>=end_degree)
186 ocoff(is,j)=
pow(
double(jj)/n,is);
190 for (
int is=0; is<=deg; is++)
192 for (
int ik=0; ik<=is-1; ik++)
194 sum=ocoff(is)*ocoff(ik);
195 ocoff(is)-=sum*ocoff(ik);
197 sum=
norm2(ocoff(is));
198 ocoff(is)=ocoff(is)/
sqrt(sum);
205 for (
int i=0;i<=deg;i++)
207 for (
int j=0;j<=deg;j++)
209 tmp(i,j)=ocoff(i)*ocoff(j);
228 for (
int i=1; i<=n; i++)
230 for (
int j=i; j<=n; j++)
237 for (
int i=1; i<=n; i++)
239 for (
int j=1; j<=i-1; j++)
241 ocoff(i)-=(ocoff(i)*ocoff(j))*ocoff(j);
243 ocoff(i)/=
norm(ocoff(i));
247 cout << setw(10) << setprecision(4) << ocoff1 <<
endl <<
endl;
253 for (
int i=1; i<=n; i++)
258 for (
int i=2; i<=n; i++)
263 cout << a << endl <<
endl;
264 cout << b << endl <<
endl;
266 cout << ocoff1*tmp1(1) <<
endl;
267 cout << ocoff1*tmp1(2) <<
endl;
268 cout << ocoff1 *tmp1(3) <<
endl;
269 cout << (ocoff1*tmp1(1)) * (ocoff1 *tmp1(3)) << endl;
270 cout << (ocoff1*tmp1(2)) * (ocoff1 *tmp1(3)) << endl;
dmatrix trans(const dmatrix &m1)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Vector of double precision numbers.
double sum(const d3_array &darray)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
dmatrix sub(int, int)
Description not yet available.
double norm(const d3_array &a)
Return computed norm value of a.
prnstream & endl(prnstream &)
d3_array sqrt(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
dmatrix seldif_basis(int n)
Description not yet available.
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Description not yet available.
double norm2(const d3_array &a)
Return sum of squared elements in a.
dmatrix orthpoly(int n, int deg)
Description not yet available.
dmatrix orthpoly_constant_begin_end(int n, int deg, int nconst_begin, int enddeg, int nconst_end)
Description not yet available.
dmatrix orthpoly_constant_begin(int n, int deg, int nconst)
Description not yet available.
void initialize(void)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
df1_one_variable inv(const df1_one_variable &x)
d3_array pow(const d3_array &m, int e)
Description not yet available.