| 1 | /* -*- mode: C++ -*- */ |
|---|
| 2 | ////////////////////////////////////////////////////////////////////////////// |
|---|
| 3 | // FILE : BaseC2.Concat.tol |
|---|
| 4 | // PURPOSE: Defines class @BaseC2.Concat |
|---|
| 5 | ////////////////////////////////////////////////////////////////////////////// |
|---|
| 6 | |
|---|
| 7 | ////////////////////////////////////////////////////////////////////////////// |
|---|
| 8 | Text _.autodoc.member.BaseC2.Concat = |
|---|
| 9 | "Concats a set of linearly independent bases over the same domain " |
|---|
| 10 | "vectorial space."; |
|---|
| 11 | Class @BaseC2.Concat : @BaseC2 |
|---|
| 12 | ////////////////////////////////////////////////////////////////////////////// |
|---|
| 13 | { |
|---|
| 14 | Set _.base; //Set of @BaseC2 |
|---|
| 15 | |
|---|
| 16 | //Auxiliar member to map concatenated bases |
|---|
| 17 | Set _.map; |
|---|
| 18 | |
|---|
| 19 | //////////////////////////////////////////////////////////////////////////// |
|---|
| 20 | Static Text _.autodoc.member.New = "Creates an instance of " |
|---|
| 21 | "@BaseC2.Concat on R^n with specified maximum degree."; |
|---|
| 22 | Static @BaseC2.Concat New(Set base) |
|---|
| 23 | //////////////////////////////////////////////////////////////////////////// |
|---|
| 24 | { |
|---|
| 25 | Real n = (base[1])::_.n; |
|---|
| 26 | Set map = BinGroup("<<", For(1,Card(base),Set(Real h) |
|---|
| 27 | { |
|---|
| 28 | If((base[h])::_.n!=n,WriteLn("[@BaseC2.Concat::New] " |
|---|
| 29 | "Cannot concat bases with different domain vectorial space dimension " |
|---|
| 30 | <<n+"!="<<(base[h])::_.n),"E"); |
|---|
| 31 | For(1,(base[h])::_.K,Set(Real k) |
|---|
| 32 | { |
|---|
| 33 | [[h,k]] |
|---|
| 34 | }) |
|---|
| 35 | })); |
|---|
| 36 | @BaseC2.Concat aux = [[ |
|---|
| 37 | Real _.n = base::_.n; |
|---|
| 38 | Real _.K = Card(map); |
|---|
| 39 | Set _.base = base; |
|---|
| 40 | Set _.map = map |
|---|
| 41 | ]]}; |
|---|
| 42 | |
|---|
| 43 | //For efficience reasonsthe base has specific method for evaluation over |
|---|
| 44 | //massive data stored in a matrix |
|---|
| 45 | |
|---|
| 46 | //////////////////////////////////////////////////////////////////////////// |
|---|
| 47 | Static Text _.autodoc.member._build.function.v = |
|---|
| 48 | "Evaluates the k-th basic function for an " |
|---|
| 49 | "array of points given as the rows of a matrix "; |
|---|
| 50 | VMatrix _build.function.v(Real k, VMatrix X) |
|---|
| 51 | //////////////////////////////////////////////////////////////////////////// |
|---|
| 52 | { |
|---|
| 53 | Set aux = _.map[k]; |
|---|
| 54 | (_.base[aux::h])::_.base::function.v(aux::k, X) |
|---|
| 55 | }; |
|---|
| 56 | //////////////////////////////////////////////////////////////////////////// |
|---|
| 57 | Static Text _.autodoc.member._build.partial.derivative.1.v = |
|---|
| 58 | "Evaluates the first partial derivative of k-th basic function for an " |
|---|
| 59 | "array of points given as the rows of a matrix"; |
|---|
| 60 | VMatrix _build.partial.derivative.1.v(Real k, VMatrix X, Real i) |
|---|
| 61 | //////////////////////////////////////////////////////////////////////////// |
|---|
| 62 | { |
|---|
| 63 | Set aux = _.map[k]; |
|---|
| 64 | (_.base[aux::h])::_.base::partial.derivative.1.v(aux::k, X, i) |
|---|
| 65 | }; |
|---|
| 66 | //////////////////////////////////////////////////////////////////////////// |
|---|
| 67 | Static Text _.autodoc.member._build.partial.derivative.2.v = |
|---|
| 68 | "Evaluates the second partial derivative of k-th basic function for an " |
|---|
| 69 | "array of points given as the rows of a matrix"; |
|---|
| 70 | VMatrix _build.partial.derivative.2.v(Real k, VMatrix X, Real i, Real j) |
|---|
| 71 | //////////////////////////////////////////////////////////////////////////// |
|---|
| 72 | { |
|---|
| 73 | Set aux = _.map[k]; |
|---|
| 74 | (_.base[aux::h])::_.base::partial.derivative.2.v(aux::k, X, i, j) |
|---|
| 75 | } |
|---|
| 76 | }; |
|---|