Description Usage Arguments Details Value Author(s) References Examples
Discrete Linear Chebyshev Approximation
1 | chebR(a, b, tol = 1e-15, relerr = 0)
|
a |
matrix with left-hand sides |
b |
vector with right-hand sides |
tol |
a small positive tolerance |
relerr |
relative error |
R Interface to the CHEB code by Barrodale and Philips for Discrete Linear Chebyshev Approximation. Computes the Chebyshev solution to an overdetermined system of linear equations.
relerr is a real variable which on entry must have the value 0.0 if a Chebyshev solution is required. If relerr is positive, the subroutine calculates an approximate solution with relerr as an upper bound on the relative error of its largest residual.
A list with the following components:
coefs |
regression coefficients |
resids |
signed residuals |
rank |
rank of coefficient matrix |
iter |
number of simplex iterations performed |
ocode |
error code: ocode=0 for a probably non-unique solution, ocode=1 for a unique solution, ocode=2 for premature termination due to rounding errors |
Jan de Leeuw
I. Barrodale and C. Philips. Algorithm 495 <e2><80><93> Solutions of an Overdetermined System of Linear Equations in the Chebyshev Norm. ACM Transactions on Mathematical Software, 1:264<e2><80><93>270, 1975.d
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | a<-matrix(rnorm(20),10,2)
b<-rnorm(10)
chebR(a,b)
## The function is currently defined as
function(a,b,tol=1e-15,relerr=0.0) {
m<-nrow(a); n<-ncol(a); ndim<-n+3; mdim<-m+1
if (n > m) stop("number of equations exceeds number of unknowns")
aa<-matrix(0,ndim,mdim); bb<-rep(0,mdim); xx<-rep(0,ndim)
aa[1:n,1:m]<-t(a); bb[1:m]<-b
rlist<-.Fortran("cheb",as.integer(m),as.integer(n),as.integer(m+1),as.integer(n+3),
as.single(aa),bb=as.single(bb),as.single(tol),as.single(relerr),xx=as.single(xx),
rank=as.integer(0),resmax=as.single(0.0),iter=as.integer(0),ocode=as.integer(0))
return(list(coefs=rlist$xx[1:n],resids=rlist$bb[1:m],rank=rlist$rank,iter=rlist$iter,ocode=rlist$ocode))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.