chebR: chebR

Description Usage Arguments Details Value Author(s) References Examples

Description

Discrete Linear Chebyshev Approximation

Usage

1
chebR(a, b, tol = 1e-15, relerr = 0)

Arguments

a

matrix with left-hand sides

b

vector with right-hand sides

tol

a small positive tolerance

relerr

relative error

Details

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.

Value

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

Author(s)

Jan de Leeuw

References

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

Examples

 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))
  }

cheb documentation built on May 29, 2017, 8:43 p.m.