basis.tensor: Tensor-product Splines over a Triangular Prism Partition

Description Usage Arguments Value Examples

View source: R/basis.tensor.R

Description

This function generates the basis for tensor-product splines over a triangular prism partition.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
basis.tensor(
  ss,
  tt,
  V,
  Tri,
  d = 2,
  r = 1,
  time.knots,
  time.bound,
  rho = 3,
  line.up = FALSE
)

Arguments

ss

If line.up=TRUE, ss is the spatial cooridinates of dimension nS by two. If line.up=TRUE, ss is the spatial cooridinates of dimension n by two. Each row is the spatial coordinates of a point.

tt

If line.up=TRUE, the temporal cooridinates of length nT. If line.up=FALSE, the temporal cooridinates of length nT. Each value is the temporal coordinates of a point.

V

The N by two matrix of vertices of a triangulation, where N is the number of vertices. Each row is the coordinates for a vertex.

Tri

The triangulation matrix of dimention nTr by three, where nTr is the number of triangles in the triangulation. Each row is the indices of vertices in V.

d

The degree of piecewise polynomials – default is 2, and usually d is greater than one. -1 represents piecewise constant.

r

The smoothness parameter – default is 1, and 0 r < d.

time.knots

The vector of interior time.knots for univariate spline.

time.bound

The vector of two. The boundary of univariate spline.

rho

The order of univaraite spline.

line.up

The indicator of whether the observed points are temporally lined up or not – default is FALSE.

Value

A list of vectors and matrices, including:

Psi

The spline basis function of dimension n by (l)(nTr){(d+1)(d+2)/2}, where l is the number of univariate basis, n is the number of observationed points, nTr is the number of triangles in the given triangulation, and d is the degree of the spline. If some points do not fall in the triangulation, the generation of the spline basis will not take those points into consideration.

Psi.Q2

The spline basis function after QR decomposition

H

The smoothness matrix for bivariate spline.

Q2

The Q2 matrix after QR decomposition of the smoothness matrix H.

H.all

The smoothness matrix for tensor-product spline.

Q2.all

The Q2 matrix after QR decomposition of the smoothness matrix H.all for tensor-product spline.

dimB

The number of bivariate spline basis functions.

dimU

The number of univariate spline basis functions.

P1, P2

The penalty matrices from energy functions.

K1, K2

The penalty matrices from energy functions QR decomposition.

Examples

 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
# load need libraries.
# Packages BPST and Triangulation could be downloaded from github.
rm(list = ls())
library(devtools)
install_github("funstatpackages/BPST")
install_github("funstatpackages/Triangulation")
library(Triangulation)
library(TPST)
data(Tr1)
data(V1)

ngrid.x=40
ngrid.y=20
ngrid.t=10

xx=seq(-0.89,3.39,length.out=ngrid.x)
yy=seq(-0.89,0.89,length.out=ngrid.y)
ss=expand.grid(xx,yy)
tt=(0:(ngrid.t-1))/(ngrid.t-1)

Data=data.frame(x=rep(ss[,1],ngrid.t),y=rep(ss[,2],ngrid.t),
              t=rep(tt,each=dim(ss)[1]))
knots=c(0.2,0.4,0.6,0.8)
Boundary.knots=c(0,1)

d <- 2
r <- 1
rho <- 3
Basis1 <- basis.tensor(ss = ss, tt = tt, V = V1, Tri = Tr1,
                     d = d, r = r, time.knots = knots, rho = rho,
                     time.bound = Boundary.knots, line.up = TRUE)

Basis2 <- basis.tensor(ss = Data[,1:2], tt = Data[,3],
                      V = V1, Tri = Tr1, d = d, r = r,
                    time.knots = knots, rho = rho,
                    time.bound = Boundary.knots, line.up = FALSE)

which(Basis1$Psi.Q2 != Basis2$Psi.Q2)

funstatpackages/TPST documentation built on July 23, 2020, 12:14 p.m.