unigrids {capn}R Documentation

Generating unifrom grids

Description

This function generates a grid of multi-dimensional uniform grids.

Usage

unigrids(nnodes, lb, ub, rtype = NULL)

Arguments

nnodes

An array of numbers of nodes

lb

An array of lower bounds

ub

An array of upper bounds

rtype

A type of results; default is NULL that returns a list class; if rtype = list, returns a list class; if rtype = grid, returns a matrix class.

Details

For the ii-th dimension of i=1,2,,di = 1, 2, \cdots, d, suppose a polynomial approximant sis_{i} over a bounded interval [ai,bi][a_{i},b_{i}] is defined by evenly gridded nodes. Then, a dd-dimensional uniform grids can be defined as:

S={(s1,s2,,sd)ais1bi,i=1,2,,d}\mathbf{S} = \left\{ (s_{1},s_{2},\cdots,s_{d}) \vert a_{i} \leq s_{1} \leq b_{i}, i = 1, 2, \cdots, d \right\} .

This is all combinations of sis_{i}. Two types of results are provided. 'rtype = list' provides a list of dd dimensions wherease 'rtype = grids' creates a (i=1dni)×d \left( \displaystyle \prod_{i=1}^{d} n_{i} \right) \times d matrix.

Value

A list with dd elements of Chebyshev nodes or a (i=1dni)×d \left( \displaystyle \prod_{i=1}^{d} n_{i} \right) \times d matrix of uniform grids

Examples

## Uniform grids with two-dimension
unigrids(c(5,3), c(1,1), c(2,3))
## Returns the same results
unigrids(c(5,3), c(1,1), c(2,3), rtype='list')
## Returns a matrix grids with the same domain
unigrids(c(5,3), c(1,1), c(2,3), rtype='grid')
## Uniform grid with one-dimension
unigrids(5,1,2)
## Uniform grids with three stock
unigrids(c(3,4,5),c(1,1,1),c(2,3,4),rtype='grid')

[Package capn version 1.0.0 Index]