/* Functions that implement various approximation bases. */ /* Last edited on 2007-12-26 15:19:29 by stolfi */ #ifndef basis1d_H #define basis1d_H /* Copyright © 2007 by the State University of Campinas (UNICAMP). */ /* See the copyright, authorship, and warranty notice at end of file. */ /* Last edited on 2007-04-16 17:30:29 by stolfi */ #include #include #include #include /* Created apr/2007 by Jorge Stolfi, UNICAMP */ typedef enum { b1d_kind_POLY = 0, /* Polynomial. */ b1d_kind_TRIG = 1, /* Trigonometric. */ } b1d_kind_t; #define b1d_kind_NUM 2 /* Number of distinct values in {b1d_kind_t}. */ char *b1d_kind_tag(b1d_kind_t bkind); /* Returns a fixed character string that identifies the basis kind {bkind}: "POLY", "TRIG", etc. */ typedef int8_t b1d_degree_t; /* Degree of a polynomial or spline, max order of a trig series, etc.. */ typedef int8_t b1d_cont_t; /* Continuity order of a spline. Value {-1} means discontinuous.. */ typedef struct b1d_family_t { b1d_kind_t bkind; /* Basis kind. */ b1d_degree_t g; /* Max degree or number of terms. */ b1d_cont_t c; /* Continuity order. */ } b1d_family_t; /* Describes a basis of mother functions with continuity {c}, whose domain is the whole real line. The parameter {g} is the maximum degree or order of the basis elements, depending on the {bkind}. */ void b1d_family_print(FILE *wr, b1d_family_t *fam); /* Prints out the description of mother basis {fam} to {wr}. */ typedef int32_t b1d_mother_num_t; /* Count of elements in a mother basis. */ typedef int32_t b1d_mother_index_t; /* Identifies a mother element in a basis. */ b1d_mother_num_t b1d_family_num(b1d_family_t *fam); /* Number {num} of elements in the mother basis {fam}. The elements are indexed {0..num-1}. */ typedef struct b1d_basis_t { b1d_family_t fam; /* Family of mother functions. */ int gsz; /* Number of intervals. */ interval_t dom; /* Argument domain. */ bool_t wrap; /* TRUE iff the domain is periodic. */ } b1d_basis_t; /* Describes a basis of functions defined over the domain {dom}, whose elements are obtained by expanding and translating functions of mother basis {fam} over a regular grid. The domain {dom} is implicitly divided into {gsz} equal intervals (/cells/) of length {xstep}, starting at argument {xmin}. The generic basis element is {b(x) = F((x - xmin)/xstep - k)}, where {k} is an integer /displacement/ and {F} (the /mother element/) is an element of the basis {fam}. If {wrap} is true, the domain {dom} is assumed to be circular, and the function {F} is wrapped-over and added to itself. */ char *b1d_basis_tag(b1d_basis_t *bas); /* Creates a new char string that identifies the basis {bas}. */ typedef int64_t b1d_grid_size_t; /* Size of a toroidal grid along an axis, in multiples of the corresponding grid step. */ b1d_grid_size_t b1d_element_supp_count ( b1d_family_t *fam, b1d_mother_index_t pix, b1d_grid_size_t gsz, bool_t wrap ); /* Number of cells where a basis element with mother element {fam,pix} may be nonzero, assuming a grid with {gsz} cells with periodicity flag {wrap}. If {wrap} is FALSE, the result is simply the support count {msn} of the mother element. If {wrap} is TRUE, the result is the smallest of {gsz} and {msn}. */ typedef uint64_t b1d_cell_index_t; /* Identifies a cell in some (multi)grid. */ /* MULTISCALE BASES */ typedef int32_t b1d_rank_t; /* Identifies a layer in a multigrid, or the depth of a node in a binary tree, etc. It may also be a relative rank (i.e. difference of two ranks). */ #endif