0027961: Visualization - remove unused and no more working OpenGl_AVIWriter
[occt.git] / src / AdvApp2Var / AdvApp2Var_MathBase.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
7fd59977 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 7// by the Free Software Foundation, with special exception defined in the file
8// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9// distribution for complete text of the license and disclaimer of any warranty.
7fd59977 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
b311480e 13
14// AdvApp2Var_MathBase.cxx
7fd59977 15#include <math.h>
16#include <AdvApp2Var_SysBase.hxx>
17#include <AdvApp2Var_Data_f2c.hxx>
18#include <AdvApp2Var_MathBase.hxx>
19#include <AdvApp2Var_Data.hxx>
20
21// statics
22static
23int mmchole_(integer *mxcoef,
24 integer *dimens,
25 doublereal *amatri,
26 integer *aposit,
27 integer *posuiv,
28 doublereal *chomat,
29 integer *iercod);
30
31
32
33
34static
35int mmrslss_(integer *mxcoef,
36 integer *dimens,
37 doublereal *smatri,
38 integer *sposit,
39 integer *posuiv,
40 doublereal *mscnmbr,
41 doublereal *soluti,
42 integer *iercod);
43
44static
45int mfac_(doublereal *f,
46 integer *n);
47
48static
49int mmaper0_(integer *ncofmx,
50 integer *ndimen,
51 integer *ncoeff,
52 doublereal *crvlgd,
53 integer *ncfnew,
54 doublereal *ycvmax,
55 doublereal *errmax);
56static
57int mmaper2_(integer *ncofmx,
58 integer *ndimen,
59 integer *ncoeff,
60 doublereal *crvjac,
61 integer *ncfnew,
62 doublereal *ycvmax,
63 doublereal *errmax);
64
65static
66int mmaper4_(integer *ncofmx,
67 integer *ndimen,
68 integer *ncoeff,
69 doublereal *crvjac,
70 integer *ncfnew,
71 doublereal *ycvmax,
72 doublereal *errmax);
73
74static
75int mmaper6_(integer *ncofmx,
76 integer *ndimen,
77 integer *ncoeff,
78 doublereal *crvjac,
79 integer *ncfnew,
80 doublereal *ycvmax,
81 doublereal *errmax);
82
83static
84int mmarc41_(integer *ndimax,
85 integer *ndimen,
86 integer *ncoeff,
87 doublereal *crvold,
88 doublereal *upara0,
89 doublereal *upara1,
90 doublereal *crvnew,
91 integer *iercod);
92
93static
94int mmatvec_(integer *nligne,
95 integer *ncolon,
96 integer *gposit,
97 integer *gnstoc,
98 doublereal *gmatri,
99 doublereal *vecin,
100 integer *deblig,
101 doublereal *vecout,
102 integer *iercod);
103
104static
105int mmcvstd_(integer *ncofmx,
106 integer *ndimax,
107 integer *ncoeff,
108 integer *ndimen,
109 doublereal *crvcan,
110 doublereal *courbe);
111
112static
113int mmdrvcb_(integer *ideriv,
114 integer *ndim,
115 integer *ncoeff,
116 doublereal *courbe,
117 doublereal *tparam,
118 doublereal *tabpnt,
119 integer *iercod);
120
121static
122int mmexthi_(integer *ndegre,
123 doublereal *hwgaus);
124
125static
126int mmextrl_(integer *ndegre,
127 doublereal *rootlg);
128
129
130
131static
132int mmherm0_(doublereal *debfin,
133 integer *iercod);
134
135static
136int mmherm1_(doublereal *debfin,
137 integer *ordrmx,
138 integer *iordre,
139 doublereal *hermit,
140 integer *iercod);
141static
142int mmloncv_(integer *ndimax,
143 integer *ndimen,
144 integer *ncoeff,
145 doublereal *courbe,
146 doublereal *tdebut,
147 doublereal *tfinal,
148 doublereal *xlongc,
149 integer *iercod);
150static
151int mmpojac_(doublereal *tparam,
152 integer *iordre,
153 integer *ncoeff,
154 integer *nderiv,
155 doublereal *valjac,
156 integer *iercod);
157
158static
159int mmrslw_(integer *normax,
160 integer *nordre,
161 integer *ndimen,
162 doublereal *epspiv,
163 doublereal *abmatr,
164 doublereal *xmatri,
165 integer *iercod);
166static
167int mmtmave_(integer *nligne,
168 integer *ncolon,
169 integer *gposit,
170 integer *gnstoc,
171 doublereal *gmatri,
172 doublereal *vecin,
173 doublereal *vecout,
174 integer *iercod);
175static
176int mmtrpj0_(integer *ncofmx,
177 integer *ndimen,
178 integer *ncoeff,
179 doublereal *epsi3d,
180 doublereal *crvlgd,
181 doublereal *ycvmax,
182 doublereal *epstrc,
183 integer *ncfnew);
184static
185int mmtrpj2_(integer *ncofmx,
186 integer *ndimen,
187 integer *ncoeff,
188 doublereal *epsi3d,
189 doublereal *crvlgd,
190 doublereal *ycvmax,
191 doublereal *epstrc,
192 integer *ncfnew);
193
194static
195int mmtrpj4_(integer *ncofmx,
196 integer *ndimen,
197 integer *ncoeff,
198 doublereal *epsi3d,
199 doublereal *crvlgd,
200 doublereal *ycvmax,
201 doublereal *epstrc,
202 integer *ncfnew);
203static
204int mmtrpj6_(integer *ncofmx,
205 integer *ndimen,
206 integer *ncoeff,
207 doublereal *epsi3d,
208 doublereal *crvlgd,
209 doublereal *ycvmax,
210 doublereal *epstrc,
211 integer *ncfnew);
212static
213integer pow__ii(integer *x,
214 integer *n);
215
216static
217int mvcvin2_(integer *ncoeff,
218 doublereal *crvold,
219 doublereal *crvnew,
220 integer *iercod);
221
222static
223int mvcvinv_(integer *ncoeff,
224 doublereal *crvold,
225 doublereal *crvnew,
226 integer *iercod);
227
228static
229int mvgaus0_(integer *kindic,
230 doublereal *urootl,
231 doublereal *hiltab,
232 integer *nbrval,
233 integer *iercod);
234static
235int mvpscr2_(integer *ncoeff,
236 doublereal *curve2,
237 doublereal *tparam,
238 doublereal *pntcrb);
239
240static
241int mvpscr3_(integer *ncoeff,
242 doublereal *curve2,
243 doublereal *tparam,
244 doublereal *pntcrb);
245
246static struct {
247 doublereal eps1, eps2, eps3, eps4;
248 integer niterm, niterr;
249} mmprcsn_;
250
251static struct {
252 doublereal tdebut, tfinal, verifi, cmherm[576];
253} mmcmher_;
254
255//=======================================================================
256//function : AdvApp2Var_MathBase::mdsptpt_
257//purpose :
258//=======================================================================
259int AdvApp2Var_MathBase::mdsptpt_(integer *ndimen,
260 doublereal *point1,
261 doublereal *point2,
262 doublereal *distan)
263
264{
1ef32e96 265 integer c__8 = 8;
7fd59977 266 /* System generated locals */
267 integer i__1;
268 doublereal d__1;
41194117 269
7fd59977 270 /* Local variables */
1ef32e96
RL
271 integer i__;
272 doublereal* differ = 0;
273 integer ier;
fadcea2c 274 intptr_t iofset, j;
7fd59977 275
276/* **********************************************************************
277*/
278
0d969553 279/* FUNCTION : */
7fd59977 280/* ---------- */
0d969553 281/* CALCULATE DISTANCE BETWEEN TWO POINTS */
7fd59977 282
0d969553 283/* KEYWORDS : */
7fd59977 284/* ----------- */
285/* DISTANCE,POINT. */
286
0d969553 287/* INPUT ARGUMENTS : */
7fd59977 288/* ------------------ */
0d969553
Y
289/* NDIMEN: Space Dimension. */
290/* POINT1: Table of coordinates of the 1st point. */
291/* POINT2: Table of coordinates of the 2nd point. */
7fd59977 292
0d969553 293/* OUTPUT ARGUMENTS : */
7fd59977 294/* ------------------- */
0d969553 295/* DISTAN: Distance between 2 points. */
7fd59977 296
0d969553 297/* COMMONS USED : */
7fd59977 298/* ---------------- */
299
0d969553 300/* REFERENCES CALLED : */
7fd59977 301/* ----------------------- */
302
0d969553 303/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 304/* ----------------------------------- */
7fd59977 305/* > */
306/* **********************************************************************
307*/
308
309
310/* ***********************************************************************
311 */
0d969553 312/* INITIALISATION */
7fd59977 313/* ***********************************************************************
314 */
315
0d969553 316 /* Parameter adjustment */
7fd59977 317 --point2;
318 --point1;
319
320 /* Function Body */
321 iofset = 0;
322 ier = 0;
323
324/* ***********************************************************************
325 */
326/* TRAITEMENT */
327/* ***********************************************************************
328 */
329
1ef32e96 330 AdvApp2Var_SysBase anAdvApp2Var_SysBase;
7fd59977 331 if (*ndimen > 100) {
1ef32e96 332 anAdvApp2Var_SysBase.mcrrqst_(&c__8, ndimen, differ, &iofset, &ier);
7fd59977 333 }
334
0d969553 335/* --- If allocation is refused, the trivial method is applied. */
7fd59977 336
337 if (ier > 0) {
338
339 *distan = 0.;
340 i__1 = *ndimen;
341 for (i__ = 1; i__ <= i__1; ++i__) {
342/* Computing 2nd power */
343 d__1 = point1[i__] - point2[i__];
344 *distan += d__1 * d__1;
345 }
346 *distan = sqrt(*distan);
347
0d969553 348/* --- Otherwise MZSNORM is used to minimize the risks of overflow
7fd59977 349*/
350
351 } else {
352 i__1 = *ndimen;
353 for (i__ = 1; i__ <= i__1; ++i__) {
354 j=iofset + i__ - 1;
355 differ[j] = point2[i__] - point1[i__];
356 }
357
358 *distan = AdvApp2Var_MathBase::mzsnorm_(ndimen, &differ[iofset]);
359
360 }
361
362/* ***********************************************************************
363 */
0d969553 364/* RETURN CALLING PROGRAM */
7fd59977 365/* ***********************************************************************
366 */
367
0d969553 368/* --- Dynamic Desallocation */
7fd59977 369
370 if (iofset != 0) {
1ef32e96 371 anAdvApp2Var_SysBase.mcrdelt_(&c__8, ndimen, differ, &iofset, &ier);
7fd59977 372 }
373
374 return 0 ;
375} /* mdsptpt_ */
376
377//=======================================================================
378//function : mfac_
379//purpose :
380//=======================================================================
381int mfac_(doublereal *f,
382 integer *n)
383
384{
385 /* System generated locals */
386 integer i__1;
387
388 /* Local variables */
1ef32e96 389 integer i__;
7fd59977 390
391/* FORTRAN CONFORME AU TEXT */
392/* CALCUL DE MFACTORIEL N */
393 /* Parameter adjustments */
394 --f;
395
396 /* Function Body */
397 f[1] = (float)1.;
398 i__1 = *n;
399 for (i__ = 2; i__ <= i__1; ++i__) {
400/* L10: */
401 f[i__] = i__ * f[i__ - 1];
402 }
403 return 0;
404} /* mfac_ */
405
406//=======================================================================
407//function : AdvApp2Var_MathBase::mmapcmp_
408//purpose :
409//=======================================================================
410int AdvApp2Var_MathBase::mmapcmp_(integer *ndim,
411 integer *ncofmx,
412 integer *ncoeff,
413 doublereal *crvold,
414 doublereal *crvnew)
415
416{
417 /* System generated locals */
418 integer crvold_dim1, crvold_offset, crvnew_dim1, crvnew_offset, i__1,
419 i__2;
41194117 420
7fd59977 421 /* Local variables */
1ef32e96 422 integer ipair, nd, ndegre, impair, ibb, idg;
7fd59977 423 //extern int mgsomsg_();//mgenmsg_(),
7fd59977 424
425/* **********************************************************************
426*/
427
0d969553 428/* FUNCTION : */
7fd59977 429/* ---------- */
0d969553
Y
430/* Compression of curve CRVOLD in a table of */
431/* coeff. of even : CRVNEW(*,0,*) */
432/* and uneven range : CRVNEW(*,1,*). */
7fd59977 433
0d969553 434/* KEYWORDS : */
7fd59977 435/* ----------- */
0d969553 436/* COMPRESSION,CURVE. */
7fd59977 437
0d969553 438/* INPUT ARGUMENTS : */
7fd59977 439/* ------------------ */
0d969553
Y
440/* NDIM : Space Dimension. */
441/* NCOFMX : Max nb of coeff. of the curve to compress. */
442/* NCOEFF : Max nb of coeff. of the compressed curve. */
443/* CRVOLD : The curve (0:NCOFMX-1,NDIM) to compress. */
7fd59977 444
0d969553 445/* OUTPUT ARGUMENTS : */
7fd59977 446/* ------------------- */
0d969553 447/* CRVNEW : Curve compacted in (0:(NCOEFF-1)/2,0,NDIM) (containing
7fd59977 448*/
0d969553
Y
449/* even terms) and in (0:(NCOEFF-1)/2,1,NDIM) */
450/* (containing uneven terms). */
7fd59977 451
0d969553 452/* COMMONS USED : */
7fd59977 453/* ---------------- */
454
0d969553 455/* REFERENCES CALLED : */
7fd59977 456/* ----------------------- */
457
0d969553 458/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 459/* ----------------------------------- */
0d969553
Y
460/* This routine is useful to prepare coefficients of a */
461/* curve in an orthogonal base (Legendre or Jacobi) before */
462/* calculating the coefficients in the canonical; base [-1,1] by */
7fd59977 463/* MMJACAN. */
7fd59977 464/* ***********************************************************************
465 */
466
0d969553 467/* Name of the routine */
7fd59977 468
469 /* Parameter adjustments */
470 crvold_dim1 = *ncofmx;
471 crvold_offset = crvold_dim1;
472 crvold -= crvold_offset;
473 crvnew_dim1 = (*ncoeff - 1) / 2 + 1;
474 crvnew_offset = crvnew_dim1 << 1;
475 crvnew -= crvnew_offset;
476
477 /* Function Body */
478 ibb = AdvApp2Var_SysBase::mnfndeb_();
479 if (ibb >= 3) {
480 AdvApp2Var_SysBase::mgenmsg_("MMAPCMP", 7L);
481 }
482
483 ndegre = *ncoeff - 1;
484 i__1 = *ndim;
485 for (nd = 1; nd <= i__1; ++nd) {
486 ipair = 0;
487 i__2 = ndegre / 2;
488 for (idg = 0; idg <= i__2; ++idg) {
489 crvnew[idg + (nd << 1) * crvnew_dim1] = crvold[ipair + nd *
490 crvold_dim1];
491 ipair += 2;
492/* L200: */
493 }
494 if (ndegre < 1) {
495 goto L400;
496 }
497 impair = 1;
498 i__2 = (ndegre - 1) / 2;
499 for (idg = 0; idg <= i__2; ++idg) {
500 crvnew[idg + ((nd << 1) + 1) * crvnew_dim1] = crvold[impair + nd *
501 crvold_dim1];
502 impair += 2;
503/* L300: */
504 }
505
506L400:
507/* L100: */
508 ;
509 }
510
511/* ---------------------------------- The end ---------------------------
512*/
513
514 if (ibb >= 3) {
515 AdvApp2Var_SysBase::mgsomsg_("MMAPCMP", 7L);
516 }
517 return 0;
518} /* mmapcmp_ */
519
520//=======================================================================
521//function : mmaper0_
522//purpose :
523//=======================================================================
524int mmaper0_(integer *ncofmx,
525 integer *ndimen,
526 integer *ncoeff,
527 doublereal *crvlgd,
528 integer *ncfnew,
529 doublereal *ycvmax,
530 doublereal *errmax)
531
532{
533 /* System generated locals */
534 integer crvlgd_dim1, crvlgd_offset, i__1, i__2;
535 doublereal d__1;
41194117 536
7fd59977 537 /* Local variables */
1ef32e96
RL
538 integer ncut;
539 doublereal bidon;
540 integer ii, nd;
7fd59977 541
542/* ***********************************************************************
543 */
544
0d969553 545/* FUNCTION : */
7fd59977 546/* ---------- */
0d969553
Y
547/* Calculate the max error of approximation done when */
548/* only the first NCFNEW coefficients of a curve are preserved.
7fd59977 549*/
0d969553
Y
550/* Degree NCOEFF-1 written in the base of Legendre (Jacobi */
551/* of order 0). */
7fd59977 552
0d969553 553/* KEYWORDS : */
7fd59977 554/* ----------- */
0d969553 555/* LEGENDRE,POLYGON,APPROXIMATION,ERROR. */
7fd59977 556
0d969553 557/* INPUT ARGUMENTS : */
7fd59977 558/* ------------------ */
0d969553
Y
559/* NCOFMX : Max. degree of the curve. */
560/* NDIMEN : Space dimension. */
561/* NCOEFF : Degree +1 of the curve. */
562/* CRVLGD : Curve the degree which of should be lowered. */
563/* NCFNEW : Degree +1 of the resulting polynom. */
7fd59977 564
0d969553 565/* OUTPUT ARGUMENTS : */
7fd59977 566/* ------------------- */
0d969553 567/* YCVMAX : Auxiliary Table (max error on each dimension).
7fd59977 568*/
0d969553 569/* ERRMAX : Precision of the approximation. */
7fd59977 570
0d969553 571/* COMMONS USED : */
7fd59977 572/* ---------------- */
573
0d969553 574/* REFERENCES CALLED : */
7fd59977 575/* ----------------------- */
576
0d969553 577/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 578/* ----------------------------------- */
7fd59977 579/* ***********************************************************************
580 */
581
582
0d969553 583/* ------------------- Init to calculate an error -----------------------
7fd59977 584*/
585
586 /* Parameter adjustments */
587 --ycvmax;
588 crvlgd_dim1 = *ncofmx;
589 crvlgd_offset = crvlgd_dim1 + 1;
590 crvlgd -= crvlgd_offset;
591
592 /* Function Body */
593 i__1 = *ndimen;
594 for (ii = 1; ii <= i__1; ++ii) {
595 ycvmax[ii] = 0.;
596/* L100: */
597 }
598
0d969553 599/* ------ Minimum that can be reached : Stop at 1 or NCFNEW ------
7fd59977 600*/
601
602 ncut = 1;
603 if (*ncfnew + 1 > ncut) {
604 ncut = *ncfnew + 1;
605 }
606
0d969553 607/* -------------- Elimination of high degree coefficients-----------
7fd59977 608*/
0d969553 609/* ----------- Loop on the series of Legendre: NCUT --> NCOEFF --------
7fd59977 610*/
611
612 i__1 = *ncoeff;
613 for (ii = ncut; ii <= i__1; ++ii) {
0d969553 614/* Factor of renormalization (Maximum of Li(t)). */
7fd59977 615 bidon = ((ii - 1) * 2. + 1.) / 2.;
616 bidon = sqrt(bidon);
617
618 i__2 = *ndimen;
619 for (nd = 1; nd <= i__2; ++nd) {
41194117 620 ycvmax[nd] += (d__1 = crvlgd[ii + nd * crvlgd_dim1], advapp_abs(d__1)) *
7fd59977 621 bidon;
622/* L310: */
623 }
624/* L300: */
625 }
626
0d969553 627/* -------------- The error is the norm of the vector error ---------------
7fd59977 628*/
629
630 *errmax = AdvApp2Var_MathBase::mzsnorm_(ndimen, &ycvmax[1]);
631
632/* --------------------------------- Fin --------------------------------
633*/
634
635 return 0;
636} /* mmaper0_ */
637
638//=======================================================================
639//function : mmaper2_
640//purpose :
641//=======================================================================
642int mmaper2_(integer *ncofmx,
643 integer *ndimen,
644 integer *ncoeff,
645 doublereal *crvjac,
646 integer *ncfnew,
647 doublereal *ycvmax,
648 doublereal *errmax)
649
650{
651 /* Initialized data */
652
653 static doublereal xmaxj[57] = { .9682458365518542212948163499456,
654 .986013297183269340427888048593603,
655 1.07810420343739860362585159028115,
656 1.17325804490920057010925920756025,
657 1.26476561266905634732910520370741,
658 1.35169950227289626684434056681946,
659 1.43424378958284137759129885012494,
660 1.51281316274895465689402798226634,
661 1.5878364329591908800533936587012,
662 1.65970112228228167018443636171226,
663 1.72874345388622461848433443013543,
664 1.7952515611463877544077632304216,
665 1.85947199025328260370244491818047,
666 1.92161634324190018916351663207101,
667 1.98186713586472025397859895825157,
668 2.04038269834980146276967984252188,
669 2.09730119173852573441223706382076,
670 2.15274387655763462685970799663412,
671 2.20681777186342079455059961912859,
672 2.25961782459354604684402726624239,
673 2.31122868752403808176824020121524,
674 2.36172618435386566570998793688131,
675 2.41117852396114589446497298177554,
676 2.45964731268663657873849811095449,
677 2.50718840313973523778244737914028,
678 2.55385260994795361951813645784034,
679 2.59968631659221867834697883938297,
680 2.64473199258285846332860663371298,
681 2.68902863641518586789566216064557,
682 2.73261215675199397407027673053895,
683 2.77551570192374483822124304745691,
684 2.8177699459714315371037628127545,
685 2.85940333797200948896046563785957,
686 2.90044232019793636101516293333324,
687 2.94091151970640874812265419871976,
688 2.98083391718088702956696303389061,
689 3.02023099621926980436221568258656,
690 3.05912287574998661724731962377847,
691 3.09752842783622025614245706196447,
692 3.13546538278134559341444834866301,
693 3.17295042316122606504398054547289,
694 3.2099992681699613513775259670214,
695 3.24662674946606137764916854570219,
696 3.28284687953866689817670991319787,
697 3.31867291347259485044591136879087,
698 3.35411740487202127264475726990106,
699 3.38919225660177218727305224515862,
700 3.42390876691942143189170489271753,
701 3.45827767149820230182596660024454,
702 3.49230918177808483937957161007792,
703 3.5260130200285724149540352829756,
704 3.55939845146044235497103883695448,
705 3.59247431368364585025958062194665,
706 3.62524904377393592090180712976368,
707 3.65773070318071087226169680450936,
708 3.68992700068237648299565823810245,
709 3.72184531357268220291630708234186 };
710
711 /* System generated locals */
712 integer crvjac_dim1, crvjac_offset, i__1, i__2;
713 doublereal d__1;
714
715 /* Local variables */
1ef32e96
RL
716 integer idec, ncut;
717 doublereal bidon;
718 integer ii, nd;
7fd59977 719
720
721
722/* ***********************************************************************
723 */
724
725/* FONCTION : */
726/* ---------- */
0d969553 727/* Calculate max approximation error i faite lorsque l' on */
7fd59977 728/* ne conserve que les premiers NCFNEW coefficients d' une courbe
729*/
730/* de degre NCOEFF-1 ecrite dans la base de Jacobi d' ordre 2. */
731
0d969553 732/* KEYWORDS : */
7fd59977 733/* ----------- */
0d969553 734/* JACOBI, POLYGON, APPROXIMATION, ERROR. */
258ff83b 735/**/
0d969553 736/* INPUT ARGUMENTS : */
7fd59977 737/* ------------------ */
0d969553
Y
738/* NCOFMX : Max. degree of the curve. */
739/* NDIMEN : Space dimension. */
740/* NCOEFF : Degree +1 of the curve. */
741/* CRVLGD : Curve the degree which of should be lowered. */
742/* NCFNEW : Degree +1 of the resulting polynom. */
7fd59977 743
0d969553 744/* OUTPUT ARGUMENTS : */
7fd59977 745/* ------------------- */
0d969553 746/* YCVMAX : Auxiliary Table (max error on each dimension).
7fd59977 747*/
0d969553 748/* ERRMAX : Precision of the approximation. */
7fd59977 749
0d969553 750/* COMMONS USED : */
7fd59977 751/* ---------------- */
752
0d969553 753/* REFERENCES CALLED : */
7fd59977 754/* ----------------------- */
0d969553 755/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 756/* ----------------------------------- */
757
7fd59977 758
759
0d969553 760/* ------------------ Table of maximums of (1-t2)*Ji(t) ----------------
7fd59977 761*/
762
763 /* Parameter adjustments */
764 --ycvmax;
765 crvjac_dim1 = *ncofmx;
766 crvjac_offset = crvjac_dim1 + 1;
767 crvjac -= crvjac_offset;
768
769 /* Function Body */
770
771
772
0d969553 773/* ------------------- Init for error calculation -----------------------
7fd59977 774*/
775
776 i__1 = *ndimen;
777 for (ii = 1; ii <= i__1; ++ii) {
778 ycvmax[ii] = 0.;
779/* L100: */
780 }
781
0d969553 782/* ------ Min. Degree that can be attained : Stop at 3 or NCFNEW ------
7fd59977 783*/
784
785 idec = 3;
786/* Computing MAX */
787 i__1 = idec, i__2 = *ncfnew + 1;
41194117 788 ncut = advapp_max(i__1,i__2);
7fd59977 789
0d969553 790/* -------------- Removal of coefficients of high degree -----------
7fd59977 791*/
0d969553 792/* ----------- Loop on the series of Jacobi :NCUT --> NCOEFF ----------
7fd59977 793*/
794
795 i__1 = *ncoeff;
796 for (ii = ncut; ii <= i__1; ++ii) {
0d969553 797/* Factor of renormalization. */
7fd59977 798 bidon = xmaxj[ii - idec];
799 i__2 = *ndimen;
800 for (nd = 1; nd <= i__2; ++nd) {
41194117 801 ycvmax[nd] += (d__1 = crvjac[ii + nd * crvjac_dim1], advapp_abs(d__1)) *
7fd59977 802 bidon;
803/* L310: */
804 }
805/* L300: */
806 }
807
0d969553 808/* -------------- The error is the norm of the vector error ---------------
7fd59977 809*/
810
811 *errmax = AdvApp2Var_MathBase::mzsnorm_(ndimen, &ycvmax[1]);
812
813/* --------------------------------- Fin --------------------------------
814*/
815
816 return 0;
817} /* mmaper2_ */
818
819/* MAPER4.f -- translated by f2c (version 19960827).
820 You must link the resulting object file with the libraries:
821 -lf2c -lm (in that order)
822*/
823
824/* Subroutine */
825//=======================================================================
826//function : mmaper4_
827//purpose :
828//=======================================================================
829int mmaper4_(integer *ncofmx,
830 integer *ndimen,
831 integer *ncoeff,
832 doublereal *crvjac,
833 integer *ncfnew,
834 doublereal *ycvmax,
835 doublereal *errmax)
836{
837 /* Initialized data */
838
839 static doublereal xmaxj[55] = { 1.1092649593311780079813740546678,
840 1.05299572648705464724876659688996,
841 1.0949715351434178709281698645813,
842 1.15078388379719068145021100764647,
843 1.2094863084718701596278219811869,
844 1.26806623151369531323304177532868,
845 1.32549784426476978866302826176202,
846 1.38142537365039019558329304432581,
847 1.43575531950773585146867625840552,
848 1.48850442653629641402403231015299,
849 1.53973611681876234549146350844736,
850 1.58953193485272191557448229046492,
851 1.63797820416306624705258190017418,
852 1.68515974143594899185621942934906,
853 1.73115699602477936547107755854868,
854 1.77604489805513552087086912113251,
855 1.81989256661534438347398400420601,
856 1.86276344480103110090865609776681,
857 1.90471563564740808542244678597105,
858 1.94580231994751044968731427898046,
859 1.98607219357764450634552790950067,
860 2.02556989246317857340333585562678,
861 2.06433638992049685189059517340452,
862 2.10240936014742726236706004607473,
863 2.13982350649113222745523925190532,
864 2.17661085564771614285379929798896,
865 2.21280102016879766322589373557048,
866 2.2484214321456956597803794333791,
867 2.28349755104077956674135810027654,
868 2.31805304852593774867640120860446,
869 2.35210997297725685169643559615022,
870 2.38568889602346315560143377261814,
871 2.41880904328694215730192284109322,
872 2.45148841120796359750021227795539,
873 2.48374387161372199992570528025315,
874 2.5155912654873773953959098501893,
875 2.54704548720896557684101746505398,
876 2.57812056037881628390134077704127,
877 2.60882970619319538196517982945269,
878 2.63918540521920497868347679257107,
879 2.66919945330942891495458446613851,
880 2.69888301230439621709803756505788,
881 2.72824665609081486737132853370048,
882 2.75730041251405791603760003778285,
883 2.78605380158311346185098508516203,
884 2.81451587035387403267676338931454,
885 2.84269522483114290814009184272637,
886 2.87060005919012917988363332454033,
887 2.89823818258367657739520912946934,
888 2.92561704377132528239806135133273,
889 2.95274375377994262301217318010209,
890 2.97962510678256471794289060402033,
891 3.00626759936182712291041810228171,
892 3.03267744830655121818899164295959,
893 3.05886060707437081434964933864149 };
894
895 /* System generated locals */
896 integer crvjac_dim1, crvjac_offset, i__1, i__2;
897 doublereal d__1;
898
899 /* Local variables */
1ef32e96
RL
900 integer idec, ncut;
901 doublereal bidon;
902 integer ii, nd;
7fd59977 903
904
905
906/* ***********************************************************************
907 */
908
0d969553 909/* FUNCTION : */
7fd59977 910/* ---------- */
0d969553
Y
911/* Calculate the max. error of approximation made when */
912/* only first NCFNEW coefficients of a curve are preserved
7fd59977 913*/
0d969553
Y
914/* degree NCOEFF-1 is written in the base of Jacobi of order 4. */
915/* KEYWORDS : */
7fd59977 916/* ----------- */
0d969553 917/* LEGENDRE,POLYGON,APPROXIMATION,ERROR. */
7fd59977 918
0d969553 919/* INPUT ARGUMENTS : */
7fd59977 920/* ------------------ */
0d969553
Y
921/* NCOFMX : Max. degree of the curve. */
922/* NDIMEN : Space dimension. */
923/* NCOEFF : Degree +1 of the curve. */
924/* CRVJAC : Curve the degree which of should be lowered. */
925/* NCFNEW : Degree +1 of the resulting polynom. */
7fd59977 926
0d969553 927/* OUTPUT ARGUMENTS : */
7fd59977 928/* ------------------- */
0d969553 929/* YCVMAX : Auxiliary Table (max error on each dimension).
7fd59977 930*/
0d969553 931/* ERRMAX : Precision of the approximation. */
7fd59977 932
0d969553 933/* COMMONS USED : */
7fd59977 934/* ---------------- */
935
0d969553 936/* REFERENCES CALLED : */
7fd59977 937/* ----------------------- */
938
0d969553
Y
939/* DESCRIPTION/NOTES/LIMITATIONS : */
940
7fd59977 941
7fd59977 942/* ***********************************************************************
943 */
944
945
0d969553 946/* ---------------- Table of maximums of ((1-t2)2)*Ji(t) ---------------
7fd59977 947*/
948
949 /* Parameter adjustments */
950 --ycvmax;
951 crvjac_dim1 = *ncofmx;
952 crvjac_offset = crvjac_dim1 + 1;
953 crvjac -= crvjac_offset;
954
955 /* Function Body */
956
957
958
0d969553 959/* ------------------- Init for error calculation -----------------------
7fd59977 960*/
961
962 i__1 = *ndimen;
963 for (ii = 1; ii <= i__1; ++ii) {
964 ycvmax[ii] = 0.;
965/* L100: */
966 }
967
0d969553 968/* ------ Min. Degree that can be attained : Stop at 5 or NCFNEW ------
7fd59977 969*/
970
971 idec = 5;
972/* Computing MAX */
973 i__1 = idec, i__2 = *ncfnew + 1;
41194117 974 ncut = advapp_max(i__1,i__2);
7fd59977 975
0d969553 976/* -------------- Removal of high degree coefficients -----------
7fd59977 977*/
0d969553 978/* ----------- Loop on the series of Jacobi :NCUT --> NCOEFF ----------
7fd59977 979*/
980
981 i__1 = *ncoeff;
982 for (ii = ncut; ii <= i__1; ++ii) {
0d969553 983/* Factor of renormalisation. */
7fd59977 984 bidon = xmaxj[ii - idec];
985 i__2 = *ndimen;
986 for (nd = 1; nd <= i__2; ++nd) {
41194117 987 ycvmax[nd] += (d__1 = crvjac[ii + nd * crvjac_dim1], advapp_abs(d__1)) *
7fd59977 988 bidon;
989/* L310: */
990 }
991/* L300: */
992 }
993
0d969553 994/* -------------- The error is the norm of the error vector ---------------
7fd59977 995*/
996
997 *errmax = AdvApp2Var_MathBase::mzsnorm_(ndimen, &ycvmax[1]);
998
0d969553 999/* --------------------------------- End --------------------------------
7fd59977 1000*/
1001
1002 return 0;
1003} /* mmaper4_ */
1004
1005//=======================================================================
1006//function : mmaper6_
1007//purpose :
1008//=======================================================================
1009int mmaper6_(integer *ncofmx,
1010 integer *ndimen,
1011 integer *ncoeff,
1012 doublereal *crvjac,
1013 integer *ncfnew,
1014 doublereal *ycvmax,
1015 doublereal *errmax)
1016
1017{
1018 /* Initialized data */
1019
1020 static doublereal xmaxj[53] = { 1.21091229812484768570102219548814,
1021 1.11626917091567929907256116528817,
1022 1.1327140810290884106278510474203,
1023 1.1679452722668028753522098022171,
1024 1.20910611986279066645602153641334,
1025 1.25228283758701572089625983127043,
1026 1.29591971597287895911380446311508,
1027 1.3393138157481884258308028584917,
1028 1.3821288728999671920677617491385,
1029 1.42420414683357356104823573391816,
1030 1.46546895108549501306970087318319,
1031 1.50590085198398789708599726315869,
1032 1.54550385142820987194251585145013,
1033 1.58429644271680300005206185490937,
1034 1.62230484071440103826322971668038,
1035 1.65955905239130512405565733793667,
1036 1.69609056468292429853775667485212,
1037 1.73193098017228915881592458573809,
1038 1.7671112206990325429863426635397,
1039 1.80166107681586964987277458875667,
1040 1.83560897003644959204940535551721,
1041 1.86898184653271388435058371983316,
1042 1.90180515174518670797686768515502,
1043 1.93410285411785808749237200054739,
1044 1.96589749778987993293150856865539,
1045 1.99721027139062501070081653790635,
1046 2.02806108474738744005306947877164,
1047 2.05846864831762572089033752595401,
1048 2.08845055210580131460156962214748,
1049 2.11802334209486194329576724042253,
1050 2.14720259305166593214642386780469,
1051 2.17600297710595096918495785742803,
1052 2.20443832785205516555772788192013,
1053 2.2325216999457379530416998244706,
1054 2.2602654243075083168599953074345,
1055 2.28768115912702794202525264301585,
1056 2.3147799369092684021274946755348,
1057 2.34157220782483457076721300512406,
1058 2.36806787963276257263034969490066,
1059 2.39427635443992520016789041085844,
1060 2.42020656255081863955040620243062,
1061 2.44586699364757383088888037359254,
1062 2.47126572552427660024678584642791,
1063 2.49641045058324178349347438430311,
1064 2.52130850028451113942299097584818,
1065 2.54596686772399937214920135190177,
1066 2.5703922285006754089328998222275,
1067 2.59459096001908861492582631591134,
1068 2.61856915936049852435394597597773,
1069 2.64233265984385295286445444361827,
1070 2.66588704638685848486056711408168,
1071 2.68923766976735295746679957665724,
1072 2.71238965987606292679677228666411 };
1073
1074 /* System generated locals */
1075 integer crvjac_dim1, crvjac_offset, i__1, i__2;
1076 doublereal d__1;
1077
1078 /* Local variables */
1ef32e96
RL
1079 integer idec, ncut;
1080 doublereal bidon;
1081 integer ii, nd;
7fd59977 1082
1083
1084
1085/* ***********************************************************************
1086 */
0d969553 1087/* FUNCTION : */
7fd59977 1088/* ---------- */
0d969553
Y
1089/* Calculate the max. error of approximation made when */
1090/* only first NCFNEW coefficients of a curve are preserved
7fd59977 1091*/
0d969553
Y
1092/* degree NCOEFF-1 is written in the base of Jacobi of order 6. */
1093/* KEYWORDS : */
7fd59977 1094/* ----------- */
0d969553 1095/* JACOBI,POLYGON,APPROXIMATION,ERROR. */
7fd59977 1096
0d969553 1097/* INPUT ARGUMENTS : */
7fd59977 1098/* ------------------ */
0d969553
Y
1099/* NCOFMX : Max. degree of the curve. */
1100/* NDIMEN : Space dimension. */
1101/* NCOEFF : Degree +1 of the curve. */
1102/* CRVJAC : Curve the degree which of should be lowered. */
1103/* NCFNEW : Degree +1 of the resulting polynom. */
7fd59977 1104
0d969553 1105/* OUTPUT ARGUMENTS : */
7fd59977 1106/* ------------------- */
0d969553 1107/* YCVMAX : Auxiliary Table (max error on each dimension).
7fd59977 1108*/
0d969553 1109/* ERRMAX : Precision of the approximation. */
7fd59977 1110
0d969553 1111/* COMMONS USED : */
7fd59977 1112/* ---------------- */
1113
0d969553 1114/* REFERENCES CALLED : */
7fd59977 1115/* ----------------------- */
1116
0d969553 1117/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 1118/* > */
1119/* ***********************************************************************
1120 */
1121
1122
0d969553 1123/* ---------------- Table of maximums of ((1-t2)3)*Ji(t) ---------------
7fd59977 1124*/
1125
1126 /* Parameter adjustments */
1127 --ycvmax;
1128 crvjac_dim1 = *ncofmx;
1129 crvjac_offset = crvjac_dim1 + 1;
1130 crvjac -= crvjac_offset;
1131
1132 /* Function Body */
1133
1134
1135
0d969553 1136/* ------------------- Init for error calculation -----------------------
7fd59977 1137*/
1138
1139 i__1 = *ndimen;
1140 for (ii = 1; ii <= i__1; ++ii) {
1141 ycvmax[ii] = 0.;
1142/* L100: */
1143 }
1144
0d969553 1145/* ------ Min Degree that can be attained : Stop at 3 or NCFNEW ------
7fd59977 1146*/
1147
1148 idec = 7;
1149/* Computing MAX */
1150 i__1 = idec, i__2 = *ncfnew + 1;
41194117 1151 ncut = advapp_max(i__1,i__2);
7fd59977 1152
0d969553 1153/* -------------- Removal of high degree coefficients -----------
7fd59977 1154*/
0d969553 1155/* ----------- Loop on the series of Jacobi :NCUT --> NCOEFF ----------
7fd59977 1156*/
1157
1158 i__1 = *ncoeff;
1159 for (ii = ncut; ii <= i__1; ++ii) {
0d969553 1160/* Factor of renormalization. */
7fd59977 1161 bidon = xmaxj[ii - idec];
1162 i__2 = *ndimen;
1163 for (nd = 1; nd <= i__2; ++nd) {
41194117 1164 ycvmax[nd] += (d__1 = crvjac[ii + nd * crvjac_dim1], advapp_abs(d__1)) *
7fd59977 1165 bidon;
1166/* L310: */
1167 }
1168/* L300: */
1169 }
1170
0d969553 1171/* -------------- The error is the norm of the vector error ---------------
7fd59977 1172*/
1173
1174 *errmax = AdvApp2Var_MathBase::mzsnorm_(ndimen, &ycvmax[1]);
1175
0d969553 1176/* --------------------------------- END --------------------------------
7fd59977 1177*/
1178
1179 return 0;
1180} /* mmaper6_ */
1181
1182//=======================================================================
1183//function : AdvApp2Var_MathBase::mmaperx_
1184//purpose :
1185//=======================================================================
1186int AdvApp2Var_MathBase::mmaperx_(integer *ncofmx,
1187 integer *ndimen,
1188 integer *ncoeff,
1189 integer *iordre,
1190 doublereal *crvjac,
1191 integer *ncfnew,
1192 doublereal *ycvmax,
1193 doublereal *errmax,
1194 integer *iercod)
1195
1196{
1197 /* System generated locals */
1198 integer crvjac_dim1, crvjac_offset;
41194117 1199
7fd59977 1200 /* Local variables */
1ef32e96 1201 integer jord;
7fd59977 1202
1203/* **********************************************************************
1204*/
0d969553 1205/* FUNCTION : */
7fd59977 1206/* ---------- */
0d969553
Y
1207/* Calculate the max. error of approximation made when */
1208/* only first NCFNEW coefficients of a curve are preserved
7fd59977 1209*/
0d969553
Y
1210/* degree NCOEFF-1 is written in the base of Jacobi of order IORDRE. */
1211/* KEYWORDS : */
7fd59977 1212/* ----------- */
0d969553 1213/* JACOBI,LEGENDRE,POLYGON,APPROXIMATION,ERROR. */
7fd59977 1214
0d969553 1215/* INPUT ARGUMENTS : */
7fd59977 1216/* ------------------ */
0d969553
Y
1217/* NCOFMX : Max. degree of the curve. */
1218/* NDIMEN : Space dimension. */
1219/* NCOEFF : Degree +1 of the curve. */
1220/* IORDRE : Order of continuity at the extremities. */
1221/* CRVJAC : Curve the degree which of should be lowered. */
1222/* NCFNEW : Degree +1 of the resulting polynom. */
1223
1224/* OUTPUT ARGUMENTS : */
7fd59977 1225/* ------------------- */
0d969553
Y
1226/* YCVMAX : Auxiliary Table (max error on each dimension).
1227*/
1228/* ERRMAX : Precision of the approximation. */
7fd59977 1229/* IERCOD = 0, OK */
0d969553
Y
1230/* = 1, order of constraints (IORDRE) is not within the */
1231/* autorized values. */
1232/* COMMONS USED : */
7fd59977 1233/* ---------------- */
1234
0d969553 1235/* REFERENCES CALLED : */
7fd59977 1236/* ----------------------- */
1237
0d969553 1238/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 1239/* ----------------------------------- */
0d969553 1240/* Canceled and replaced MMAPERR. */
7fd59977 1241/* ***********************************************************************
1242 */
1243
1244
1245 /* Parameter adjustments */
1246 --ycvmax;
1247 crvjac_dim1 = *ncofmx;
1248 crvjac_offset = crvjac_dim1 + 1;
1249 crvjac -= crvjac_offset;
1250
1251 /* Function Body */
1252 *iercod = 0;
0d969553 1253/* --> Order of Jacobi polynoms */
7fd59977 1254 jord = ( *iordre + 1) << 1;
1255
1256 if (jord == 0) {
1257 mmaper0_(ncofmx, ndimen, ncoeff, &crvjac[crvjac_offset], ncfnew, &
1258 ycvmax[1], errmax);
1259 } else if (jord == 2) {
1260 mmaper2_(ncofmx, ndimen, ncoeff, &crvjac[crvjac_offset], ncfnew, &
1261 ycvmax[1], errmax);
1262 } else if (jord == 4) {
1263 mmaper4_(ncofmx, ndimen, ncoeff, &crvjac[crvjac_offset], ncfnew, &
1264 ycvmax[1], errmax);
1265 } else if (jord == 6) {
1266 mmaper6_(ncofmx, ndimen, ncoeff, &crvjac[crvjac_offset], ncfnew, &
1267 ycvmax[1], errmax);
1268 } else {
1269 *iercod = 1;
1270 }
1271
1272/* ----------------------------------- Fin ------------------------------
1273*/
1274
1275 return 0;
1276} /* mmaperx_ */
1277
1278//=======================================================================
1279//function : mmarc41_
1280//purpose :
1281//=======================================================================
1282 int mmarc41_(integer *ndimax,
1283 integer *ndimen,
1284 integer *ncoeff,
1285 doublereal *crvold,
1286 doublereal *upara0,
1287 doublereal *upara1,
1288 doublereal *crvnew,
1289 integer *iercod)
1290
1291{
1292 /* System generated locals */
1293 integer crvold_dim1, crvold_offset, crvnew_dim1, crvnew_offset, i__1,
1294 i__2, i__3;
1295
1296 /* Local variables */
1ef32e96
RL
1297 integer nboct;
1298 doublereal tbaux[61];
1299 integer nd;
1300 doublereal bid;
1301 integer ncf, ncj;
7fd59977 1302
1303
1304/* IMPLICIT DOUBLE PRECISION(A-H,O-Z) */
1305/* IMPLICIT INTEGER (I-N) */
1306
1307/* ***********************************************************************
1308 */
1309
0d969553 1310/* FUNCTION : */
7fd59977 1311/* ---------- */
0d969553
Y
1312/* Creation of curve C2(v) defined on (0,1) identic to */
1313/* curve C1(u) defined on (U0,U1) (change of parameter */
1314/* of a curve). */
7fd59977 1315
0d969553 1316/* KEYWORDS : */
7fd59977 1317/* ----------- */
0d969553 1318/* LIMITATION, RESTRICTION, CURVE */
7fd59977 1319
0d969553 1320/* INPUT ARGUMENTS : */
7fd59977 1321/* ------------------ */
0d969553
Y
1322/* NDIMAX : Space Dimensioning. */
1323/* NDIMEN : Curve Dimension. */
1324/* NCOEFF : Nb of coefficients of the curve. */
1325/* CRVOLD : Curve to be limited. */
1326/* UPARA0 : Min limit of the interval limiting the curve.
7fd59977 1327*/
0d969553 1328/* UPARA1 : Max limit of the interval limiting the curve.
7fd59977 1329*/
1330
0d969553 1331/* OUTPUT ARGUMENTS : */
7fd59977 1332/* ------------------- */
0d969553
Y
1333/* CRVNEW : Relimited curve, defined on (0,1) and equal to */
1334/* CRVOLD defined on (U0,U1). */
7fd59977 1335/* IERCOD : = 0, OK */
0d969553 1336/* =10, Nb of coeff. <1 or > 61. */
7fd59977 1337
0d969553 1338/* COMMONS USED : */
7fd59977 1339/* ---------------- */
0d969553 1340/* REFERENCES CALLED : */
7fd59977 1341/* ---------------------- */
1342/* Type Name */
1343/* MAERMSG MCRFILL MVCVIN2 */
1344/* MVCVINV */
1345
0d969553 1346/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 1347/* ----------------------------------- */
0d969553
Y
1348/* ---> Algorithm used in this general case is based on the */
1349/* following principle : */
1350/* Let S(t) = a0 + a1*t + a2*t**2 + ... of degree NCOEFF-1, and */
1351/* U(t) = b0 + b1*t, then the coeff. of */
1352/* S(U(t)) are calculated step by step with help of table TBAUX. */
1353/* At each step number N (N=2 to NCOEFF), TBAUX(n) contains */
1354/* the n-th coefficient of U(t)**N for n=1 to N. (RBD) */
7fd59977 1355/* ---> Reference : KNUTH, 'The Art of Computer Programming', */
1356/* Vol. 2/'Seminumerical Algorithms', */
1357/* Ex. 11 p:451 et solution p:562. (RBD) */
1358
0d969553
Y
1359/* ---> Removal of the input argument CRVOLD by CRVNEW is */
1360/* possible, which means that the call : */
7fd59977 1361/* CALL MMARC41(NDIMAX,NDIMEN,NCOEFF,CURVE,UPARA0,UPARA1 */
1362/* ,CURVE,IERCOD) */
0d969553 1363/* is absolutely LEGAL. (RBD) */
7fd59977 1364
1365/* > */
1366/* **********************************************************************
1367*/
1368
0d969553 1369/* Name of the routine */
7fd59977 1370
0d969553
Y
1371/* Auxiliary table of coefficients of (UPARA1-UPARA0)T+UPARA0 */
1372/* with power N=1 to NCOEFF-1. */
7fd59977 1373
1374
1375 /* Parameter adjustments */
1376 crvnew_dim1 = *ndimax;
1377 crvnew_offset = crvnew_dim1 + 1;
1378 crvnew -= crvnew_offset;
1379 crvold_dim1 = *ndimax;
1380 crvold_offset = crvold_dim1 + 1;
1381 crvold -= crvold_offset;
1382
1383 /* Function Body */
1384 *iercod = 0;
1385/* **********************************************************************
1386*/
0d969553 1387/* CASE WHEN PROCESSING CAN'T BE DONE */
7fd59977 1388/* **********************************************************************
1389*/
1390 if (*ncoeff > 61 || *ncoeff < 1) {
1391 *iercod = 10;
1392 goto L9999;
1393 }
1394/* **********************************************************************
1395*/
0d969553 1396/* IF NO CHANGES */
7fd59977 1397/* **********************************************************************
1398*/
1399 if (*ndimen == *ndimax && *upara0 == 0. && *upara1 == 1.) {
1400 nboct = (*ndimax << 3) * *ncoeff;
fadcea2c
RL
1401 AdvApp2Var_SysBase::mcrfill_(&nboct,
1402 &crvold[crvold_offset],
1403 &crvnew[crvnew_offset]);
7fd59977 1404 goto L9999;
1405 }
1406/* **********************************************************************
1407*/
0d969553 1408/* INVERSION 3D : FAST PROCESSING */
7fd59977 1409/* **********************************************************************
1410*/
1411 if (*upara0 == 1. && *upara1 == 0.) {
1412 if (*ndimen == 3 && *ndimax == 3 && *ncoeff <= 21) {
1413 mvcvinv_(ncoeff, &crvold[crvold_offset], &crvnew[crvnew_offset],
1414 iercod);
1415 goto L9999;
1416 }
1417/* ******************************************************************
1418**** */
0d969553 1419/* INVERSION 2D : FAST PROCESSING */
7fd59977 1420/* ******************************************************************
1421**** */
1422 if (*ndimen == 2 && *ndimax == 2 && *ncoeff <= 21) {
1423 mvcvin2_(ncoeff, &crvold[crvold_offset], &crvnew[crvnew_offset],
1424 iercod);
1425 goto L9999;
1426 }
1427 }
1428/* **********************************************************************
1429*/
0d969553 1430/* GENERAL PROCESSING */
7fd59977 1431/* **********************************************************************
1432*/
0d969553 1433/* -------------------------- Initializations ---------------------------
7fd59977 1434*/
1435
1436 i__1 = *ndimen;
1437 for (nd = 1; nd <= i__1; ++nd) {
1438 crvnew[nd + crvnew_dim1] = crvold[nd + crvold_dim1];
1439/* L100: */
1440 }
1441 if (*ncoeff == 1) {
1442 goto L9999;
1443 }
1444 tbaux[0] = *upara0;
1445 tbaux[1] = *upara1 - *upara0;
1446
0d969553 1447/* ----------------------- Calculation of coeff. of CRVNEW ------------------
7fd59977 1448*/
1449
1450 i__1 = *ncoeff - 1;
1451 for (ncf = 2; ncf <= i__1; ++ncf) {
1452
0d969553 1453/* ------------ Take into account NCF-th coeff. of CRVOLD --------
7fd59977 1454---- */
1455
1456 i__2 = ncf - 1;
1457 for (ncj = 1; ncj <= i__2; ++ncj) {
1458 bid = tbaux[ncj - 1];
1459 i__3 = *ndimen;
1460 for (nd = 1; nd <= i__3; ++nd) {
1461 crvnew[nd + ncj * crvnew_dim1] += crvold[nd + ncf *
1462 crvold_dim1] * bid;
1463/* L400: */
1464 }
1465/* L300: */
1466 }
1467
1468 bid = tbaux[ncf - 1];
1469 i__2 = *ndimen;
1470 for (nd = 1; nd <= i__2; ++nd) {
1471 crvnew[nd + ncf * crvnew_dim1] = crvold[nd + ncf * crvold_dim1] *
1472 bid;
1473/* L500: */
1474 }
1475
0d969553 1476/* --------- Calculate (NCF+1) coeff. of ((U1-U0)*t + U0)**(NCF) ---
7fd59977 1477---- */
1478
1479 bid = *upara1 - *upara0;
1480 tbaux[ncf] = tbaux[ncf - 1] * bid;
1481 for (ncj = ncf; ncj >= 2; --ncj) {
1482 tbaux[ncj - 1] = tbaux[ncj - 1] * *upara0 + tbaux[ncj - 2] * bid;
1483/* L600: */
1484 }
1485 tbaux[0] *= *upara0;
1486
1487/* L200: */
1488 }
1489
0d969553 1490/* -------------- Take into account the last coeff. of CRVOLD -----------
7fd59977 1491*/
1492
1493 i__1 = *ncoeff - 1;
1494 for (ncj = 1; ncj <= i__1; ++ncj) {
1495 bid = tbaux[ncj - 1];
1496 i__2 = *ndimen;
1497 for (nd = 1; nd <= i__2; ++nd) {
1498 crvnew[nd + ncj * crvnew_dim1] += crvold[nd + *ncoeff *
1499 crvold_dim1] * bid;
1500/* L800: */
1501 }
1502/* L700: */
1503 }
1504 i__1 = *ndimen;
1505 for (nd = 1; nd <= i__1; ++nd) {
1506 crvnew[nd + *ncoeff * crvnew_dim1] = crvold[nd + *ncoeff *
1507 crvold_dim1] * tbaux[*ncoeff - 1];
1508/* L900: */
1509 }
1510
1511/* ---------------------------- The end ---------------------------------
1512*/
1513
1514L9999:
1515 if (*iercod != 0) {
1516 AdvApp2Var_SysBase::maermsg_("MMARC41", iercod, 7L);
1517 }
1518
1519 return 0 ;
1520} /* mmarc41_ */
1521
1522//=======================================================================
1523//function : AdvApp2Var_MathBase::mmarcin_
1524//purpose :
1525//=======================================================================
1526int AdvApp2Var_MathBase::mmarcin_(integer *ndimax,
1527 integer *ndim,
1528 integer *ncoeff,
1529 doublereal *crvold,
1530 doublereal *u0,
1531 doublereal *u1,
1532 doublereal *crvnew,
1533 integer *iercod)
1534
1535{
1536 /* System generated locals */
1537 integer crvold_dim1, crvold_offset, crvnew_dim1, crvnew_offset, i__1,
1538 i__2, i__3;
1539 doublereal d__1;
1540
1541 /* Local variables */
1ef32e96
RL
1542 doublereal x0, x1;
1543 integer nd;
1544 doublereal tabaux[61];
1545 integer ibb;
1546 doublereal bid;
1547 integer ncf;
1548 integer ncj;
1549 doublereal eps3;
7fd59977 1550
1551
1552
1553/* **********************************************************************
0d969553 1554*//* FUNCTION : */
7fd59977 1555/* ---------- */
0d969553
Y
1556/* Creation of curve C2(v) defined on [U0,U1] identic to */
1557/* curve C1(u) defined on [-1,1] (change of parameter */
1558/* of a curve) with INVERSION of indices of the resulting table. */
7fd59977 1559
0d969553 1560/* KEYWORDS : */
7fd59977 1561/* ----------- */
0d969553 1562/* GENERALIZED LIMITATION, RESTRICTION, INVERSION, CURVE */
7fd59977 1563
0d969553 1564/* INPUT ARGUMENTS : */
7fd59977 1565/* ------------------ */
0d969553
Y
1566/* NDIMAX : Maximum Space Dimensioning. */
1567/* NDIMEN : Curve Dimension. */
1568/* NCOEFF : Nb of coefficients of the curve. */
1569/* CRVOLD : Curve to be limited. */
1570/* U0 : Min limit of the interval limiting the curve.
1571*/
1572/* U1 : Max limit of the interval limiting the curve.
1573*/
1574
1575/* OUTPUT ARGUMENTS : */
7fd59977 1576/* ------------------- */
0d969553
Y
1577/* CRVNEW : Relimited curve, defined on [U0,U1] and equal to */
1578/* CRVOLD defined on [-1,1]. */
7fd59977 1579/* IERCOD : = 0, OK */
0d969553
Y
1580/* =10, Nb of coeff. <1 or > 61. */
1581/* =13, the requested interval of variation is null. */
1582/* COMMONS USED : */
7fd59977 1583/* ---------------- */
0d969553
Y
1584/* REFERENCES CALLED : */
1585/* ---------------------- */
1586/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 1587/* ----------------------------------- */
7fd59977 1588/* > */
1589/* **********************************************************************
1590*/
1591
0d969553 1592/* Name of the routine */
7fd59977 1593
0d969553
Y
1594/* Auxiliary table of coefficients of X1*T+X0 */
1595/* with power N=1 to NCOEFF-1. */
7fd59977 1596
1597
1598 /* Parameter adjustments */
1599 crvnew_dim1 = *ndimax;
1600 crvnew_offset = crvnew_dim1 + 1;
1601 crvnew -= crvnew_offset;
1602 crvold_dim1 = *ncoeff;
1603 crvold_offset = crvold_dim1 + 1;
1604 crvold -= crvold_offset;
1605
1606 /* Function Body */
1607 ibb = AdvApp2Var_SysBase::mnfndeb_();
1608 if (ibb >= 2) {
1609 AdvApp2Var_SysBase::mgenmsg_("MMARCIN", 7L);
1610 }
1611
0d969553 1612/* At zero machine it is tested if the output interval is not null */
7fd59977 1613
1614 AdvApp2Var_MathBase::mmveps3_(&eps3);
41194117 1615 if ((d__1 = *u1 - *u0, advapp_abs(d__1)) < eps3) {
7fd59977 1616 *iercod = 13;
1617 goto L9999;
1618 }
1619 *iercod = 0;
1620
1621/* **********************************************************************
1622*/
0d969553 1623/* CASE WHEN THE PROCESSING IS IMPOSSIBLE */
7fd59977 1624/* **********************************************************************
1625*/
1626 if (*ncoeff > 61 || *ncoeff < 1) {
1627 *iercod = 10;
1628 goto L9999;
1629 }
1630/* **********************************************************************
1631*/
0d969553
Y
1632/* IF NO CHANGE OF THE INTERVAL OF DEFINITION */
1633/* (ONLY INVERSION OF INDICES OF TABLE CRVOLD) */
7fd59977 1634/* **********************************************************************
1635*/
1636 if (*ndim == *ndimax && *u0 == -1. && *u1 == 1.) {
1637 AdvApp2Var_MathBase::mmcvinv_(ndim, ncoeff, ndim, &crvold[crvold_offset], &crvnew[
1638 crvnew_offset]);
1639 goto L9999;
1640 }
1641/* **********************************************************************
1642*/
0d969553 1643/* CASE WHEN THE NEW INTERVAL OF DEFINITION IS [0,1] */
7fd59977 1644/* **********************************************************************
1645*/
1646 if (*u0 == 0. && *u1 == 1.) {
1647 mmcvstd_(ncoeff, ndimax, ncoeff, ndim, &crvold[crvold_offset], &
1648 crvnew[crvnew_offset]);
1649 goto L9999;
1650 }
1651/* **********************************************************************
1652*/
0d969553 1653/* GENERAL PROCESSING */
7fd59977 1654/* **********************************************************************
1655*/
0d969553 1656/* -------------------------- Initialization ---------------------------
7fd59977 1657*/
1658
1659 x0 = -(*u1 + *u0) / (*u1 - *u0);
1660 x1 = 2. / (*u1 - *u0);
1661 i__1 = *ndim;
1662 for (nd = 1; nd <= i__1; ++nd) {
1663 crvnew[nd + crvnew_dim1] = crvold[nd * crvold_dim1 + 1];
1664/* L100: */
1665 }
1666 if (*ncoeff == 1) {
1667 goto L9999;
1668 }
1669 tabaux[0] = x0;
1670 tabaux[1] = x1;
1671
0d969553 1672/* ----------------------- Calculation of coeff. of CRVNEW ------------------
7fd59977 1673*/
1674
1675 i__1 = *ncoeff - 1;
1676 for (ncf = 2; ncf <= i__1; ++ncf) {
1677
0d969553 1678/* ------------ Take into account the NCF-th coeff. of CRVOLD --------
7fd59977 1679---- */
1680
1681 i__2 = ncf - 1;
1682 for (ncj = 1; ncj <= i__2; ++ncj) {
1683 bid = tabaux[ncj - 1];
1684 i__3 = *ndim;
1685 for (nd = 1; nd <= i__3; ++nd) {
1686 crvnew[nd + ncj * crvnew_dim1] += crvold[ncf + nd *
1687 crvold_dim1] * bid;
1688/* L400: */
1689 }
1690/* L300: */
1691 }
1692
1693 bid = tabaux[ncf - 1];
1694 i__2 = *ndim;
1695 for (nd = 1; nd <= i__2; ++nd) {
1696 crvnew[nd + ncf * crvnew_dim1] = crvold[ncf + nd * crvold_dim1] *
1697 bid;
1698/* L500: */
1699 }
1700
0d969553 1701/* --------- Calculation of (NCF+1) coeff. of [X1*t + X0]**(NCF) --------
7fd59977 1702---- */
1703
1704 tabaux[ncf] = tabaux[ncf - 1] * x1;
1705 for (ncj = ncf; ncj >= 2; --ncj) {
1706 tabaux[ncj - 1] = tabaux[ncj - 1] * x0 + tabaux[ncj - 2] * x1;
1707/* L600: */
1708 }
1709 tabaux[0] *= x0;
1710
1711/* L200: */
1712 }
1713
0d969553 1714/* -------------- Take into account the last coeff. of CRVOLD -----------
7fd59977 1715*/
1716
1717 i__1 = *ncoeff - 1;
1718 for (ncj = 1; ncj <= i__1; ++ncj) {
1719 bid = tabaux[ncj - 1];
1720 i__2 = *ndim;
1721 for (nd = 1; nd <= i__2; ++nd) {
1722 crvnew[nd + ncj * crvnew_dim1] += crvold[*ncoeff + nd *
1723 crvold_dim1] * bid;
1724/* L800: */
1725 }
1726/* L700: */
1727 }
1728 i__1 = *ndim;
1729 for (nd = 1; nd <= i__1; ++nd) {
1730 crvnew[nd + *ncoeff * crvnew_dim1] = crvold[*ncoeff + nd *
1731 crvold_dim1] * tabaux[*ncoeff - 1];
1732/* L900: */
1733 }
1734
1735/* ---------------------------- The end ---------------------------------
1736*/
1737
1738L9999:
1739 if (*iercod > 0) {
1740 AdvApp2Var_SysBase::maermsg_("MMARCIN", iercod, 7L);
1741 }
1742 if (ibb >= 2) {
1743 AdvApp2Var_SysBase::mgsomsg_("MMARCIN", 7L);
1744 }
1745 return 0;
1746} /* mmarcin_ */
1747
1748//=======================================================================
1749//function : mmatvec_
1750//purpose :
1751//=======================================================================
1752int mmatvec_(integer *nligne,
1753 integer *,//ncolon,
1754 integer *gposit,
1755 integer *,//gnstoc,
1756 doublereal *gmatri,
1757 doublereal *vecin,
1758 integer *deblig,
1759 doublereal *vecout,
1760 integer *iercod)
1761
1762{
1763 /* System generated locals */
1764 integer i__1, i__2;
1765
1766 /* Local variables */
1ef32e96
RL
1767 logical ldbg;
1768 integer jmin, jmax, i__, j, k;
1769 doublereal somme;
1770 integer aux;
7fd59977 1771
1772
1773/* ***********************************************************************
1774 */
1775
0d969553 1776/* FUNCTION : */
7fd59977 1777/* ---------- */
0d969553 1778/* Produce vector matrix in form of profile */
7fd59977 1779
1780
1781/* MOTS CLES : */
1782/* ----------- */
0d969553 1783/* RESERVE, MATRIX, PRODUCT, VECTOR, PROFILE */
7fd59977 1784
0d969553 1785/* INPUT ARGUMENTS : */
7fd59977 1786/* -------------------- */
0d969553
Y
1787/* NLIGNE : Line number of the matrix of constraints */
1788/* NCOLON : Number of column of the matrix of constraints */
1789/* GNSTOC: Number of coefficients in the profile of matrix GMATRI */
1790
1791/* GPOSIT: Table of positioning of terms of storage */
258ff83b 1792/* GPOSIT(1,I) contains the number of terms-1 on the line I */
0d969553
Y
1793/* in the profile of the matrix. */
1794/* GPOSIT(2,I) contains the index of storage of diagonal term*/
1795/* of line I */
1796/* GPOSIT(3,I) contains the index of column of the first term of */
1797/* profile of line I */
1798/* GNSTOC: Number of coefficients in the profile of matrix */
7fd59977 1799/* GMATRI */
0d969553
Y
1800/* GMATRI : Matrix of constraints in form of profile */
1801/* VECIN : Input vector */
1802/* DEBLIG : Line indexusing which the vector matrix is calculated */
258ff83b 1803/**/
0d969553 1804/* OUTPUT ARGUMENTS */
7fd59977 1805/* --------------------- */
0d969553 1806/* VECOUT : VECTOR PRODUCT */
7fd59977 1807
0d969553 1808/* IERCOD : ERROR CODE */
7fd59977 1809
1810
0d969553 1811/* COMMONS USED : */
7fd59977 1812/* ------------------ */
1813
1814
0d969553 1815/* REFERENCES CALLED : */
7fd59977 1816/* --------------------- */
1817
1818
0d969553 1819/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 1820/* ----------------------------------- */
1821
7fd59977 1822/* ***********************************************************************
1823 */
1824/* DECLARATIONS */
1825/* ***********************************************************************
1826 */
1827
1828
1829
1830/* ***********************************************************************
1831 */
1832/* INITIALISATIONS */
1833/* ***********************************************************************
1834 */
1835
1836 /* Parameter adjustments */
1837 --vecout;
1838 gposit -= 4;
1839 --vecin;
1840 --gmatri;
1841
1842 /* Function Body */
1843 ldbg = AdvApp2Var_SysBase::mnfndeb_() >= 2;
1844 if (ldbg) {
1845 AdvApp2Var_SysBase::mgenmsg_("MMATVEC", 7L);
1846 }
1847 *iercod = 0;
1848
1849/* ***********************************************************************
1850 */
0d969553 1851/* Processing */
7fd59977 1852/* ***********************************************************************
1853 */
fadcea2c
RL
1854 AdvApp2Var_SysBase::mvriraz_(nligne,
1855 &vecout[1]);
7fd59977 1856 i__1 = *nligne;
1857 for (i__ = *deblig; i__ <= i__1; ++i__) {
1858 somme = 0.;
1859 jmin = gposit[i__ * 3 + 3];
1860 jmax = gposit[i__ * 3 + 1] + gposit[i__ * 3 + 3] - 1;
1861 aux = gposit[i__ * 3 + 2] - gposit[i__ * 3 + 1] - jmin + 1;
1862 i__2 = jmax;
1863 for (j = jmin; j <= i__2; ++j) {
1864 k = j + aux;
1865 somme += gmatri[k] * vecin[j];
1866 }
1867 vecout[i__] = somme;
1868 }
1869
1870
1871
1872
1873
1874 goto L9999;
1875
1876/* ***********************************************************************
1877 */
0d969553 1878/* ERROR PROCESSING */
7fd59977 1879/* ***********************************************************************
1880 */
1881
1882
1883
1884
1885/* ***********************************************************************
1886 */
0d969553 1887/* RETURN CALLING PROGRAM */
7fd59977 1888/* ***********************************************************************
1889 */
1890
1891L9999:
1892
1893/* ___ DESALLOCATION, ... */
1894
1895 AdvApp2Var_SysBase::maermsg_("MMATVEC", iercod, 7L);
1896 if (ldbg) {
1897 AdvApp2Var_SysBase::mgsomsg_("MMATVEC", 7L);
1898 }
1899
1900 return 0 ;
1901} /* mmatvec_ */
1902
1903//=======================================================================
1904//function : mmbulld_
1905//purpose :
1906//=======================================================================
1907int AdvApp2Var_MathBase::mmbulld_(integer *nbcoln,
1908 integer *nblign,
1909 doublereal *dtabtr,
1910 integer *numcle)
1911
1912{
1913 /* System generated locals */
1914 integer dtabtr_dim1, dtabtr_offset, i__1, i__2;
1915
1916 /* Local variables */
1ef32e96
RL
1917 logical ldbg;
1918 doublereal daux;
1919 integer nite1, nite2, nchan, i1, i2;
7fd59977 1920
1921/* ***********************************************************************
1922 */
1923
0d969553 1924/* FUNCTION : */
7fd59977 1925/* ---------- */
0d969553
Y
1926/* Parsing of columns of a table of integers in increasing order */
1927/* KEYWORDS : */
7fd59977 1928/* ----------- */
0d969553
Y
1929/* POINT-ENTRY, PARSING */
1930/* INPUT ARGUMENTS : */
7fd59977 1931/* -------------------- */
0d969553
Y
1932/* - NBCOLN : Number of columns in the table */
1933/* - NBLIGN : Number of lines in the table */
1934/* - DTABTR : Table of integers to be parsed */
1935/* - NUMCLE : Position of the key on the column */
7fd59977 1936
0d969553 1937/* OUTPUT ARGUMENTS : */
7fd59977 1938/* --------------------- */
0d969553 1939/* - DTABTR : Parsed table */
7fd59977 1940
0d969553 1941/* COMMONS USED : */
7fd59977 1942/* ------------------ */
1943
1944
0d969553 1945/* REFERENCES CALLED : */
7fd59977 1946/* --------------------- */
1947
1948
0d969553 1949/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 1950/* ----------------------------------- */
0d969553
Y
1951/* Particularly performant if the table is almost parsed */
1952/* In the opposite case it is better to use MVSHELD */
7fd59977 1953/* ***********************************************************************
1954 */
1955
1956 /* Parameter adjustments */
1957 dtabtr_dim1 = *nblign;
1958 dtabtr_offset = dtabtr_dim1 + 1;
1959 dtabtr -= dtabtr_offset;
1960
1961 /* Function Body */
1962 ldbg = AdvApp2Var_SysBase::mnfndeb_() >= 2;
1963 if (ldbg) {
1964 AdvApp2Var_SysBase::mgenmsg_("MMBULLD", 7L);
1965 }
1966 nchan = 1;
1967 nite1 = *nbcoln;
1968 nite2 = 2;
1969
1970/* ***********************************************************************
1971 */
0d969553 1972/* PROCESSING */
7fd59977 1973/* ***********************************************************************
1974 */
1975
0d969553 1976/* ---->ALGORITHM in N^2 / 2 additional iteration */
7fd59977 1977
1978 while(nchan != 0) {
1979
0d969553 1980/* ----> Parsing from left to the right */
7fd59977 1981
1982 nchan = 0;
1983 i__1 = nite1;
1984 for (i1 = nite2; i1 <= i__1; ++i1) {
1985 if (dtabtr[*numcle + i1 * dtabtr_dim1] < dtabtr[*numcle + (i1 - 1)
1986 * dtabtr_dim1]) {
1987 i__2 = *nblign;
1988 for (i2 = 1; i2 <= i__2; ++i2) {
1989 daux = dtabtr[i2 + (i1 - 1) * dtabtr_dim1];
1990 dtabtr[i2 + (i1 - 1) * dtabtr_dim1] = dtabtr[i2 + i1 *
1991 dtabtr_dim1];
1992 dtabtr[i2 + i1 * dtabtr_dim1] = daux;
1993 }
1994 if (nchan == 0) {
1995 nchan = 1;
1996 }
1997 }
1998 }
1999 --nite1;
2000
0d969553 2001/* ----> Parsing from right to the left */
7fd59977 2002
2003 if (nchan != 0) {
2004 nchan = 0;
2005 i__1 = nite2;
2006 for (i1 = nite1; i1 >= i__1; --i1) {
2007 if (dtabtr[*numcle + i1 * dtabtr_dim1] < dtabtr[*numcle + (i1
2008 - 1) * dtabtr_dim1]) {
2009 i__2 = *nblign;
2010 for (i2 = 1; i2 <= i__2; ++i2) {
2011 daux = dtabtr[i2 + (i1 - 1) * dtabtr_dim1];
2012 dtabtr[i2 + (i1 - 1) * dtabtr_dim1] = dtabtr[i2 + i1 *
2013 dtabtr_dim1];
2014 dtabtr[i2 + i1 * dtabtr_dim1] = daux;
2015 }
2016 if (nchan == 0) {
2017 nchan = 1;
2018 }
2019 }
2020 }
2021 ++nite2;
2022 }
2023 }
2024
2025
2026 goto L9999;
2027
2028/* ***********************************************************************
2029 */
0d969553 2030/* ERROR PROCESSING */
7fd59977 2031/* ***********************************************************************
2032 */
2033
0d969553 2034/* ----> No errors at calling functions, only tests and loops. */
7fd59977 2035
2036/* ***********************************************************************
2037 */
0d969553 2038/* RETURN CALLING PROGRAM */
7fd59977 2039/* ***********************************************************************
2040 */
2041
2042L9999:
2043
2044 if (ldbg) {
2045 AdvApp2Var_SysBase::mgsomsg_("MMBULLD", 7L);
2046 }
2047
2048 return 0 ;
2049} /* mmbulld_ */
2050
2051
2052//=======================================================================
2053//function : AdvApp2Var_MathBase::mmcdriv_
2054//purpose :
2055//=======================================================================
2056int AdvApp2Var_MathBase::mmcdriv_(integer *ndimen,
2057 integer *ncoeff,
2058 doublereal *courbe,
2059 integer *ideriv,
2060 integer *ncofdv,
2061 doublereal *crvdrv)
2062
2063
2064{
2065 /* System generated locals */
2066 integer courbe_dim1, courbe_offset, crvdrv_dim1, crvdrv_offset, i__1,
2067 i__2;
2068
2069 /* Local variables */
1ef32e96
RL
2070 integer i__, j, k;
2071 doublereal mfactk, bid;
7fd59977 2072
2073
2074/* ***********************************************************************
2075 */
2076
0d969553 2077/* FUNCTION : */
7fd59977 2078/* ---------- */
0d969553
Y
2079/* Calculate matrix of a derivate curve of order IDERIV. */
2080/* with input parameters other than output parameters. */
7fd59977 2081
2082
0d969553 2083/* KEYWORDS : */
7fd59977 2084/* ----------- */
0d969553 2085/* COEFFICIENTS,CURVE,DERIVATE I-EME. */
7fd59977 2086
0d969553 2087/* INPUT ARGUMENTS : */
7fd59977 2088/* ------------------ */
0d969553
Y
2089/* NDIMEN : Space dimension (2 or 3 in general) */
2090/* NCOEFF : Degree +1 of the curve. */
2091/* COURBE : Table of coefficients of the curve. */
2092/* IDERIV : Required order of derivation : 1=1st derivate, etc... */
7fd59977 2093
0d969553 2094/* OUTPUT ARGUMENTS : */
7fd59977 2095/* ------------------- */
0d969553
Y
2096/* NCOFDV : Degree +1 of the derivative of order IDERIV of the curve. */
2097/* CRVDRV : Table of coefficients of the derivative of order IDERIV */
2098/* of the curve. */
7fd59977 2099
0d969553 2100/* COMMONS USED : */
7fd59977 2101/* ---------------- */
2102
0d969553 2103/* REFERENCES CALLED : */
7fd59977 2104/* ----------------------- */
2105
0d969553 2106/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 2107/* ----------------------------------- */
2108
0d969553
Y
2109/* ---> It is possible to take as output argument the curve */
2110/* and the number of coeff passed at input by making : */
7fd59977 2111/* CALL MMCDRIV(NDIMEN,NCOEFF,COURBE,IDERIV,NCOEFF,COURBE). */
0d969553
Y
2112/* After this call, NCOEFF does the number of coeff of the derived */
2113/* curve the coefficients which of are stored in CURVE. */
2114/* Attention to the coefficients of CURVE of rank superior to */
2115/* NCOEFF : they are not set to zero. */
7fd59977 2116
0d969553
Y
2117/* ---> Algorithm : */
2118/* The code below was written basing on the following algorithm:
7fd59977 2119*/
2120
0d969553
Y
2121/* Let P(t) = a1 + a2*t + ... an*t**n. Derivate of order k of P */
2122/* (containing n-k coefficients) is calculated as follows : */
7fd59977 2123
2124/* Pk(t) = a(k+1)*CNP(k,k)*k! */
2125/* + a(k+2)*CNP(k+1,k)*k! * t */
2126/* . */
2127/* . */
2128/* . */
2129/* + a(n)*CNP(n-1,k)*k! * t**(n-k-1). */
7fd59977 2130/* ***********************************************************************
2131 */
2132
2133
0d969553 2134/* -------------- Case when the order of derivative is -------------------
7fd59977 2135*/
0d969553 2136/* ---------------- greater than the degree of the curve ---------------------
7fd59977 2137*/
2138
2139/* **********************************************************************
2140*/
2141
0d969553 2142/* FUNCTION : */
7fd59977 2143/* ---------- */
0d969553 2144/* Serves to provide the coefficients of binome (Pascal's triangle). */
7fd59977 2145
0d969553 2146/* KEYWORDS : */
7fd59977 2147/* ----------- */
0d969553 2148/* Binomial coeff from 0 to 60. read only . init par block data */
7fd59977 2149
0d969553 2150/* DEMSCRIPTION/NOTES/LIMITATIONS : */
7fd59977 2151/* ----------------------------------- */
0d969553
Y
2152/* Binomial coefficients form a triangular matrix. */
2153/* This matrix is completed in table CNP by its transposition. */
2154/* So: CNP(I,J) = CNP(J,I) for I and J = 0, ..., 60. */
7fd59977 2155
0d969553
Y
2156/* Initialization is done by block-data MMLLL09.RES, */
2157/* created by program MQINICNP.FOR). */
7fd59977 2158/* **********************************************************************
2159*/
2160
2161
2162
2163/* ***********************************************************************
2164 */
2165
2166 /* Parameter adjustments */
2167 crvdrv_dim1 = *ndimen;
2168 crvdrv_offset = crvdrv_dim1 + 1;
2169 crvdrv -= crvdrv_offset;
2170 courbe_dim1 = *ndimen;
2171 courbe_offset = courbe_dim1 + 1;
2172 courbe -= courbe_offset;
2173
2174 /* Function Body */
2175 if (*ideriv >= *ncoeff) {
2176 i__1 = *ndimen;
2177 for (i__ = 1; i__ <= i__1; ++i__) {
2178 crvdrv[i__ + crvdrv_dim1] = 0.;
2179/* L10: */
2180 }
2181 *ncofdv = 1;
2182 goto L9999;
2183 }
2184/* **********************************************************************
2185*/
0d969553 2186/* General processing */
7fd59977 2187/* **********************************************************************
2188*/
0d969553 2189/* --------------------- Calculation of Factorial(IDERIV) ------------------
7fd59977 2190*/
2191
2192 k = *ideriv;
2193 mfactk = 1.;
2194 i__1 = k;
2195 for (i__ = 2; i__ <= i__1; ++i__) {
2196 mfactk *= i__;
2197/* L50: */
2198 }
2199
0d969553 2200/* ------------ Calculation of coeff of the derived of order IDERIV ----------
7fd59977 2201*/
0d969553
Y
2202/* ---> Attention : coefficient binomial C(n,m) is represented in */
2203/* MCCNP by CNP(N+1,M+1). */
7fd59977 2204
2205 i__1 = *ncoeff;
2206 for (j = k + 1; j <= i__1; ++j) {
2207 bid = mmcmcnp_.cnp[j - 1 + k * 61] * mfactk;
2208 i__2 = *ndimen;
2209 for (i__ = 1; i__ <= i__2; ++i__) {
2210 crvdrv[i__ + (j - k) * crvdrv_dim1] = bid * courbe[i__ + j *
2211 courbe_dim1];
2212/* L200: */
2213 }
2214/* L100: */
2215 }
2216
2217 *ncofdv = *ncoeff - *ideriv;
2218
2219/* -------------------------------- The end -----------------------------
2220*/
2221
2222L9999:
2223 return 0;
2224} /* mmcdriv_ */
2225
2226//=======================================================================
2227//function : AdvApp2Var_MathBase::mmcglc1_
2228//purpose :
2229//=======================================================================
2230int AdvApp2Var_MathBase::mmcglc1_(integer *ndimax,
2231 integer *ndimen,
2232 integer *ncoeff,
2233 doublereal *courbe,
2234 doublereal *tdebut,
2235 doublereal *tfinal,
2236 doublereal *epsiln,
2237 doublereal *xlongc,
2238 doublereal *erreur,
2239 integer *iercod)
2240
2241
2242{
2243 /* System generated locals */
2244 integer courbe_dim1, courbe_offset, i__1;
2245 doublereal d__1;
2246
2247 /* Local variables */
1ef32e96
RL
2248 integer ndec;
2249 doublereal tdeb, tfin;
2250 integer iter;
1d47d8d0 2251 doublereal oldso = 0.;
1ef32e96
RL
2252 integer itmax;
2253 doublereal sottc;
2254 integer kk, ibb;
2255 doublereal dif, pas;
2256 doublereal som;
7fd59977 2257
2258
2259/* ***********************************************************************
2260 */
2261
0d969553 2262/* FUNCTION : */
7fd59977 2263/* ---------- */
0d969553
Y
2264/* Allows calculating the length of an arc of curve POLYNOMIAL */
2265/* on an interval [A,B]. */
7fd59977 2266
0d969553 2267/* KEYWORDS : */
7fd59977 2268/* ----------- */
0d969553 2269/* LENGTH,CURVE,GAUSS,PRIVATE. */
7fd59977 2270
0d969553 2271/* INPUT ARGUMENTS : */
7fd59977 2272/* ------------------ */
0d969553
Y
2273/* NDIMAX : Max. number of lines of tables */
2274/* (i.e. max. nb of polynoms). */
2275/* NDIMEN : Dimension of the space (nb of polynoms). */
2276/* NCOEFF : Nb of coefficients of the polynom. This is degree + 1.
2277*/
2278/* COURBE(NDIMAX,NCOEFF) : Coefficients of the curve. */
2279/* TDEBUT : Lower limit of the interval of integration for */
2280/* length calculation. */
2281/* TFINAL : Upper limit of the interval of integration for */
2282/* length calculation. */
2283/* EPSILN : REQIRED precision for length calculation. */
2284
2285/* OUTPUT ARGUMENTS : */
7fd59977 2286/* ------------------- */
0d969553
Y
2287/* XLONGC : Length of the arc of curve */
2288/* ERREUR : Precision OBTAINED for the length calculation. */
2289/* IERCOD : Error code, 0 OK, >0 Serious error. */
2290/* = 1 Too much iterations, the best calculated resultat */
2291/* (is almost ERROR) */
2292/* = 2 Pb MMLONCV (no result) */
2293/* = 3 NDIM or NCOEFF invalid (no result) */
2294
2295/* COMMONS USED : */
7fd59977 2296/* ---------------- */
2297
0d969553 2298/* REFERENCES CALLED : */
7fd59977 2299/* ----------------------- */
2300
0d969553 2301/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 2302/* ----------------------------------- */
0d969553
Y
2303/* The polynom is actually a set of polynoms with */
2304/* coefficients arranged in a table of 2 indices, */
2305/* each line relative to the polynom. */
2306/* The polynom is defined by these coefficients ordered */
2307/* by increasing power of the variable. */
2308/* All polynoms have the same number of coefficients (the */
2309/* same degree). */
2310
2311/* This program cancels and replaces LENGCV, MLONGC and MLENCV. */
2312
2313/* ATTENTION : if TDEBUT > TFINAL, the length is NEGATIVE. */
2314
7fd59977 2315/* > */
2316/* ***********************************************************************
2317 */
2318
0d969553 2319/* Name of the routine */
7fd59977 2320
2321
0d969553 2322/* ------------------------ General Initialization ---------------------
7fd59977 2323*/
2324
2325 /* Parameter adjustments */
2326 courbe_dim1 = *ndimax;
2327 courbe_offset = courbe_dim1 + 1;
2328 courbe -= courbe_offset;
2329
2330 /* Function Body */
2331 ibb = AdvApp2Var_SysBase::mnfndeb_();
2332 if (ibb >= 2) {
2333 AdvApp2Var_SysBase::mgenmsg_("MMCGLC1", 7L);
2334 }
2335
2336 *iercod = 0;
2337 *xlongc = 0.;
2338 *erreur = 0.;
2339
0d969553 2340/* ------ Test of equity of limits */
7fd59977 2341
2342 if (*tdebut == *tfinal) {
2343 *iercod = 0;
2344 goto L9999;
2345 }
2346
0d969553 2347/* ------ Test of the dimension and the number of coefficients */
7fd59977 2348
2349 if (*ndimen <= 0 || *ncoeff <= 0) {
2350 goto L9003;
2351 }
2352
0d969553
Y
2353/* ----- Nb of current cutting, nb of iteration, */
2354/* max nb of iterations */
7fd59977 2355
2356 ndec = 1;
2357 iter = 1;
2358
7fd59977 2359 itmax = 13;
2360
0d969553
Y
2361/* ------ Variation of the nb of intervals */
2362/* Multiplied by 2 at each iteration */
7fd59977 2363
2364L5000:
2365 pas = (*tfinal - *tdebut) / ndec;
2366 sottc = 0.;
2367
0d969553 2368/* ------ Loop on all current NDEC intervals */
7fd59977 2369
2370 i__1 = ndec;
2371 for (kk = 1; kk <= i__1; ++kk) {
2372
0d969553 2373/* ------ Limits of the current integration interval */
7fd59977 2374
2375 tdeb = *tdebut + (kk - 1) * pas;
2376 tfin = tdeb + pas;
2377 mmloncv_(ndimax, ndimen, ncoeff, &courbe[courbe_offset], &tdeb, &tfin,
2378 &som, iercod);
2379 if (*iercod > 0) {
2380 goto L9002;
2381 }
2382
2383 sottc += som;
2384
2385/* L100: */
2386 }
2387
2388
0d969553 2389/* ----------------- Test of the maximum number of iterations ------------
7fd59977 2390*/
2391
0d969553 2392/* Test if passes at least once ** */
7fd59977 2393
2394 if (iter == 1) {
2395 oldso = sottc;
2396 ndec <<= 1;
2397 ++iter;
2398 goto L5000;
2399 } else {
2400
0d969553 2401/* ------ Take into account DIF - Test of convergence */
7fd59977 2402
2403 ++iter;
41194117 2404 dif = (d__1 = sottc - oldso, advapp_abs(d__1));
7fd59977 2405
0d969553 2406/* ------ If DIF is OK, leave..., otherwise: */
7fd59977 2407
2408 if (dif > *epsiln) {
2409
0d969553 2410/* ------ If nb iteration exceeded, leave */
7fd59977 2411
2412 if (iter > itmax) {
2413 *iercod = 1;
2414 goto L9000;
2415 } else {
2416
0d969553 2417/* ------ Otherwise continue by cutting the initial interval.
7fd59977 2418 */
2419
2420 oldso = sottc;
2421 ndec <<= 1;
2422 goto L5000;
2423 }
2424 }
2425 }
2426
2427/* ------------------------------ THE END -------------------------------
2428*/
2429
2430L9000:
2431 *xlongc = sottc;
2432 *erreur = dif;
2433 goto L9999;
2434
0d969553 2435/* ---> PB in MMLONCV */
7fd59977 2436
2437L9002:
2438 *iercod = 2;
2439 goto L9999;
2440
0d969553 2441/* ---> NCOEFF or NDIM invalid. */
7fd59977 2442
2443L9003:
2444 *iercod = 3;
2445 goto L9999;
2446
2447L9999:
2448 if (*iercod > 0) {
2449 AdvApp2Var_SysBase::maermsg_("MMCGLC1", iercod, 7L);
2450 }
2451 if (ibb >= 2) {
2452 AdvApp2Var_SysBase::mgsomsg_("MMCGLC1", 7L);
2453 }
2454 return 0;
2455} /* mmcglc1_ */
2456
2457//=======================================================================
2458//function : mmchole_
2459//purpose :
2460//=======================================================================
2461int mmchole_(integer *,//mxcoef,
2462 integer *dimens,
2463 doublereal *amatri,
2464 integer *aposit,
2465 integer *posuiv,
2466 doublereal *chomat,
2467 integer *iercod)
2468
2469{
2470 /* System generated locals */
2471 integer i__1, i__2, i__3;
2472 doublereal d__1;
2473
2474 /* Builtin functions */
2475 //double sqrt();
2476
2477 /* Local variables */
1ef32e96
RL
2478 logical ldbg;
2479 integer kmin, i__, j, k;
2480 doublereal somme;
2481 integer ptini, ptcou;
7fd59977 2482
2483
2484/* ***********************************************************************
2485 */
2486
0d969553 2487/* FUNCTION : */
7fd59977 2488/* ---------- T */
0d969553
Y
2489/* Produce decomposition of choleski of matrix A in S.S */
2490/* Calculate inferior triangular matrix S. */
7fd59977 2491
0d969553 2492/* KEYWORDS : */
7fd59977 2493/* ----------- */
0d969553 2494/* RESOLUTION, MFACTORISATION, MATRIX_PROFILE, CHOLESKI */
7fd59977 2495
0d969553 2496/* INPUT ARGUMENTS : */
7fd59977 2497/* -------------------- */
0d969553
Y
2498/* MXCOEF : Max number of terms in the hessian profile */
2499/* DIMENS : Dimension of the problem */
2500/* AMATRI(MXCOEF) : Coefficients of the matrix profile */
2501/* APOSIT(1,*) : Distance diagonal-left extremity of the line
7fd59977 2502*/
0d969553
Y
2503/* APOSIT(2,*) : Position of diagonal terms in HESSIE */
2504/* POSUIV(MXCOEF) : first line inferior not out of profile */
7fd59977 2505
0d969553 2506/* OUTPUT ARGUMENTS : */
7fd59977 2507/* --------------------- */
0d969553
Y
2508/* CHOMAT(MXCOEF) : Inferior triangular matrix preserving the */
2509/* profile of AMATRI. */
2510/* IERCOD : error code */
7fd59977 2511/* = 0 : ok */
0d969553 2512/* = 1 : non-defined positive matrix */
7fd59977 2513
0d969553 2514/* COMMONS USED : */
7fd59977 2515/* ------------------ */
2516
2517/* .Neant. */
2518
0d969553 2519/* REFERENCES CALLED : */
7fd59977 2520/* ---------------------- */
2521
0d969553 2522/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 2523/* ----------------------------------- */
0d969553 2524/* DEBUG LEVEL = 4 */
7fd59977 2525/* ***********************************************************************
2526 */
2527/* DECLARATIONS */
2528/* ***********************************************************************
2529 */
2530
2531
2532
2533/* ***********************************************************************
2534 */
2535/* INITIALISATIONS */
2536/* ***********************************************************************
2537 */
2538
2539 /* Parameter adjustments */
2540 --chomat;
2541 --posuiv;
2542 --amatri;
2543 aposit -= 3;
2544
2545 /* Function Body */
2546 ldbg = AdvApp2Var_SysBase::mnfndeb_() >= 4;
2547 if (ldbg) {
2548 AdvApp2Var_SysBase::mgenmsg_("MMCHOLE", 7L);
2549 }
2550 *iercod = 0;
2551
2552/* ***********************************************************************
2553 */
0d969553 2554/* PROCESSING */
7fd59977 2555/* ***********************************************************************
2556 */
2557
2558 i__1 = *dimens;
2559 for (j = 1; j <= i__1; ++j) {
2560
2561 ptini = aposit[(j << 1) + 2];
2562
2563 somme = 0.;
2564 i__2 = ptini - 1;
2565 for (k = ptini - aposit[(j << 1) + 1]; k <= i__2; ++k) {
2566/* Computing 2nd power */
2567 d__1 = chomat[k];
2568 somme += d__1 * d__1;
2569 }
2570
2571 if (amatri[ptini] - somme < 1e-32) {
2572 goto L9101;
2573 }
2574 chomat[ptini] = sqrt(amatri[ptini] - somme);
2575
2576 ptcou = ptini;
2577
2578 while(posuiv[ptcou] > 0) {
2579
2580 i__ = posuiv[ptcou];
2581 ptcou = aposit[(i__ << 1) + 2] - (i__ - j);
2582
0d969553 2583/* Calculate the sum of S .S for k =1 a j-1 */
7fd59977 2584/* ik jk */
2585 somme = 0.;
2586/* Computing MAX */
2587 i__2 = i__ - aposit[(i__ << 1) + 1], i__3 = j - aposit[(j << 1) +
2588 1];
41194117 2589 kmin = advapp_max(i__2,i__3);
7fd59977 2590 i__2 = j - 1;
2591 for (k = kmin; k <= i__2; ++k) {
2592 somme += chomat[aposit[(i__ << 1) + 2] - (i__ - k)] * chomat[
2593 aposit[(j << 1) + 2] - (j - k)];
2594 }
2595
2596 chomat[ptcou] = (amatri[ptcou] - somme) / chomat[ptini];
2597 }
2598 }
2599
2600 goto L9999;
2601
2602/* ***********************************************************************
2603 */
0d969553 2604/* ERROR PROCESSING */
7fd59977 2605/* ***********************************************************************
2606 */
2607
2608L9101:
2609 *iercod = 1;
2610 goto L9999;
2611
2612/* ***********************************************************************
2613 */
0d969553 2614/* RETURN CALLING PROGRAM */
7fd59977 2615/* ***********************************************************************
2616 */
2617
2618L9999:
2619
2620 AdvApp2Var_SysBase::maermsg_("MMCHOLE", iercod, 7L);
2621 if (ldbg) {
2622 AdvApp2Var_SysBase::mgsomsg_("MMCHOLE", 7L);
2623 }
2624
2625 return 0 ;
2626} /* mmchole_ */
2627
2628//=======================================================================
2629//function : AdvApp2Var_MathBase::mmcvctx_
2630//purpose :
2631//=======================================================================
2632int AdvApp2Var_MathBase::mmcvctx_(integer *ndimen,
2633 integer *ncofmx,
2634 integer *nderiv,
2635 doublereal *ctrtes,
2636 doublereal *crvres,
2637 doublereal *tabaux,
2638 doublereal *xmatri,
2639 integer *iercod)
2640
2641{
2642 /* System generated locals */
2643 integer ctrtes_dim1, ctrtes_offset, crvres_dim1, crvres_offset,
2644 xmatri_dim1, xmatri_offset, tabaux_dim1, tabaux_offset, i__1,
2645 i__2;
2646
2647 /* Local variables */
1ef32e96
RL
2648 integer moup1, nordr;
2649 integer nd;
2650 integer ibb, ncf, ndv;
2651 doublereal eps1;
7fd59977 2652
2653
2654/* ***********************************************************************
2655 */
2656
0d969553 2657/* FUNCTION : */
7fd59977 2658/* ---------- */
0d969553
Y
2659/* Calculate a polynomial curve checking the */
2660/* passage constraints (interpolation) */
2661/* from first derivatives, etc... to extremities. */
2662/* Parameters at the extremities are supposed to be -1 and 1. */
7fd59977 2663
0d969553 2664/* KEYWORDS : */
7fd59977 2665/* ----------- */
0d969553 2666/* ALL, AB_SPECIFI::CONSTRAINTS&,INTERPOLATION,&CURVE */
7fd59977 2667
0d969553 2668/* INPUT ARGUMENTS : */
7fd59977 2669/* ------------------ */
0d969553
Y
2670/* NDIMEN : Space Dimension. */
2671/* NCOFMX : Nb of coeff. of curve CRVRES on each */
7fd59977 2672/* dimension. */
0d969553 2673/* NDERIV : Order of constraint with derivatives : */
7fd59977 2674/* 0 --> interpolation simple. */
0d969553
Y
2675/* 1 --> interpolation+constraints with 1st. */
2676/* 2 --> cas (0)+ (1) + " " 2nd derivatives. */
7fd59977 2677/* etc... */
0d969553
Y
2678/* CTRTES : Table of constraints. */
2679/* CTRTES(*,1,*) = contraints at -1. */
2680/* CTRTES(*,2,*) = contraints at 1. */
7fd59977 2681
0d969553 2682/* OUTPUT ARGUMENTS : */
7fd59977 2683/* ------------------- */
0d969553
Y
2684/* CRVRES : Resulting curve defined on (-1,1). */
2685/* TABAUX : Auxilliary matrix. */
2686/* XMATRI : Auxilliary matrix. */
7fd59977 2687
2688/* COMMONS UTILISES : */
2689/* ---------------- */
2690
2691/* .Neant. */
2692
0d969553 2693/* REFERENCES CALLED : */
7fd59977 2694/* ---------------------- */
2695/* Type Name */
2696/* MAERMSG R*8 DFLOAT MGENMSG */
2697/* MGSOMSG MMEPS1 MMRSLW */
2698/* I*4 MNFNDEB */
2699
0d969553 2700/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 2701/* ----------------------------------- */
0d969553
Y
2702/* The polynom (or the curve) is calculated by solving a */
2703/* system of linear equations. If the imposed degree is great */
2704/* it is preferable to call a routine based on */
2705/* Lagrange or Hermite interpolation depending on the case. */
2706/* (for a high degree the matrix of the system can be badly */
2707/* conditionned). */
2708/* This routine returns a curve defined in (-1,1). */
2709/* In general case, it is necessary to use MCVCTG. */
7fd59977 2710/* > */
2711/* ***********************************************************************
2712 */
2713
0d969553 2714/* Name of the routine */
7fd59977 2715
2716
2717 /* Parameter adjustments */
2718 crvres_dim1 = *ncofmx;
2719 crvres_offset = crvres_dim1 + 1;
2720 crvres -= crvres_offset;
2721 xmatri_dim1 = *nderiv + 1;
2722 xmatri_offset = xmatri_dim1 + 1;
2723 xmatri -= xmatri_offset;
2724 tabaux_dim1 = *nderiv + 1 + *ndimen;
2725 tabaux_offset = tabaux_dim1 + 1;
2726 tabaux -= tabaux_offset;
2727 ctrtes_dim1 = *ndimen;
2728 ctrtes_offset = ctrtes_dim1 * 3 + 1;
2729 ctrtes -= ctrtes_offset;
2730
2731 /* Function Body */
2732 ibb = AdvApp2Var_SysBase::mnfndeb_();
2733 if (ibb >= 3) {
2734 AdvApp2Var_SysBase::mgenmsg_("MMCVCTX", 7L);
2735 }
0d969553 2736/* Precision. */
7fd59977 2737 AdvApp2Var_MathBase::mmeps1_(&eps1);
2738
0d969553 2739/* ****************** CALCULATION OF EVEN COEFFICIENTS *********************
7fd59977 2740*/
0d969553 2741/* ------------------------- Initialization -----------------------------
7fd59977 2742*/
2743
2744 nordr = *nderiv + 1;
2745 i__1 = nordr;
2746 for (ncf = 1; ncf <= i__1; ++ncf) {
2747 tabaux[ncf + tabaux_dim1] = 1.;
2748/* L100: */
2749 }
2750
0d969553 2751/* ---------------- Calculation of terms corresponding to derivatives -------
7fd59977 2752*/
2753
2754 i__1 = nordr;
2755 for (ndv = 2; ndv <= i__1; ++ndv) {
2756 i__2 = nordr;
2757 for (ncf = 1; ncf <= i__2; ++ncf) {
2758 tabaux[ncf + ndv * tabaux_dim1] = tabaux[ncf + (ndv - 1) *
2759 tabaux_dim1] * (doublereal) ((ncf << 1) - ndv);
2760/* L300: */
2761 }
2762/* L200: */
2763 }
2764
0d969553 2765/* ------------------ Writing the second member -----------------------
7fd59977 2766*/
2767
2768 moup1 = 1;
2769 i__1 = nordr;
2770 for (ndv = 1; ndv <= i__1; ++ndv) {
2771 i__2 = *ndimen;
2772 for (nd = 1; nd <= i__2; ++nd) {
2773 tabaux[nordr + nd + ndv * tabaux_dim1] = (ctrtes[nd + ((ndv << 1)
2774 + 2) * ctrtes_dim1] + moup1 * ctrtes[nd + ((ndv << 1) + 1)
2775 * ctrtes_dim1]) / 2.;
2776/* L500: */
2777 }
2778 moup1 = -moup1;
2779/* L400: */
2780 }
2781
0d969553 2782/* -------------------- Resolution of the system ---------------------------
7fd59977 2783*/
2784
2785 mmrslw_(&nordr, &nordr, ndimen, &eps1, &tabaux[tabaux_offset], &xmatri[
2786 xmatri_offset], iercod);
2787 if (*iercod > 0) {
2788 goto L9999;
2789 }
2790 i__1 = *ndimen;
2791 for (nd = 1; nd <= i__1; ++nd) {
2792 i__2 = nordr;
2793 for (ncf = 1; ncf <= i__2; ++ncf) {
2794 crvres[(ncf << 1) - 1 + nd * crvres_dim1] = xmatri[ncf + nd *
2795 xmatri_dim1];
2796/* L700: */
2797 }
2798/* L600: */
2799 }
2800
0d969553 2801/* ***************** CALCULATION OF UNEVEN COEFFICIENTS ********************
7fd59977 2802*/
0d969553 2803/* ------------------------- Initialization -----------------------------
7fd59977 2804*/
2805
2806
2807 i__1 = nordr;
2808 for (ncf = 1; ncf <= i__1; ++ncf) {
2809 tabaux[ncf + tabaux_dim1] = 1.;
2810/* L1100: */
2811 }
2812
0d969553 2813/* ---------------- Calculation of terms corresponding to derivatives -------
7fd59977 2814*/
2815
2816 i__1 = nordr;
2817 for (ndv = 2; ndv <= i__1; ++ndv) {
2818 i__2 = nordr;
2819 for (ncf = 1; ncf <= i__2; ++ncf) {
2820 tabaux[ncf + ndv * tabaux_dim1] = tabaux[ncf + (ndv - 1) *
2821 tabaux_dim1] * (doublereal) ((ncf << 1) - ndv + 1);
2822/* L1300: */
2823 }
2824/* L1200: */
2825 }
2826
0d969553 2827/* ------------------ Writing of the second member -----------------------
7fd59977 2828*/
2829
2830 moup1 = -1;
2831 i__1 = nordr;
2832 for (ndv = 1; ndv <= i__1; ++ndv) {
2833 i__2 = *ndimen;
2834 for (nd = 1; nd <= i__2; ++nd) {
2835 tabaux[nordr + nd + ndv * tabaux_dim1] = (ctrtes[nd + ((ndv << 1)
2836 + 2) * ctrtes_dim1] + moup1 * ctrtes[nd + ((ndv << 1) + 1)
2837 * ctrtes_dim1]) / 2.;
2838/* L1500: */
2839 }
2840 moup1 = -moup1;
2841/* L1400: */
2842 }
2843
0d969553 2844/* -------------------- Solution of the system ---------------------------
7fd59977 2845*/
2846
2847 mmrslw_(&nordr, &nordr, ndimen, &eps1, &tabaux[tabaux_offset], &xmatri[
2848 xmatri_offset], iercod);
2849 if (*iercod > 0) {
2850 goto L9999;
2851 }
2852 i__1 = *ndimen;
2853 for (nd = 1; nd <= i__1; ++nd) {
2854 i__2 = nordr;
2855 for (ncf = 1; ncf <= i__2; ++ncf) {
2856 crvres[(ncf << 1) + nd * crvres_dim1] = xmatri[ncf + nd *
2857 xmatri_dim1];
2858/* L1700: */
2859 }
2860/* L1600: */
2861 }
2862
2863/* --------------------------- The end ----------------------------------
2864*/
2865
2866L9999:
2867 if (*iercod != 0) {
2868 AdvApp2Var_SysBase::maermsg_("MMCVCTX", iercod, 7L);
2869 }
2870 if (ibb >= 3) {
2871 AdvApp2Var_SysBase::mgsomsg_("MMCVCTX", 7L);
2872 }
2873
2874 return 0 ;
2875} /* mmcvctx_ */
2876
2877//=======================================================================
2878//function : AdvApp2Var_MathBase::mmcvinv_
2879//purpose :
2880//=======================================================================
2881 int AdvApp2Var_MathBase::mmcvinv_(integer *ndimax,
2882 integer *ncoef,
2883 integer *ndim,
2884 doublereal *curveo,
2885 doublereal *curve)
2886
2887{
2888 /* Initialized data */
2889
2890 static char nomprg[8+1] = "MMCVINV ";
2891
2892 /* System generated locals */
2893 integer curve_dim1, curve_offset, curveo_dim1, curveo_offset, i__1, i__2;
2894
2895 /* Local variables */
1ef32e96 2896 integer i__, nd, ibb;
7fd59977 2897
2898
2899/* ***********************************************************************
2900 */
2901
0d969553 2902/* FUNCTION : */
7fd59977 2903/* ---------- */
0d969553 2904/* Inversion of arguments of the final curve. */
7fd59977 2905
0d969553 2906/* KEYWORDS : */
7fd59977 2907/* ----------- */
0d969553 2908/* SMOOTHING,CURVE */
7fd59977 2909
2910
0d969553 2911/* INPUT ARGUMENTS : */
7fd59977 2912/* ------------------ */
2913
0d969553
Y
2914/* NDIM: Space Dimension. */
2915/* NCOEF: Degree of the polynom. */
2916/* CURVEO: The curve before inversion. */
7fd59977 2917
0d969553 2918/* OUTPUT ARGUMENTS : */
7fd59977 2919/* ------------------- */
0d969553 2920/* CURVE: The curve after inversion. */
7fd59977 2921
0d969553 2922/* COMMONS USED : */
7fd59977 2923/* ---------------- */
7fd59977 2924/* REFERENCES APPELEES : */
2925/* ----------------------- */
0d969553 2926/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 2927/* ----------------------------------- */
7fd59977 2928/* ***********************************************************************
2929 */
2930
0d969553 2931/* The name of the routine */
7fd59977 2932 /* Parameter adjustments */
2933 curve_dim1 = *ndimax;
2934 curve_offset = curve_dim1 + 1;
2935 curve -= curve_offset;
2936 curveo_dim1 = *ncoef;
2937 curveo_offset = curveo_dim1 + 1;
2938 curveo -= curveo_offset;
2939
2940 /* Function Body */
2941
2942 ibb = AdvApp2Var_SysBase::mnfndeb_();
2943 if (ibb >= 2) {
2944 AdvApp2Var_SysBase::mgenmsg_(nomprg, 6L);
2945 }
2946
2947 i__1 = *ncoef;
2948 for (i__ = 1; i__ <= i__1; ++i__) {
2949 i__2 = *ndim;
2950 for (nd = 1; nd <= i__2; ++nd) {
2951 curve[nd + i__ * curve_dim1] = curveo[i__ + nd * curveo_dim1];
2952/* L300: */
2953 }
2954 }
2955
2956/* L9999: */
2957 return 0;
2958} /* mmcvinv_ */
2959
2960//=======================================================================
2961//function : mmcvstd_
2962//purpose :
2963//=======================================================================
2964int mmcvstd_(integer *ncofmx,
2965 integer *ndimax,
2966 integer *ncoeff,
2967 integer *ndimen,
2968 doublereal *crvcan,
2969 doublereal *courbe)
2970
2971{
2972 /* System generated locals */
2973 integer courbe_dim1, crvcan_dim1, crvcan_offset, i__1, i__2, i__3;
2974
2975 /* Local variables */
1ef32e96
RL
2976 integer ndeg, i__, j, j1, nd, ibb;
2977 doublereal bid;
7fd59977 2978
2979
2980/* ***********************************************************************
2981 */
2982
0d969553 2983/* FUNCTION : */
7fd59977 2984/* ---------- */
0d969553 2985/* Transform curve defined between [-1,1] into [0,1]. */
7fd59977 2986
0d969553 2987/* KEYWORDS : */
7fd59977 2988/* ----------- */
0d969553 2989/* LIMITATION,RESTRICTION,CURVE */
7fd59977 2990
0d969553 2991/* INPUT ARGUMENTS : */
7fd59977 2992/* ------------------ */
0d969553
Y
2993/* NDIMAX : Dimension of the space. */
2994/* NDIMEN : Dimension of the curve. */
2995/* NCOEFF : Degree of the curve. */
2996/* CRVCAN(NCOFMX,NDIMEN): The curve is defined at the interval [-1,1]. */
7fd59977 2997
0d969553 2998/* OUTPUT ARGUMENTS : */
7fd59977 2999/* ------------------- */
0d969553 3000/* CURVE(NDIMAX,NCOEFF): Curve defined at the interval [0,1]. */
7fd59977 3001
0d969553 3002/* COMMONS USED : */
7fd59977 3003/* ---------------- */
3004
0d969553 3005/* REFERENCES CALLED : */
7fd59977 3006/* ----------------------- */
3007
0d969553 3008/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 3009/* ----------------------------------- */
7fd59977 3010/* > */
3011/* ***********************************************************************
3012 */
3013
0d969553 3014/* Name of the program. */
7fd59977 3015
3016
3017/* **********************************************************************
3018*/
3019
0d969553 3020/* FUNCTION : */
7fd59977 3021/* ---------- */
0d969553 3022/* Provides binomial coefficients (Pascal triangle). */
7fd59977 3023
0d969553 3024/* KEYWORDS : */
7fd59977 3025/* ----------- */
0d969553 3026/* Binomial coefficient from 0 to 60. read only . init by block data */
7fd59977 3027
0d969553 3028/* DEMSCRIPTION/NOTES/LIMITATIONS : */
7fd59977 3029/* ----------------------------------- */
0d969553
Y
3030/* Binomial coefficients form a triangular matrix. */
3031/* This matrix is completed in table CNP by its transposition. */
3032/* So: CNP(I,J) = CNP(J,I) for I and J = 0, ..., 60. */
7fd59977 3033
0d969553
Y
3034/* Initialization is done with block-data MMLLL09.RES, */
3035/* created by the program MQINICNP.FOR. */
7fd59977 3036/* > */
3037/* **********************************************************************
3038*/
3039
3040
3041
3042/* ***********************************************************************
3043 */
3044
3045 /* Parameter adjustments */
3046 courbe_dim1 = *ndimax;
3047 --courbe;
3048 crvcan_dim1 = *ncofmx;
3049 crvcan_offset = crvcan_dim1;
3050 crvcan -= crvcan_offset;
3051
3052 /* Function Body */
3053 ibb = AdvApp2Var_SysBase::mnfndeb_();
3054 if (ibb >= 3) {
3055 AdvApp2Var_SysBase::mgenmsg_("MMCVSTD", 7L);
3056 }
3057 ndeg = *ncoeff - 1;
3058
0d969553 3059/* ------------------ Construction of the resulting curve ----------------
7fd59977 3060*/
3061
3062 i__1 = *ndimen;
3063 for (nd = 1; nd <= i__1; ++nd) {
3064 i__2 = ndeg;
3065 for (j = 0; j <= i__2; ++j) {
3066 bid = 0.;
3067 i__3 = ndeg;
3068 for (i__ = j; i__ <= i__3; i__ += 2) {
3069 bid += crvcan[i__ + nd * crvcan_dim1] * mmcmcnp_.cnp[i__ + j
3070 * 61];
3071/* L410: */
3072 }
3073 courbe[nd + j * courbe_dim1] = bid;
3074
3075 bid = 0.;
3076 j1 = j + 1;
3077 i__3 = ndeg;
3078 for (i__ = j1; i__ <= i__3; i__ += 2) {
3079 bid += crvcan[i__ + nd * crvcan_dim1] * mmcmcnp_.cnp[i__ + j
3080 * 61];
3081/* L420: */
3082 }
3083 courbe[nd + j * courbe_dim1] -= bid;
3084/* L400: */
3085 }
3086/* L300: */
3087 }
3088
0d969553 3089/* ------------------- Renormalization of the CURVE -------------------------
7fd59977 3090 */
3091
3092 bid = 1.;
3093 i__1 = ndeg;
3094 for (i__ = 0; i__ <= i__1; ++i__) {
3095 i__2 = *ndimen;
3096 for (nd = 1; nd <= i__2; ++nd) {
3097 courbe[nd + i__ * courbe_dim1] *= bid;
3098/* L510: */
3099 }
3100 bid *= 2.;
3101/* L500: */
3102 }
3103
3104/* ----------------------------- The end --------------------------------
3105*/
3106
3107 if (ibb >= 3) {
3108 AdvApp2Var_SysBase::mgsomsg_("MMCVSTD", 7L);
3109 }
3110 return 0;
3111} /* mmcvstd_ */
3112
3113//=======================================================================
3114//function : AdvApp2Var_MathBase::mmdrc11_
3115//purpose :
3116//=======================================================================
3117int AdvApp2Var_MathBase::mmdrc11_(integer *iordre,
3118 integer *ndimen,
3119 integer *ncoeff,
3120 doublereal *courbe,
3121 doublereal *points,
3122 doublereal *mfactab)
3123
3124{
3125 /* System generated locals */
3126 integer courbe_dim1, courbe_offset, points_dim2, points_offset, i__1,
3127 i__2;
3128
3129 /* Local variables */
3130
1ef32e96 3131 integer ndeg, i__, j, ndgcb, nd, ibb;
7fd59977 3132
3133
3134/* **********************************************************************
3135*/
3136
0d969553 3137/* FUNCTION : */
7fd59977 3138/* ---------- */
0d969553
Y
3139/* Calculation of successive derivatives of equation CURVE with */
3140/* parameters -1, 1 from order 0 to order IORDRE */
3141/* included. The calculation is produced without knowing the coefficients of */
3142/* derivatives of the curve. */
7fd59977 3143
0d969553 3144/* KEYWORDS : */
7fd59977 3145/* ----------- */
0d969553 3146/* POSITIONING,EXTREMITIES,CURVE,DERIVATIVE. */
7fd59977 3147
0d969553 3148/* INPUT ARGUMENTS : */
7fd59977 3149/* ------------------ */
0d969553
Y
3150/* IORDRE : Maximum order of calculation of derivatives. */
3151/* NDIMEN : Dimension of the space. */
3152/* NCOEFF : Number of coefficients of the curve (degree+1). */
3153/* COURBE : Table of coefficients of the curve. */
7fd59977 3154
0d969553 3155/* OUTPUT ARGUMENTS : */
7fd59977 3156/* ------------------- */
0d969553
Y
3157/* POINTS : Table of values of consecutive derivatives */
3158/* of parameters -1.D0 and 1.D0. */
3159/* MFACTAB : Auxiliary table for calculation of factorial(I).
7fd59977 3160*/
3161
0d969553 3162/* COMMONS USED : */
7fd59977 3163/* ---------------- */
0d969553 3164/* None. */
7fd59977 3165
0d969553 3166/* REFERENCES CALLED : */
7fd59977 3167/* ----------------------- */
3168
0d969553 3169/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 3170/* ----------------------------------- */
3171
0d969553
Y
3172/* ---> ATTENTION, the coefficients of the curve are */
3173/* in a reverse order. */
7fd59977 3174
0d969553
Y
3175/* ---> The algorithm of calculation of derivatives is based on */
3176/* generalization of Horner scheme : */
7fd59977 3177/* k 2 */
0d969553 3178/* Let C(t) = uk.t + ... + u2.t + u1.t + u0 . */
7fd59977 3179
3180
0d969553 3181/* a0 = uk, b0 = 0, c0 = 0 and for 1<=j<=k, it is calculated : */
7fd59977 3182
3183/* aj = a(j-1).x + u(k-j) */
3184/* bj = b(j-1).x + a(j-1) */
3185/* cj = c(j-1).x + b(j-1) */
3186
0d969553 3187/* So : C(x) = ak, C'(x) = bk, C"(x) = 2.ck . */
7fd59977 3188
0d969553 3189/* The algorithm is generalized easily for calculation of */
7fd59977 3190
3191/* (n) */
3192/* C (x) . */
3193/* --------- */
3194/* n! */
3195
3196/* Reference : D. KNUTH, "The Art of Computer Programming" */
3197/* --------- Vol. 2/Seminumerical Algorithms */
3198/* Addison-Wesley Pub. Co. (1969) */
3199/* pages 423-425. */
7fd59977 3200/* > */
3201/* **********************************************************************
3202*/
3203
0d969553 3204/* Name of the routine */
7fd59977 3205
3206 /* Parameter adjustments */
3207 points_dim2 = *iordre + 1;
3208 points_offset = (points_dim2 << 1) + 1;
3209 points -= points_offset;
3210 courbe_dim1 = *ncoeff;
3211 courbe_offset = courbe_dim1;
3212 courbe -= courbe_offset;
3213
3214 /* Function Body */
3215 ibb = AdvApp2Var_SysBase::mnfndeb_();
3216 if (ibb >= 2) {
3217 AdvApp2Var_SysBase::mgenmsg_("MMDRC11", 7L);
3218 }
3219
3220 if (*iordre < 0 || *ncoeff < 1) {
3221 goto L9999;
3222 }
3223
0d969553 3224/* ------------------- Initialization of table POINTS -----------------
7fd59977 3225*/
3226
3227 ndgcb = *ncoeff - 1;
3228 i__1 = *ndimen;
3229 for (nd = 1; nd <= i__1; ++nd) {
3230 points[(nd * points_dim2 << 1) + 1] = courbe[ndgcb + nd * courbe_dim1]
3231 ;
3232 points[(nd * points_dim2 << 1) + 2] = courbe[ndgcb + nd * courbe_dim1]
3233 ;
3234/* L100: */
3235 }
3236
3237 i__1 = *ndimen;
3238 for (nd = 1; nd <= i__1; ++nd) {
3239 i__2 = *iordre;
3240 for (j = 1; j <= i__2; ++j) {
3241 points[((j + nd * points_dim2) << 1) + 1] = 0.;
3242 points[((j + nd * points_dim2) << 1) + 2] = 0.;
3243/* L400: */
3244 }
3245/* L300: */
3246 }
3247
0d969553 3248/* Calculation with parameter -1 and 1 */
7fd59977 3249
3250 i__1 = *ndimen;
3251 for (nd = 1; nd <= i__1; ++nd) {
3252 i__2 = ndgcb;
3253 for (ndeg = 1; ndeg <= i__2; ++ndeg) {
3254 for (i__ = *iordre; i__ >= 1; --i__) {
3255 points[((i__ + nd * points_dim2) << 1) + 1] = -points[((i__ + nd
3256 * points_dim2) << 1) + 1] + points[((i__ - 1 + nd *
3257 points_dim2) << 1) + 1];
3258 points[((i__ + nd * points_dim2) << 1) + 2] += points[((i__ - 1
3259 + nd * points_dim2) << 1) + 2];
3260/* L800: */
3261 }
3262 points[(nd * points_dim2 << 1) + 1] = -points[(nd * points_dim2 <<
3263 1) + 1] + courbe[ndgcb - ndeg + nd * courbe_dim1];
3264 points[(nd * points_dim2 << 1) + 2] += courbe[ndgcb - ndeg + nd *
3265 courbe_dim1];
3266/* L700: */
3267 }
3268/* L600: */
3269 }
3270
0d969553 3271/* --------------------- Multiplication by factorial(I) --------------
7fd59977 3272*/
3273
3274 if (*iordre > 1) {
3275 mfac_(&mfactab[1], iordre);
3276
3277 i__1 = *ndimen;
3278 for (nd = 1; nd <= i__1; ++nd) {
3279 i__2 = *iordre;
3280 for (i__ = 2; i__ <= i__2; ++i__) {
3281 points[((i__ + nd * points_dim2) << 1) + 1] = mfactab[i__] *
3282 points[((i__ + nd * points_dim2) << 1) + 1];
3283 points[((i__ + nd * points_dim2) << 1) + 2] = mfactab[i__] *
3284 points[((i__ + nd * points_dim2) << 1) + 2];
3285/* L1000: */
3286 }
3287/* L900: */
3288 }
3289 }
3290
0d969553 3291/* ---------------------------- End -------------------------------------
7fd59977 3292*/
3293
3294L9999:
3295 if (ibb >= 2) {
3296 AdvApp2Var_SysBase::mgsomsg_("MMDRC11", 7L);
3297 }
3298 return 0;
3299} /* mmdrc11_ */
3300
3301//=======================================================================
3302//function : mmdrvcb_
3303//purpose :
3304//=======================================================================
3305int mmdrvcb_(integer *ideriv,
3306 integer *ndim,
3307 integer *ncoeff,
3308 doublereal *courbe,
3309 doublereal *tparam,
3310 doublereal *tabpnt,
3311 integer *iercod)
3312
3313{
3314 /* System generated locals */
3315 integer courbe_dim1, tabpnt_dim1, i__1, i__2, i__3;
3316
3317 /* Local variables */
1ef32e96 3318 integer ndeg, i__, j, nd, ndgcrb, iptpnt, ibb;
7fd59977 3319
3320
258ff83b 3321/* *********************************************************************** */
0d969553 3322/* FUNCTION : */
7fd59977 3323/* ---------- */
7fd59977 3324
0d969553
Y
3325/* Calculation of successive derivatives of equation CURVE with */
3326/* parameter TPARAM from order 0 to order IDERIV included. */
3327/* The calculation is produced without knowing the coefficients of */
3328/* derivatives of the CURVE. */
3329
3330/* KEYWORDS : */
7fd59977 3331/* ----------- */
0d969553 3332/* POSITIONING,PARAMETER,CURVE,DERIVATIVE. */
7fd59977 3333
0d969553 3334/* INPUT ARGUMENTS : */
7fd59977 3335/* ------------------ */
0d969553
Y
3336/* IORDRE : Maximum order of calculation of derivatives. */
3337/* NDIMEN : Dimension of the space. */
3338/* NCOEFF : Number of coefficients of the curve (degree+1). */
3339/* COURBE : Table of coefficients of the curve. */
3340/* TPARAM : Value of the parameter where the curve should be evaluated. */
7fd59977 3341
0d969553 3342/* OUTPUT ARGUMENTS : */
7fd59977 3343/* ------------------- */
0d969553
Y
3344/* TABPNT : Table of values of consecutive derivatives */
3345/* of parameter TPARAM. */
3346 /* IERCOD : 0 = OK, */
3347/* 1 = incoherent input. */
7fd59977 3348
0d969553 3349/* COMMONS USED : */
7fd59977 3350/* ---------------- */
0d969553 3351/* None. */
7fd59977 3352
0d969553 3353/* REFERENCES CALLED : */
7fd59977 3354/* ----------------------- */
3355
0d969553 3356/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 3357/* ----------------------------------- */
3358
0d969553
Y
3359/* The algorithm of calculation of derivatives is based on */
3360/* generalization of the Horner scheme : */
7fd59977 3361/* k 2 */
0d969553 3362/* Let C(t) = uk.t + ... + u2.t + u1.t + u0 . */
7fd59977 3363
3364
0d969553 3365/* a0 = uk, b0 = 0, c0 = 0 and for 1<=j<=k, it is calculated : */
7fd59977 3366
3367/* aj = a(j-1).x + u(k-j) */
3368/* bj = b(j-1).x + a(j-1) */
3369/* cj = c(j-1).x + b(j-1) */
3370
0d969553 3371/* So, it is obtained : C(x) = ak, C'(x) = bk, C"(x) = 2.ck . */
7fd59977 3372
0d969553 3373/* The algorithm can be easily generalized for the calculation of */
7fd59977 3374
3375/* (n) */
3376/* C (x) . */
3377/* --------- */
3378/* n! */
3379
3380/* Reference : D. KNUTH, "The Art of Computer Programming" */
3381/* --------- Vol. 2/Seminumerical Algorithms */
3382/* Addison-Wesley Pub. Co. (1969) */
3383/* pages 423-425. */
3384
0d969553
Y
3385/* ---> To evaluare derivatives at 0 and 1, it is preferable */
3386/* to use routine MDRV01.FOR . */
7fd59977 3387/* > */
3388/* **********************************************************************
3389*/
3390
0d969553 3391/* Name of the routine */
7fd59977 3392
3393 /* Parameter adjustments */
3394 tabpnt_dim1 = *ndim;
3395 --tabpnt;
3396 courbe_dim1 = *ndim;
3397 --courbe;
3398
3399 /* Function Body */
3400 ibb = AdvApp2Var_SysBase::mnfndeb_();
3401 if (ibb >= 2) {
3402 AdvApp2Var_SysBase::mgenmsg_("MMDRVCB", 7L);
3403 }
3404
3405 if (*ideriv < 0 || *ncoeff < 1) {
3406 *iercod = 1;
3407 goto L9999;
3408 }
3409 *iercod = 0;
3410
0d969553 3411/* ------------------- Initialization of table TABPNT -----------------
7fd59977 3412*/
3413
3414 ndgcrb = *ncoeff - 1;
3415 i__1 = *ndim;
3416 for (nd = 1; nd <= i__1; ++nd) {
3417 tabpnt[nd] = courbe[nd + ndgcrb * courbe_dim1];
3418/* L100: */
3419 }
3420
3421 if (*ideriv < 1) {
3422 goto L200;
3423 }
3424 iptpnt = *ndim * *ideriv;
fadcea2c
RL
3425 AdvApp2Var_SysBase::mvriraz_(&iptpnt,
3426 &tabpnt[tabpnt_dim1 + 1]);
7fd59977 3427L200:
3428
0d969553 3429/* ------------------------ Calculation of parameter TPARAM ------------------
7fd59977 3430*/
3431
3432 i__1 = ndgcrb;
3433 for (ndeg = 1; ndeg <= i__1; ++ndeg) {
3434 i__2 = *ndim;
3435 for (nd = 1; nd <= i__2; ++nd) {
3436 for (i__ = *ideriv; i__ >= 1; --i__) {
3437 tabpnt[nd + i__ * tabpnt_dim1] = tabpnt[nd + i__ *
3438 tabpnt_dim1] * *tparam + tabpnt[nd + (i__ - 1) *
3439 tabpnt_dim1];
3440/* L700: */
3441 }
3442 tabpnt[nd] = tabpnt[nd] * *tparam + courbe[nd + (ndgcrb - ndeg) *
3443 courbe_dim1];
3444/* L600: */
3445 }
3446/* L500: */
3447 }
3448
0d969553 3449/* --------------------- Multiplication by factorial(I) -------------
7fd59977 3450*/
3451
3452 i__1 = *ideriv;
3453 for (i__ = 2; i__ <= i__1; ++i__) {
3454 i__2 = i__;
3455 for (j = 2; j <= i__2; ++j) {
3456 i__3 = *ndim;
3457 for (nd = 1; nd <= i__3; ++nd) {
3458 tabpnt[nd + i__ * tabpnt_dim1] = (doublereal) j * tabpnt[nd +
3459 i__ * tabpnt_dim1];
3460/* L1200: */
3461 }
3462/* L1100: */
3463 }
3464/* L1000: */
3465 }
3466
3467/* --------------------------- The end ---------------------------------
3468*/
3469
3470L9999:
3471 if (*iercod > 0) {
3472 AdvApp2Var_SysBase::maermsg_("MMDRVCB", iercod, 7L);
3473 }
3474 return 0;
3475} /* mmdrvcb_ */
3476
3477//=======================================================================
3478//function : AdvApp2Var_MathBase::mmdrvck_
3479//purpose :
3480//=======================================================================
3481int AdvApp2Var_MathBase::mmdrvck_(integer *ncoeff,
3482 integer *ndimen,
3483 doublereal *courbe,
3484 integer *ideriv,
3485 doublereal *tparam,
3486 doublereal *pntcrb)
3487
3488{
3489 /* Initialized data */
3490
3491 static doublereal mmfack[21] = { 1.,2.,6.,24.,120.,720.,5040.,40320.,
3492 362880.,3628800.,39916800.,479001600.,6227020800.,87178291200.,
3493 1.307674368e12,2.0922789888e13,3.55687428096e14,6.402373705728e15,
3494 1.21645100408832e17,2.43290200817664e18,5.109094217170944e19 };
3495
3496 /* System generated locals */
3497 integer courbe_dim1, courbe_offset, i__1, i__2;
3498
3499 /* Local variables */
1ef32e96
RL
3500 integer i__, j, k, nd;
3501 doublereal mfactk, bid;
7fd59977 3502
3503
3504/* IMPLICIT INTEGER (I-N) */
3505/* IMPLICIT DOUBLE PRECISION(A-H,O-Z) */
3506
3507
3508/* ***********************************************************************
3509 */
3510
3511/* FONCTION : */
3512/* ---------- */
0d969553
Y
3513/* Calculate the value of a derived curve of order IDERIV in */
3514/* a point of parameter TPARAM. */
7fd59977 3515
0d969553 3516/* KEYWORDS : */
7fd59977 3517/* ----------- */
0d969553 3518/* POSITIONING,CURVE,DERIVATIVE of ORDER K. */
7fd59977 3519
0d969553 3520/* INPUT ARGUMENTS : */
7fd59977 3521/* ------------------ */
0d969553
Y
3522/* NCOEFF : Degree +1 of the curve. */
3523/* NDIMEN : Dimension of the space (2 or 3 in general) */
3524/* COURBE : Table of coefficients of the curve. */
3525/* IDERIV : Required order of derivation : 1=1st derivative, etc... */
3526/* TPARAM : Value of parameter of the curve. */
7fd59977 3527
0d969553 3528/* OUTPUT ARGUMENTS : */
7fd59977 3529/* ------------------- */
0d969553
Y
3530/* PNTCRB : Point of parameter TPARAM on the derivative of order */
3531/* IDERIV of CURVE. */
7fd59977 3532
0d969553 3533/* COMMONS USED : */
7fd59977 3534/* ---------------- */
3535/* MMCMCNP */
3536
0d969553 3537/* REFERENCES CALLED : */
7fd59977 3538/* ---------------------- */
0d969553
Y
3539/* None. */
3540/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 3541/* ----------------------------------- */
3542
0d969553 3543/* The code below was written basing on the following algorithm :
7fd59977 3544*/
3545
0d969553
Y
3546/* Let P(t) = a1 + a2*t + ... an*t**n. The derivative of order k of P */
3547/* (containing n-k coefficients) is calculated as follows : */
7fd59977 3548
3549/* Pk(t) = a(k+1)*CNP(k,k)*k! */
3550/* + a(k+2)*CNP(k+1,k)*k! * t */
3551/* . */
3552/* . */
3553/* . */
3554/* + a(n)*CNP(n-1,k)*k! * t**(n-k-1). */
3555
0d969553 3556/* Evaluation is produced following the classic Horner scheme. */
7fd59977 3557/* > */
3558/* ***********************************************************************
3559 */
3560
3561
0d969553 3562/* Factorials (1 to 21) caculated on VAX in R*16 */
7fd59977 3563
3564
3565/* **********************************************************************
3566*/
3567
0d969553 3568/* FUNCTION : */
7fd59977 3569/* ---------- */
0d969553 3570/* Serves to provide binomial coefficients (Pascal triangle). */
7fd59977 3571
0d969553 3572/* KEYWORDS : */
7fd59977 3573/* ----------- */
0d969553 3574/* Binomial Coeff from 0 to 60. read only . init by block data */
7fd59977 3575
0d969553 3576/* DEMSCRIPTION/NOTES/LIMITATIONS : */
7fd59977 3577/* ----------------------------------- */
0d969553
Y
3578/* Binomial coefficients form a triangular matrix. */
3579/* This matrix is completed in table CNP by its transposition. */
3580/* So: CNP(I,J) = CNP(J,I) for I and J = 0, ..., 60. */
7fd59977 3581
0d969553
Y
3582/* Initialization is done by block-data MMLLL09.RES, */
3583/* created by program MQINICNP.FOR. */
7fd59977 3584/* > */
3585/* **********************************************************************
3586*/
3587
3588
3589
3590/* ***********************************************************************
3591 */
3592
3593 /* Parameter adjustments */
3594 --pntcrb;
3595 courbe_dim1 = *ndimen;
3596 courbe_offset = courbe_dim1 + 1;
3597 courbe -= courbe_offset;
3598
3599 /* Function Body */
3600
0d969553 3601/* -------------- Case when the order of derivative is greater than -------------------
7fd59977 3602*/
0d969553 3603/* ---------------- the degree of the curve ---------------------
7fd59977 3604*/
3605
3606 if (*ideriv >= *ncoeff) {
3607 i__1 = *ndimen;
3608 for (nd = 1; nd <= i__1; ++nd) {
3609 pntcrb[nd] = 0.;
3610/* L100: */
3611 }
3612 goto L9999;
3613 }
3614/* **********************************************************************
3615*/
0d969553 3616/* General processing*/
7fd59977 3617/* **********************************************************************
3618*/
0d969553 3619/* --------------------- Calculation of Factorial(IDERIV) ------------------
7fd59977 3620*/
3621
3622 k = *ideriv;
3623 if (*ideriv <= 21 && *ideriv > 0) {
3624 mfactk = mmfack[k - 1];
3625 } else {
3626 mfactk = 1.;
3627 i__1 = k;
3628 for (i__ = 2; i__ <= i__1; ++i__) {
3629 mfactk *= i__;
3630/* L200: */
3631 }
3632 }
3633
0d969553 3634/* ------- Calculation of derivative of order IDERIV of CURVE in TPARAM -----
7fd59977 3635*/
0d969553
Y
3636/* ---> Attention : binomial coefficient C(n,m) is represented in */
3637/* MCCNP by CNP(N,M). */
7fd59977 3638
3639 i__1 = *ndimen;
3640 for (nd = 1; nd <= i__1; ++nd) {
3641 pntcrb[nd] = courbe[nd + *ncoeff * courbe_dim1] * mmcmcnp_.cnp[*
3642 ncoeff - 1 + k * 61] * mfactk;
3643/* L300: */
3644 }
3645
3646 i__1 = k + 1;
3647 for (j = *ncoeff - 1; j >= i__1; --j) {
3648 bid = mmcmcnp_.cnp[j - 1 + k * 61] * mfactk;
3649 i__2 = *ndimen;
3650 for (nd = 1; nd <= i__2; ++nd) {
3651 pntcrb[nd] = pntcrb[nd] * *tparam + courbe[nd + j * courbe_dim1] *
3652 bid;
3653/* L500: */
3654 }
3655/* L400: */
3656 }
3657
3658/* -------------------------------- The end -----------------------------
3659*/
3660
3661L9999:
3662
3663 return 0 ;
3664
3665} /* mmdrvck_ */
3666//=======================================================================
3667//function : AdvApp2Var_MathBase::mmeps1_
3668//purpose :
3669//=======================================================================
3670int AdvApp2Var_MathBase::mmeps1_(doublereal *epsilo)
3671
3672{
3673/* ***********************************************************************
3674 */
3675
0d969553 3676/* FUNCTION : */
7fd59977 3677/* ---------- */
0d969553
Y
3678/* Extraction of EPS1 from COMMON MPRCSN. EPS1 is spatial zero */
3679/* equal to 1.D-9 */
7fd59977 3680
0d969553 3681/* KEYWORDS : */
7fd59977 3682/* ----------- */
3683/* MPRCSN,PRECISON,EPS1. */
3684
0d969553 3685/* INPUT ARGUMENTS : */
7fd59977 3686/* ------------------ */
0d969553 3687/* None */
7fd59977 3688
0d969553 3689/* OUTPUT ARGUMENTS : */
7fd59977 3690/* ------------------- */
0d969553 3691/* EPSILO : Value of EPS1 (spatial zero (10**-9)) */
7fd59977 3692
0d969553 3693/* COMMONS USED : */
7fd59977 3694/* ---------------- */
3695
0d969553 3696/* REFERENCES CALLED : */
7fd59977 3697/* ----------------------- */
3698
0d969553 3699/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 3700/* ----------------------------------- */
0d969553
Y
3701/* EPS1 is ABSOLUTE spatial zero, so it is necessary */
3702/* to use it whenever it is necessary to test if a variable */
3703/* is null. For example, if the norm of a vector is lower than */
3704/* EPS1, this vector is NULL ! (when one works in */
3705/* REAL*8) It is absolutely not advised to test arguments */
3706/* compared to EPS1**2. Taking into account the rounding errors inevitable */
3707/* during calculations, this causes testing compared to 0.D0. */
7fd59977 3708/* > */
3709/* ***********************************************************************
3710 */
3711
3712
3713
3714/* ***********************************************************************
3715 */
3716
0d969553 3717/* FUNCTION : */
7fd59977 3718/* ---------- */
0d969553
Y
3719/* Gives tolerances of invalidity in stream */
3720/* as well as limits of iterative processes */
7fd59977 3721
0d969553 3722/* general context, modifiable by the user */
7fd59977 3723
0d969553 3724/* KEYWORDS : */
7fd59977 3725/* ----------- */
0d969553 3726/* PARAMETER , TOLERANCE */
7fd59977 3727
0d969553 3728/* DEMSCRIPTION/NOTES/LIMITATIONS : */
7fd59977 3729/* ----------------------------------- */
258ff83b 3730/* INITIALISATION : profile , **VIA MPRFTX** at input in stream */
0d969553
Y
3731/* loading of default values of the profile in MPRFTX at input */
3732/* in stream. They are preserved in local variables of MPRFTX */
7fd59977 3733
0d969553
Y
3734/* Reset of default values : MDFINT */
3735/* Interactive modification by the user : MDBINT */
7fd59977 3736
0d969553 3737/* ACCESS FUNCTION : MMEPS1 ... EPS1 */
7fd59977 3738/* MEPSPB ... EPS3,EPS4 */
3739/* MEPSLN ... EPS2, NITERM , NITERR */
3740/* MEPSNR ... EPS2 , NITERM */
3741/* MITERR ... NITERR */
7fd59977 3742/* > */
3743/* ***********************************************************************
3744 */
3745
0d969553
Y
3746/* NITERM : max nb of iterations */
3747/* NITERR : nb of rapid iterations */
3748/* EPS1 : tolerance of 3D null distance */
3749/* EPS2 : tolerance of parametric null distance */
3750/* EPS3 : tolerance to avoid division by 0.. */
3751/* EPS4 : angular tolerance */
7fd59977 3752
3753
3754
3755/* ***********************************************************************
3756 */
3757 *epsilo = mmprcsn_.eps1;
3758
3759 return 0 ;
3760} /* mmeps1_ */
3761
3762//=======================================================================
3763//function : mmexthi_
3764//purpose :
3765//=======================================================================
3766int mmexthi_(integer *ndegre,
3767 doublereal *hwgaus)
3768
3769{
3770 /* System generated locals */
3771 integer i__1;
3772
3773 /* Local variables */
1ef32e96
RL
3774 integer iadd, ideb, ndeg2, nmod2, ii, ibb;
3775 integer kpt;
7fd59977 3776
3777/* **********************************************************************
3778*/
3779
3780/* FONCTION : */
3781/* ---------- */
0d969553
Y
3782/* Extract of common LDGRTL the weight of formulas of */
3783/* Gauss quadrature on all roots of Legendre polynoms of degree */
3784/* NDEGRE defined on [-1,1]. */
7fd59977 3785
0d969553 3786/* KEYWORDS : */
7fd59977 3787/* ----------- */
0d969553 3788/* ALL, AB_SPECIFI::COMMON&, EXTRACTION, &WEIGHT, &GAUSS. */
7fd59977 3789
0d969553 3790/* INPUT ARGUMENTS : */
7fd59977 3791/* ------------------ */
0d969553 3792/* NDEGRE : Mathematic degree of Legendre polynom. It should have */
7fd59977 3793/* 2 <= NDEGRE <= 61. */
3794
0d969553 3795/* OUTPUT ARGUMENTS : */
7fd59977 3796/* ------------------- */
0d969553
Y
3797/* HWGAUS : The table of weights of Gauss quadrature formulas */
3798/* relative to NDEGRE roots of a polynome de Legendre de */
7fd59977 3799/* degre NDEGRE. */
3800
3801/* COMMONS UTILISES : */
3802/* ---------------- */
3803/* MLGDRTL */
3804
0d969553 3805/* REFERENCES CALLED : */
7fd59977 3806/* ----------------------- */
3807
0d969553 3808/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 3809/* ----------------------------------- */
0d969553 3810/* ATTENTION: The condition on NDEGRE ( 2 <= NDEGRE <= 61) is not */
258ff83b 3811/* tested. The caller should make the test. */
7fd59977 3812
0d969553 3813/* Name of the routine */
7fd59977 3814
3815
0d969553
Y
3816/* Common MLGDRTL: */
3817/* This common includes POSITIVE roots of Legendre polynims */
3818/* AND weights of Gauss quadrature formulas on all */
3819/* POSITIVE roots of Legendre polynoms. */
7fd59977 3820
3821
3822
3823/* ***********************************************************************
3824 */
3825
0d969553 3826/* FUNCTION : */
7fd59977 3827/* ---------- */
0d969553 3828/* The common of Legendre roots. */
7fd59977 3829
0d969553 3830/* KEYWORDS : */
7fd59977 3831/* ----------- */
3832/* BASE LEGENDRE */
3833
0d969553 3834/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 3835/* ----------------------------------- */
7fd59977 3836/* > */
3837/* ***********************************************************************
3838 */
3839
3840
3841
3842
0d969553
Y
3843/* ROOTAB : Table of all roots of Legendre polynoms */
3844/* within the interval [0,1]. They are ranked for the degrees increasing from */
3845/* 2 to 61. */
3846/* HILTAB : Table of Legendre interpolators concerning ROOTAB. */
3847/* The adressing is the same. */
3848/* HI0TAB : Table of Legendre interpolators for root x=0 */
3849/* of polynoms of UNEVEN degree. */
3850/* RTLTB0 : Table of Li(uk) where uk are the roots of */
3851/* Legendre polynom of EVEN degree. */
3852/* RTLTB1 : Table of Li(uk) where uk are the roots of */
3853/* Legendre polynom of UNEVEN degree. */
7fd59977 3854
3855
3856/************************************************************************
3857*****/
3858 /* Parameter adjustments */
3859 --hwgaus;
3860
3861 /* Function Body */
3862 ibb = AdvApp2Var_SysBase::mnfndeb_();
3863 if (ibb >= 3) {
3864 AdvApp2Var_SysBase::mgenmsg_("MMEXTHI", 7L);
3865 }
3866
3867 ndeg2 = *ndegre / 2;
3868 nmod2 = *ndegre % 2;
3869
0d969553
Y
3870/* Address of Gauss weight associated to the 1st strictly */
3871/* positive root of Legendre polynom of degree NDEGRE in MLGDRTL. */
7fd59977 3872
3873 iadd = ndeg2 * (ndeg2 - 1) / 2 + 1;
3874
0d969553
Y
3875/* Index of the 1st HWGAUS element associated to the 1st strictly */
3876/* positive root of Legendre polynom of degree NDEGRE. */
7fd59977 3877
3878 ideb = (*ndegre + 1) / 2 + 1;
3879
0d969553 3880/* Reading of weights associated to strictly positive roots. */
7fd59977 3881
3882 i__1 = *ndegre;
3883 for (ii = ideb; ii <= i__1; ++ii) {
3884 kpt = iadd + ii - ideb;
3885 hwgaus[ii] = mlgdrtl_.hiltab[kpt + nmod2 * 465 - 1];
3886/* L100: */
3887 }
3888
0d969553 3889/* For strictly negative roots, the weight is the same. */
7fd59977 3890/* i.e HW(1) = HW(NDEGRE), HW(2) = HW(NDEGRE-1), etc... */
3891
3892 i__1 = ndeg2;
3893 for (ii = 1; ii <= i__1; ++ii) {
3894 hwgaus[ii] = hwgaus[*ndegre + 1 - ii];
3895/* L200: */
3896 }
3897
0d969553
Y
3898/* Case of uneven NDEGRE, 0 is root of Legendre polynom, */
3899/* associated Gauss weights are loaded. */
7fd59977 3900
3901 if (nmod2 == 1) {
3902 hwgaus[ndeg2 + 1] = mlgdrtl_.hi0tab[ndeg2];
3903 }
3904
3905/* --------------------------- The end ----------------------------------
3906*/
3907
3908 if (ibb >= 3) {
3909 AdvApp2Var_SysBase::mgsomsg_("MMEXTHI", 7L);
3910 }
3911 return 0;
3912} /* mmexthi_ */
3913
3914//=======================================================================
3915//function : mmextrl_
3916//purpose :
3917//=======================================================================
3918int mmextrl_(integer *ndegre,
3919 doublereal *rootlg)
3920{
3921 /* System generated locals */
3922 integer i__1;
3923
3924 /* Local variables */
1ef32e96
RL
3925 integer iadd, ideb, ndeg2, nmod2, ii, ibb;
3926 integer kpt;
7fd59977 3927
3928
3929/* **********************************************************************
3930*/
3931
0d969553 3932/* FUNCTION : */
7fd59977 3933/* ---------- */
0d969553
Y
3934/* Extract of the Common LDGRTL of Legendre polynom roots */
3935/* of degree NDEGRE defined on [-1,1]. */
7fd59977 3936
0d969553 3937/* KEYWORDS : */
7fd59977 3938/* ----------- */
0d969553 3939/* ALL, AB_SPECIFI::COMMON&, EXTRACTION, &ROOT, &LEGENDRE. */
7fd59977 3940
0d969553 3941/* INPUT ARGUMENTS : */
7fd59977 3942/* ------------------ */
0d969553
Y
3943/* NDEGRE : Mathematic degree of Legendre polynom. */
3944/* It is required to have 2 <= NDEGRE <= 61. */
7fd59977 3945
0d969553 3946/* OUTPUT ARGUMENTS : */
7fd59977 3947/* ------------------- */
0d969553
Y
3948/* ROOTLG : The table of roots of Legendre polynom of degree */
3949/* NDEGRE defined on [-1,1]. */
7fd59977 3950
0d969553 3951/* COMMONS USED : */
7fd59977 3952/* ---------------- */
3953/* MLGDRTL */
3954
0d969553 3955/* REFERENCES CALLED : */
7fd59977 3956/* ----------------------- */
3957
0d969553 3958/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 3959/* ----------------------------------- */
0d969553
Y
3960/* ATTENTION: Condition of NDEGRE ( 2 <= NDEGRE <= 61) is not */
3961/* tested. The caller should make the test. */
7fd59977 3962/* > */
3963/* **********************************************************************
3964*/
3965
3966
0d969553 3967/* Name of the routine */
7fd59977 3968
3969
0d969553
Y
3970/* Common MLGDRTL: */
3971/* This common includes POSITIVE roots of Legendre polynoms */
3972/* AND the weight of Gauss quadrature formulas on all */
3973/* POSITIVE roots of Legendre polynoms. */
7fd59977 3974
3975/* ***********************************************************************
3976 */
3977
0d969553 3978/* FUNCTION : */
7fd59977 3979/* ---------- */
0d969553 3980/* The common of Legendre roots. */
7fd59977 3981
0d969553 3982/* KEYWORDS : */
7fd59977 3983/* ----------- */
3984/* BASE LEGENDRE */
3985
7fd59977 3986
7fd59977 3987/* ***********************************************************************
3988 */
3989
0d969553
Y
3990/* ROOTAB : Table of all roots of Legendre polynoms */
3991/* within the interval [0,1]. They are ranked for the degrees increasing from */
3992/* 2 to 61. */
3993/* HILTAB : Table of Legendre interpolators concerning ROOTAB. */
3994/* The adressing is the same. */
3995/* HI0TAB : Table of Legendre interpolators for root x=0 */
3996/* of polynoms of UNEVEN degree. */
3997/* RTLTB0 : Table of Li(uk) where uk are the roots of */
3998/* Legendre polynom of EVEN degree. */
3999/* RTLTB1 : Table of Li(uk) where uk are the roots of */
4000/* Legendre polynom of UNEVEN degree. */
7fd59977 4001
4002
4003/************************************************************************
4004*****/
4005 /* Parameter adjustments */
4006 --rootlg;
4007
4008 /* Function Body */
4009 ibb = AdvApp2Var_SysBase::mnfndeb_();
4010 if (ibb >= 3) {
4011 AdvApp2Var_SysBase::mgenmsg_("MMEXTRL", 7L);
4012 }
4013
4014 ndeg2 = *ndegre / 2;
4015 nmod2 = *ndegre % 2;
4016
0d969553
Y
4017/* Address of the 1st strictly positive root of Legendre polynom */
4018/* of degree NDEGRE in MLGDRTL. */
7fd59977 4019
4020 iadd = ndeg2 * (ndeg2 - 1) / 2 + 1;
4021
0d969553
Y
4022/* Indice, in ROOTLG, of the 1st strictly positive root */
4023/* of Legendre polynom of degree NDEGRE. */
7fd59977 4024
4025 ideb = (*ndegre + 1) / 2 + 1;
4026
0d969553 4027/* Reading of strictly positive roots. */
7fd59977 4028
4029 i__1 = *ndegre;
4030 for (ii = ideb; ii <= i__1; ++ii) {
4031 kpt = iadd + ii - ideb;
4032 rootlg[ii] = mlgdrtl_.rootab[kpt + nmod2 * 465 - 1];
4033/* L100: */
4034 }
4035
0d969553 4036/* Strictly negative roots are equal to positive roots
7fd59977 4037*/
0d969553 4038/* to the sign i.e RT(1) = -RT(NDEGRE), RT(2) = -RT(NDEGRE-1), etc...
7fd59977 4039*/
4040
4041 i__1 = ndeg2;
4042 for (ii = 1; ii <= i__1; ++ii) {
4043 rootlg[ii] = -rootlg[*ndegre + 1 - ii];
4044/* L200: */
4045 }
4046
0d969553 4047/* Case NDEGRE uneven, 0 is root of Legendre polynom. */
7fd59977 4048
4049 if (nmod2 == 1) {
4050 rootlg[ndeg2 + 1] = 0.;
4051 }
4052
4053/* -------------------------------- THE END -----------------------------
4054*/
4055
4056 if (ibb >= 3) {
4057 AdvApp2Var_SysBase::mgenmsg_("MMEXTRL", 7L);
4058 }
4059 return 0;
4060} /* mmextrl_ */
4061
4062//=======================================================================
4063//function : AdvApp2Var_MathBase::mmfmca8_
4064//purpose :
4065//=======================================================================
fadcea2c
RL
4066int AdvApp2Var_MathBase::mmfmca8_(const integer *ndimen,
4067 const integer *ncoefu,
4068 const integer *ncoefv,
4069 const integer *ndimax,
4070 const integer *ncfumx,
4071 const integer *,//ncfvmx,
7fd59977 4072 doublereal *tabini,
4073 doublereal *tabres)
4074
4075{
4076 /* System generated locals */
4077 integer tabini_dim1, tabini_dim2, tabini_offset, tabres_dim1, tabres_dim2,
4078 tabres_offset;
4079
4080 /* Local variables */
1ef32e96 4081 integer i__, j, k, ilong;
7fd59977 4082
4083
4084
4085/* **********************************************************************
4086*/
4087
0d969553 4088/* FUNCTION : */
7fd59977 4089/* ---------- */
0d969553
Y
4090/* Expansion of a table containing only most important things into a */
4091/* greater data table. */
7fd59977 4092
0d969553 4093/* KEYWORDS : */
7fd59977 4094/* ----------- */
0d969553 4095/* ALL, MATH_ACCES:: CARREAU&, DECOMPRESSION, &CARREAU */
7fd59977 4096
0d969553 4097/* INPUT ARGUMENTS : */
7fd59977 4098/* ------------------ */
0d969553
Y
4099/* NDIMEN: Dimension of the workspace. */
4100/* NCOEFU: Degree +1 of the table by u. */
4101/* NCOEFV: Degree +1 of the table by v. */
4102/* NDIMAX: Max dimension of the space. */
4103/* NCFUMX: Max Degree +1 of the table by u. */
4104/* NCFVMX: Max Degree +1 of the table by v. */
4105/* TABINI: The table to be decompressed. */
4106
4107/* OUTPUT ARGUMENTS : */
7fd59977 4108/* ------------------- */
0d969553 4109/* TABRES: Decompressed table. */
7fd59977 4110
0d969553 4111/* COMMONS USED : */
7fd59977 4112/* ---------------- */
4113
0d969553 4114/* REFERENCES CALLED : */
7fd59977 4115/* ----------------------- */
4116
0d969553 4117/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 4118/* ----------------------------------- */
0d969553 4119/* The following call : */
7fd59977 4120
4121/* CALL MMFMCA8(NDIMEN,NCOEFU,NCOEFV,NDIMAX,NCFUMX,NCFVMX,TABINI,TABINI)
4122*/
4123
0d969553
Y
4124/* where TABINI is input/output argument, is possible provided */
4125/* that the caller has declared TABINI in (NDIMAX,NCFUMX,NCFVMX) */
7fd59977 4126
0d969553
Y
4127/* ATTENTION : it is not checked that NDIMAX >= NDIMEN, */
4128/* NCOEFU >= NCFMXU and NCOEFV >= NCFMXV. */
7fd59977 4129/* > */
4130/* **********************************************************************
4131*/
4132
4133
4134 /* Parameter adjustments */
4135 tabini_dim1 = *ndimen;
4136 tabini_dim2 = *ncoefu;
4137 tabini_offset = tabini_dim1 * (tabini_dim2 + 1) + 1;
4138 tabini -= tabini_offset;
4139 tabres_dim1 = *ndimax;
4140 tabres_dim2 = *ncfumx;
4141 tabres_offset = tabres_dim1 * (tabres_dim2 + 1) + 1;
4142 tabres -= tabres_offset;
4143
4144 /* Function Body */
4145 if (*ndimax == *ndimen) {
4146 goto L1000;
4147 }
4148
4149/* ----------------------- decompression NDIMAX<>NDIMEN -----------------
4150*/
4151
4152 for (k = *ncoefv; k >= 1; --k) {
4153 for (j = *ncoefu; j >= 1; --j) {
4154 for (i__ = *ndimen; i__ >= 1; --i__) {
4155 tabres[i__ + (j + k * tabres_dim2) * tabres_dim1] = tabini[
4156 i__ + (j + k * tabini_dim2) * tabini_dim1];
4157/* L300: */
4158 }
4159/* L200: */
4160 }
4161/* L100: */
4162 }
4163 goto L9999;
4164
4165/* ----------------------- decompression NDIMAX=NDIMEN ------------------
4166*/
4167
4168L1000:
4169 if (*ncoefu == *ncfumx) {
4170 goto L2000;
4171 }
4172 ilong = (*ndimen << 3) * *ncoefu;
4173 for (k = *ncoefv; k >= 1; --k) {
fadcea2c
RL
4174 AdvApp2Var_SysBase::mcrfill_(&ilong,
4175 &tabini[(k * tabini_dim2 + 1) * tabini_dim1 + 1],
4176 &tabres[(k * tabres_dim2 + 1) * tabres_dim1 + 1]);
7fd59977 4177/* L500: */
4178 }
4179 goto L9999;
4180
4181/* ----------------- decompression NDIMAX=NDIMEN,NCOEFU=NCFUMX ----------
4182*/
4183
4184L2000:
4185 ilong = (*ndimen << 3) * *ncoefu * *ncoefv;
fadcea2c
RL
4186 AdvApp2Var_SysBase::mcrfill_(&ilong,
4187 &tabini[tabini_offset],
4188 &tabres[tabres_offset]);
7fd59977 4189 goto L9999;
4190
4191/* ---------------------------- The end ---------------------------------
4192*/
4193
4194L9999:
4195 return 0;
4196} /* mmfmca8_ */
4197
4198//=======================================================================
4199//function : AdvApp2Var_MathBase::mmfmca9_
4200//purpose :
4201//=======================================================================
4202 int AdvApp2Var_MathBase::mmfmca9_(integer *ndimax,
4203 integer *ncfumx,
4204 integer *,//ncfvmx,
4205 integer *ndimen,
4206 integer *ncoefu,
4207 integer *ncoefv,
4208 doublereal *tabini,
4209 doublereal *tabres)
4210
4211{
4212 /* System generated locals */
4213 integer tabini_dim1, tabini_dim2, tabini_offset, tabres_dim1, tabres_dim2,
4214 tabres_offset, i__1, i__2, i__3;
4215
4216 /* Local variables */
1ef32e96 4217 integer i__, j, k, ilong;
7fd59977 4218
4219
4220
4221/* **********************************************************************
4222*/
4223
0d969553 4224/* FUNCTION : */
7fd59977 4225/* ---------- */
0d969553
Y
4226/* Compression of a data table in a table */
4227/* containing only the main data (the input table is not removed). */
7fd59977 4228
0d969553 4229/* KEYWORDS: */
7fd59977 4230/* ----------- */
0d969553 4231/* ALL, MATH_ACCES:: CARREAU&, COMPRESSION, &CARREAU */
7fd59977 4232
0d969553 4233/* INPUT ARGUMENTS : */
7fd59977 4234/* ------------------ */
0d969553
Y
4235/* NDIMAX: Max dimension of the space. */
4236/* NCFUMX: Max degree +1 of the table by u. */
4237/* NCFVMX: Max degree +1 of the table by v. */
4238/* NDIMEN: Dimension of the workspace. */
4239/* NCOEFU: Degree +1 of the table by u. */
4240/* NCOEFV: Degree +1 of the table by v. */
4241/* TABINI: The table to compress. */
4242
4243/* OUTPUT ARGUMENTS : */
7fd59977 4244/* ------------------- */
0d969553 4245/* TABRES: The compressed table. */
7fd59977 4246
0d969553 4247/* COMMONS USED : */
7fd59977 4248/* ---------------- */
4249
0d969553 4250/* REFERENCES CALLED : */
7fd59977 4251/* ----------------------- */
4252
0d969553 4253/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 4254/* ----------------------------------- */
0d969553 4255/* The following call : */
7fd59977 4256
4257/* CALL MMFMCA9(NDIMAX,NCFUMX,NCFVMX,NDIMEN,NCOEFU,NCOEFV,TABINI,TABINI)
4258*/
4259
0d969553
Y
4260/* where TABINI is input/output argument, is possible provided */
4261/* that the caller has checked that : */
7fd59977 4262
4263/* NDIMAX > NDIMEN, */
0d969553
Y
4264/* or NDIMAX = NDIMEN and NCFUMX > NCOEFU */
4265/* or NDIMAX = NDIMEN, NCFUMX = NCOEFU and NCFVMX > NCOEFV */
7fd59977 4266
0d969553 4267/* These conditions are not tested in the program. */
7fd59977 4268
7fd59977 4269/* > */
4270/* **********************************************************************
4271*/
4272
4273
4274 /* Parameter adjustments */
4275 tabini_dim1 = *ndimax;
4276 tabini_dim2 = *ncfumx;
4277 tabini_offset = tabini_dim1 * (tabini_dim2 + 1) + 1;
4278 tabini -= tabini_offset;
4279 tabres_dim1 = *ndimen;
4280 tabres_dim2 = *ncoefu;
4281 tabres_offset = tabres_dim1 * (tabres_dim2 + 1) + 1;
4282 tabres -= tabres_offset;
4283
4284 /* Function Body */
4285 if (*ndimen == *ndimax) {
4286 goto L1000;
4287 }
4288
4289/* ----------------------- Compression NDIMEN<>NDIMAX -------------------
4290*/
4291
4292 i__1 = *ncoefv;
4293 for (k = 1; k <= i__1; ++k) {
4294 i__2 = *ncoefu;
4295 for (j = 1; j <= i__2; ++j) {
4296 i__3 = *ndimen;
4297 for (i__ = 1; i__ <= i__3; ++i__) {
4298 tabres[i__ + (j + k * tabres_dim2) * tabres_dim1] = tabini[
4299 i__ + (j + k * tabini_dim2) * tabini_dim1];
4300/* L300: */
4301 }
4302/* L200: */
4303 }
4304/* L100: */
4305 }
4306 goto L9999;
4307
4308/* ----------------------- Compression NDIMEN=NDIMAX --------------------
4309*/
4310
4311L1000:
4312 if (*ncoefu == *ncfumx) {
4313 goto L2000;
4314 }
4315 ilong = (*ndimen << 3) * *ncoefu;
4316 i__1 = *ncoefv;
4317 for (k = 1; k <= i__1; ++k) {
fadcea2c
RL
4318 AdvApp2Var_SysBase::mcrfill_(&ilong,
4319 &tabini[(k * tabini_dim2 + 1) * tabini_dim1 + 1],
4320 &tabres[(k * tabres_dim2 + 1) * tabres_dim1 + 1]);
7fd59977 4321/* L500: */
4322 }
4323 goto L9999;
4324
4325/* ----------------- Compression NDIMEN=NDIMAX,NCOEFU=NCFUMX ------------
4326*/
4327
4328L2000:
4329 ilong = (*ndimen << 3) * *ncoefu * *ncoefv;
fadcea2c
RL
4330 AdvApp2Var_SysBase::mcrfill_(&ilong,
4331 &tabini[tabini_offset],
4332 &tabres[tabres_offset]);
7fd59977 4333 goto L9999;
4334
4335/* ---------------------------- The end ---------------------------------
4336*/
4337
4338L9999:
4339 return 0;
4340} /* mmfmca9_ */
4341
4342//=======================================================================
4343//function : AdvApp2Var_MathBase::mmfmcar_
4344//purpose :
4345//=======================================================================
4346int AdvApp2Var_MathBase::mmfmcar_(integer *ndimen,
4347 integer *ncofmx,
4348 integer *ncoefu,
4349 integer *ncoefv,
4350 doublereal *patold,
4351 doublereal *upara1,
4352 doublereal *upara2,
4353 doublereal *vpara1,
4354 doublereal *vpara2,
4355 doublereal *patnew,
4356 integer *iercod)
4357
4358{
1ef32e96 4359 integer c__8 = 8;
7fd59977 4360 /* System generated locals */
4361 integer patold_dim1, patold_dim2, patnew_dim1, patnew_dim2,
4362 i__1, patold_offset,patnew_offset;
4363
4364 /* Local variables */
1ef32e96
RL
4365 doublereal* tbaux = 0;
4366 integer ksize, numax, kk;
4367 intptr_t iofst;
4368 integer ibb, ier;
7fd59977 4369
4370/* ***********************************************************************
4371 */
4372
0d969553 4373/* FUNCTION : */
7fd59977 4374/* ---------- */
0d969553
Y
4375/* LIMITATION OF A SQUARE DEFINED ON (0,1)*(0,1) BETWEEN ISOS */
4376/* UPARA1 AND UPARA2 (BY U) AND VPARA1 AND VPARA2 BY V. */
7fd59977 4377
0d969553 4378/* KEYWORDS : */
7fd59977 4379/* ----------- */
0d969553 4380/* LIMITATION , SQUARE , PARAMETER */
7fd59977 4381
0d969553 4382/* INPUT ARGUMENTS : */
7fd59977 4383/* ------------------ */
0d969553
Y
4384/* NCOFMX: MAX NUMBER OF COEFF OF THE SQUARE BY U */
4385/* NCOEFU: NUMBER OF COEFF OF THE SQUARE BY U */
4386/* NCOEFV: NUMBER OF COEFF OF THE SQUARE BY V */
4387/* PATOLD : THE SQUARE IS LIMITED BY UPARA1,UPARA2 AND VPARA1,VPARA2
7fd59977 4388.*/
0d969553
Y
4389/* UPARA1 : LOWER LIMIT OF U */
4390/* UPARA2 : UPPER LIMIT OF U */
4391/* VPARA1 : LOWER LIMIT OF V */
4392/* VPARA2 : UPPER LIMIT OF V */
7fd59977 4393
0d969553 4394/* OUTPUT ARGUMENTS : */
7fd59977 4395/* ------------------- */
0d969553
Y
4396/* PATNEW : RELIMITED SQUARE, DEFINED ON (0,1)**2 */
4397/* IERCOD : =10 COEFF NB TOO GREAT OR NULL */
4398/* =13 PB IN THE DYNAMIC ALLOCATION */
7fd59977 4399/* = 0 OK. */
4400
0d969553 4401/* COMMONS USED : */
7fd59977 4402/* ---------------- */
4403
0d969553 4404/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 4405/* ----------------------------------- */
0d969553 4406/* ---> The following call : */
7fd59977 4407/* CALL MMFMCAR(NCOFMX,NCOEFU,NCOEFV,PATOLD,UPARA1,UPARA2,VPARA1,VPARA2
4408*/
4409/* ,PATOLD), */
0d969553 4410/* where PATOLD is input/output argument is absolutely legal. */
7fd59977 4411
0d969553 4412/* ---> The max number of coeff by u and v of PATOLD is 61 */
7fd59977 4413
258ff83b 4414/* ---> If NCOEFU < NCOFMX, the data is compressed by MMFMCA9 before */
0d969553
Y
4415/* limitation by v to get time during the execution */
4416/* of MMARC41 that follows (the square is processed as a curve of
7fd59977 4417*/
0d969553 4418/* dimension NDIMEN*NCOEFU possessing NCOEFV coefficients). */
7fd59977 4419/* > */
4420/* ***********************************************************************
4421 */
4422
0d969553 4423/* Name of the routine */
7fd59977 4424
4425
4426 /* Parameter adjustments */
4427 patnew_dim1 = *ndimen;
4428 patnew_dim2 = *ncofmx;
4429 patnew_offset = patnew_dim1 * (patnew_dim2 + 1) + 1;
4430 patnew -= patnew_offset;
4431 patold_dim1 = *ndimen;
4432 patold_dim2 = *ncofmx;
4433 patold_offset = patold_dim1 * (patold_dim2 + 1) + 1;
4434 patold -= patold_offset;
4435
4436 /* Function Body */
4437 ibb = AdvApp2Var_SysBase::mnfndeb_();
4438 if (ibb >= 2) {
4439 AdvApp2Var_SysBase::mgenmsg_("MMFMCAR", 7L);
4440 }
4441 *iercod = 0;
4442 iofst = 0;
1ef32e96 4443 AdvApp2Var_SysBase anAdvApp2Var_SysBase;
7fd59977 4444
4445/* **********************************************************************
4446*/
0d969553 4447/* TEST OF COEFFICIENT NUMBERS */
7fd59977 4448/* **********************************************************************
4449*/
4450
4451 if (*ncofmx < *ncoefu) {
4452 *iercod = 10;
4453 goto L9999;
4454 }
4455 if (*ncoefu < 1 || *ncoefu > 61 || *ncoefv < 1 || *ncoefv > 61) {
4456 *iercod = 10;
4457 goto L9999;
4458 }
4459
4460/* **********************************************************************
4461*/
0d969553 4462/* CASE WHEN UPARA1=VPARA1=0 AND UPARA2=VPARA2=1 */
7fd59977 4463/* **********************************************************************
4464*/
4465
4466 if (*upara1 == 0. && *upara2 == 1. && *vpara1 == 0. && *vpara2 == 1.) {
4467 ksize = (*ndimen << 3) * *ncofmx * *ncoefv;
fadcea2c
RL
4468 AdvApp2Var_SysBase::mcrfill_(&ksize,
4469 &patold[patold_offset],
4470 &patnew[patnew_offset]);
7fd59977 4471 goto L9999;
4472 }
4473
4474/* **********************************************************************
4475*/
0d969553 4476/* LIMITATION BY U */
7fd59977 4477/* **********************************************************************
4478*/
4479
4480 if (*upara1 == 0. && *upara2 == 1.) {
4481 goto L2000;
4482 }
4483 i__1 = *ncoefv;
4484 for (kk = 1; kk <= i__1; ++kk) {
4485 mmarc41_(ndimen, ndimen, ncoefu, &patold[(kk * patold_dim2 + 1) *
4486 patold_dim1 + 1], upara1, upara2, &patnew[(kk * patnew_dim2 +
4487 1) * patnew_dim1 + 1], iercod);
4488/* L100: */
4489 }
4490
4491/* **********************************************************************
4492*/
0d969553 4493/* LIMITATION BY V */
7fd59977 4494/* **********************************************************************
4495*/
4496
4497L2000:
4498 if (*vpara1 == 0. && *vpara2 == 1.) {
4499 goto L9999;
4500 }
4501
0d969553 4502/* ----------- LIMITATION BY V (WITH COMPRESSION I.E. NCOEFU<NCOFMX) ----
7fd59977 4503*/
4504
4505 numax = *ndimen * *ncoefu;
4506 if (*ncofmx != *ncoefu) {
0d969553 4507/* ------------------------- Dynamic allocation -------------------
7fd59977 4508---- */
4509 ksize = *ndimen * *ncoefu * *ncoefv;
1ef32e96 4510 anAdvApp2Var_SysBase.mcrrqst_(&c__8, &ksize, tbaux, &iofst, &ier);
7fd59977 4511 if (ier > 0) {
4512 *iercod = 13;
4513 goto L9900;
4514 }
0d969553 4515/* --------------- Compression by (NDIMEN,NCOEFU,NCOEFV) ------------
7fd59977 4516---- */
4517 if (*upara1 == 0. && *upara2 == 1.) {
4518 AdvApp2Var_MathBase::mmfmca9_(ndimen,
4519 ncofmx,
4520 ncoefv,
4521 ndimen,
4522 ncoefu,
4523 ncoefv,
4524 &patold[patold_offset],
4525 &tbaux[iofst]);
4526 } else {
4527 AdvApp2Var_MathBase::mmfmca9_(ndimen,
4528 ncofmx,
4529 ncoefv,
4530 ndimen,
4531 ncoefu,
4532 ncoefv,
4533 &patnew[patnew_offset],
4534 &tbaux[iofst]);
4535 }
0d969553 4536/* ------------------------- Limitation by v ------------------------
7fd59977 4537---- */
4538 mmarc41_(&numax, &numax, ncoefv, &tbaux[iofst], vpara1, vpara2, &
4539 tbaux[iofst], iercod);
0d969553 4540/* --------------------- Expansion of TBAUX into PATNEW -------------
7fd59977 4541--- */
4542 AdvApp2Var_MathBase::mmfmca8_(ndimen, ncoefu, ncoefv, ndimen, ncofmx, ncoefv, &tbaux[iofst]
4543 , &patnew[patnew_offset]);
4544 goto L9900;
4545
0d969553 4546/* -------- LIMITATION BY V (WITHOUT COMPRESSION I.E. NCOEFU=NCOFMX) ---
7fd59977 4547---- */
4548
4549 } else {
4550 if (*upara1 == 0. && *upara2 == 1.) {
4551 mmarc41_(&numax, &numax, ncoefv, &patold[patold_offset], vpara1,
4552 vpara2, &patnew[patnew_offset], iercod);
4553 } else {
4554 mmarc41_(&numax, &numax, ncoefv, &patnew[patnew_offset], vpara1,
4555 vpara2, &patnew[patnew_offset], iercod);
4556 }
4557 goto L9999;
4558 }
4559
4560/* **********************************************************************
4561*/
4562/* DESALLOCATION */
4563/* **********************************************************************
4564*/
4565
4566L9900:
4567 if (iofst != 0) {
1ef32e96 4568 anAdvApp2Var_SysBase.mcrdelt_(&c__8, &ksize, tbaux, &iofst, &ier);
7fd59977 4569 }
4570 if (ier > 0) {
4571 *iercod = 13;
4572 }
4573
4574/* ------------------------------ The end -------------------------------
4575*/
4576
4577L9999:
4578 if (*iercod > 0) {
4579 AdvApp2Var_SysBase::maermsg_("MMFMCAR", iercod, 7L);
4580 }
4581 if (ibb >= 2) {
4582 AdvApp2Var_SysBase::mgsomsg_("MMFMCAR", 7L);
4583 }
4584 return 0;
4585} /* mmfmcar_ */
4586
4587
4588//=======================================================================
4589//function : AdvApp2Var_MathBase::mmfmcb5_
4590//purpose :
4591//=======================================================================
4592int AdvApp2Var_MathBase::mmfmcb5_(integer *isenmsc,
4593 integer *ndimax,
4594 integer *ncf1mx,
4595 doublereal *courb1,
4596 integer *ncoeff,
4597 integer *ncf2mx,
4598 integer *ndimen,
4599 doublereal *courb2,
4600 integer *iercod)
4601
4602{
4603 /* System generated locals */
4604 integer courb1_dim1, courb1_offset, courb2_dim1, courb2_offset, i__1,
4605 i__2;
4606
4607 /* Local variables */
1ef32e96 4608 integer i__, nboct, nd;
7fd59977 4609
4610
4611/* **********************************************************************
4612*/
4613
0d969553 4614/* FUNCTION : */
7fd59977 4615/* ---------- */
0d969553
Y
4616/* Reformating (and eventual compression/decompression) of curve */
4617/* (ndim,.) by (.,ndim) and vice versa. */
7fd59977 4618
0d969553 4619/* KEYWORDS : */
7fd59977 4620/* ----------- */
0d969553 4621/* ALL , MATH_ACCES :: */
7fd59977 4622/* COURBE&, REORGANISATION,COMPRESSION,INVERSION , &COURBE */
4623
0d969553 4624/* INPUT ARGUMENTS : */
7fd59977 4625/* -------------------- */
0d969553
Y
4626/* ISENMSC : required direction of the transfer : */
4627/* 1 : passage of (NDIMEN,.) ---> (.,NDIMEN) direction to AB
7fd59977 4628*/
0d969553 4629/* -1 : passage of (.,NDIMEN) ---> (NDIMEN,.) direction to TS,T
7fd59977 4630V*/
4631/* NDIMAX : format / dimension */
0d969553
Y
4632/* NCF1MX : format by t of COURB1 */
4633/* if ISENMSC= 1 : COURB1: The curve to be processed (NDIMAX,.) */
4634/* NCOEFF : number of coeff of the curve */
4635/* NCF2MX : format by t of COURB2 */
4636/* NDIMEN : dimension of the curve and format of COURB2 */
4637/* if ISENMSC=-1 : COURB2: The curve to be processed (.,NDIMEN) */
4638
4639/* OUTPUT ARGUMENTS : */
7fd59977 4640/* --------------------- */
0d969553
Y
4641/* if ISENMSC= 1 : COURB2: The resulting curve (.,NDIMEN) */
4642/* if ISENMSC=-1 : COURB1: The resulting curve (NDIMAX,.) */
7fd59977 4643
0d969553 4644/* COMMONS USED : */
7fd59977 4645/* ------------------ */
4646
0d969553 4647/* REFERENCES CALLED : */
7fd59977 4648/* --------------------- */
4649
0d969553 4650/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 4651/* ----------------------------------- */
0d969553 4652/* allow to process the usual transfers as follows : */
7fd59977 4653/* | ---- ISENMSC = 1 ---- | | ---- ISENMSC =-1 ----- | */
4654/* TS (3,21) --> (21,3) AB ; AB (21,3) --> (3,21) TS */
4655/* TS (3,21) --> (NU,3) AB ; AB (NU,3) --> (3,21) TS */
4656/* (3,NU) --> (21,3) AB ; AB (21,3) --> (3,NU) */
4657/* (3,NU) --> (NU,3) AB ; AB (NU,3) --> (3,NU) */
7fd59977 4658/* > */
4659/* ***********************************************************************
4660 */
4661
4662
4663 /* Parameter adjustments */
4664 courb1_dim1 = *ndimax;
4665 courb1_offset = courb1_dim1 + 1;
4666 courb1 -= courb1_offset;
4667 courb2_dim1 = *ncf2mx;
4668 courb2_offset = courb2_dim1 + 1;
4669 courb2 -= courb2_offset;
4670
4671 /* Function Body */
4672 if (*ndimen > *ndimax || *ncoeff > *ncf1mx || *ncoeff > *ncf2mx) {
4673 goto L9119;
4674 }
4675
4676 if (*ndimen == 1 && *ncf1mx == *ncf2mx) {
4677 nboct = *ncf2mx << 3;
4678 if (*isenmsc == 1) {
fadcea2c
RL
4679 AdvApp2Var_SysBase::mcrfill_(&nboct,
4680 &courb1[courb1_offset],
4681 &courb2[courb2_offset]);
7fd59977 4682 }
4683 if (*isenmsc == -1) {
fadcea2c
RL
4684 AdvApp2Var_SysBase::mcrfill_(&nboct,
4685 &courb2[courb2_offset],
4686 &courb1[courb1_offset]);
7fd59977 4687 }
4688 *iercod = -3136;
4689 goto L9999;
4690 }
4691
4692 *iercod = 0;
4693 if (*isenmsc == 1) {
4694 i__1 = *ndimen;
4695 for (nd = 1; nd <= i__1; ++nd) {
4696 i__2 = *ncoeff;
4697 for (i__ = 1; i__ <= i__2; ++i__) {
4698 courb2[i__ + nd * courb2_dim1] = courb1[nd + i__ *
4699 courb1_dim1];
4700/* L400: */
4701 }
4702/* L500: */
4703 }
4704 } else if (*isenmsc == -1) {
4705 i__1 = *ndimen;
4706 for (nd = 1; nd <= i__1; ++nd) {
4707 i__2 = *ncoeff;
4708 for (i__ = 1; i__ <= i__2; ++i__) {
4709 courb1[nd + i__ * courb1_dim1] = courb2[i__ + nd *
4710 courb2_dim1];
4711/* L1400: */
4712 }
4713/* L1500: */
4714 }
4715 } else {
4716 *iercod = 3164;
4717 }
4718
4719 goto L9999;
4720
4721/* ***********************************************************************
4722 */
4723
4724L9119:
4725 *iercod = 3119;
4726
4727L9999:
4728 if (*iercod != 0) {
4729 AdvApp2Var_SysBase::maermsg_("MMFMCB5", iercod, 7L);
4730 }
4731 return 0;
4732} /* mmfmcb5_ */
4733
4734//=======================================================================
4735//function : AdvApp2Var_MathBase::mmfmtb1_
4736//purpose :
4737//=======================================================================
4738int AdvApp2Var_MathBase::mmfmtb1_(integer *maxsz1,
4739 doublereal *table1,
4740 integer *isize1,
4741 integer *jsize1,
4742 integer *maxsz2,
4743 doublereal *table2,
4744 integer *isize2,
4745 integer *jsize2,
4746 integer *iercod)
4747{
1ef32e96 4748 integer c__8 = 8;
7fd59977 4749
4750 /* System generated locals */
4751 integer table1_dim1, table1_offset, table2_dim1, table2_offset, i__1,
4752 i__2;
4753
4754 /* Local variables */
1ef32e96 4755 doublereal* work = 0;
1d47d8d0 4756 integer ilong, isize, ii, jj, ier = 0;
4757 intptr_t iofst = 0,iipt, jjpt;
7fd59977 4758
4759
4760/************************************************************************
4761*******/
4762
0d969553 4763/* FUNCTION : */
7fd59977 4764/* ---------- */
0d969553
Y
4765/* Inversion of elements of a rectangular table (T1(i,j) */
4766/* loaded in T2(j,i)) */
7fd59977 4767
0d969553 4768/* KEYWORDS : */
7fd59977 4769/* ----------- */
0d969553 4770/* ALL, MATH_ACCES :: TABLEAU&, INVERSION, &TABLEAU */
7fd59977 4771
0d969553 4772/* INPUT ARGUMENTS : */
7fd59977 4773/* ------------------ */
0d969553
Y
4774/* MAXSZ1: Max Nb of elements by the 1st dimension of TABLE1. */
4775/* TABLE1: Table of reals by two dimensions. */
4776/* ISIZE1: Nb of useful elements of TABLE1 on the 1st dimension */
4777/* JSIZE1: Nb of useful elements of TABLE1 on the 2nd dimension */
4778/* MAXSZ2: Nb max of elements by the 1st dimension of TABLE2. */
4779
4780/* OUTPUT ARGUMENTS : */
7fd59977 4781/* ------------------- */
258ff83b 4782/* TABLE2: Table of reals by two dimensions, containing the transposition */
0d969553
Y
4783/* of the rectangular table TABLE1. */
4784/* ISIZE2: Nb of useful elements of TABLE2 on the 1st dimension */
4785/* JSIZE2: Nb of useful elements of TABLE2 on the 2nd dimension */
4786/* IERCOD: Erroe coder. */
7fd59977 4787/* = 0, ok. */
0d969553
Y
4788/* = 1, error in the dimension of tables */
4789/* ether MAXSZ1 < ISIZE1 (table TABLE1 too small). */
4790/* or MAXSZ2 < JSIZE1 (table TABLE2 too small). */
7fd59977 4791
0d969553 4792/* COMMONS USED : */
7fd59977 4793/* ---------------- */
4794
0d969553 4795/* REFERENCES CALLED : */
7fd59977 4796/* ---------------------- */
4797
0d969553 4798/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 4799/* ----------------------------------- */
0d969553
Y
4800/* It is possible to use TABLE1 as input and output table i.e. */
4801/* call: */
7fd59977 4802/* CALL MMFMTB1(MAXSZ1,TABLE1,ISIZE1,JSIZE1,MAXSZ2,TABLE1 */
4803/* ,ISIZE2,JSIZE2,IERCOD) */
0d969553 4804/* is valuable. */
7fd59977 4805/* > */
4806/* **********************************************************************
4807*/
4808
4809
4810 /* Parameter adjustments */
4811 table1_dim1 = *maxsz1;
4812 table1_offset = table1_dim1 + 1;
4813 table1 -= table1_offset;
4814 table2_dim1 = *maxsz2;
4815 table2_offset = table2_dim1 + 1;
4816 table2 -= table2_offset;
1ef32e96 4817 AdvApp2Var_SysBase anAdvApp2Var_SysBase;
7fd59977 4818
4819 /* Function Body */
4820 *iercod = 0;
4821 if (*isize1 > *maxsz1 || *jsize1 > *maxsz2) {
4822 goto L9100;
4823 }
4824
4825 iofst = 0;
4826 isize = *maxsz2 * *isize1;
1ef32e96 4827 anAdvApp2Var_SysBase.mcrrqst_(&c__8, &isize, work, &iofst, &ier);
7fd59977 4828 if (ier > 0) {
4829 goto L9200;
4830 }
4831
0d969553 4832/* DO NOT BE AFRAID OF CRUSHING. */
7fd59977 4833
4834 i__1 = *isize1;
4835 for (ii = 1; ii <= i__1; ++ii) {
4836 iipt = (ii - 1) * *maxsz2 + iofst;
4837 i__2 = *jsize1;
4838 for (jj = 1; jj <= i__2; ++jj) {
4839 jjpt = iipt + (jj - 1);
4840 work[jjpt] = table1[ii + jj * table1_dim1];
4841/* L200: */
4842 }
4843/* L100: */
4844 }
4845 ilong = isize << 3;
fadcea2c
RL
4846 AdvApp2Var_SysBase::mcrfill_(&ilong,
4847 &work[iofst],
4848 &table2[table2_offset]);
7fd59977 4849
0d969553 4850/* -------------- The number of elements of TABLE2 is returned ------------
7fd59977 4851*/
4852
4853 ii = *isize1;
4854 *isize2 = *jsize1;
4855 *jsize2 = ii;
4856
4857 goto L9999;
4858
4859/* ------------------------------- THE END ------------------------------
4860*/
0d969553 4861/* --> Invalid input. */
7fd59977 4862L9100:
4863 *iercod = 1;
4864 goto L9999;
0d969553 4865/* --> Pb of allocation. */
7fd59977 4866L9200:
4867 *iercod = 2;
4868 goto L9999;
4869
4870L9999:
4871 if (iofst != 0) {
1ef32e96 4872 anAdvApp2Var_SysBase.mcrdelt_(&c__8, &isize, work, &iofst, &ier);
7fd59977 4873 }
4874 if (ier > 0) {
4875 *iercod = 2;
4876 }
4877 return 0;
4878} /* mmfmtb1_ */
4879
4880//=======================================================================
4881//function : AdvApp2Var_MathBase::mmgaus1_
4882//purpose :
4883//=======================================================================
4884int AdvApp2Var_MathBase::mmgaus1_(integer *ndimf,
4885 int (*bfunx) (
4886 integer *ninteg,
4887 doublereal *parame,
4888 doublereal *vfunj1,
4889 integer *iercod
4890 ),
4891
4892 integer *k,
4893 doublereal *xd,
4894 doublereal *xf,
4895 doublereal *saux1,
4896 doublereal *saux2,
4897 doublereal *somme,
4898 integer *niter,
4899 integer *iercod)
4900{
4901 /* System generated locals */
4902 integer i__1, i__2;
4903
4904 /* Local variables */
1ef32e96
RL
4905 integer ndeg;
4906 doublereal h__[20];
4907 integer j;
4908 doublereal t, u[20], x;
4909 integer idimf;
4910 doublereal c1x, c2x;
7fd59977 4911/* **********************************************************************
4912*/
4913
0d969553 4914/* FUNCTION : */
7fd59977 4915/* -------- */
4916
0d969553
Y
4917/* Calculate the integral of function BFUNX passed in parameter */
4918/* between limits XD and XF . */
4919/* The function should be calculated for any value */
4920/* of the variable in the given interval.. */
258ff83b 4921/* The method GAUSS-LEGENDRE is used. */
0d969553 4922/* For explications refer to the book : */
7fd59977 4923/* Complements de mathematiques a l'usage des Ingenieurs de */
4924/* l'electrotechnique et des telecommunications. */
4925/* Par Andre ANGOT - Collection technique et scientifique du CNET
4926 */
4927/* page 772 .... */
0d969553 4928/* The degree of LEGENDRE polynoms used is passed in parameter.
7fd59977 4929 */
0d969553 4930/* KEYWORDS : */
7fd59977 4931/* --------- */
4932/* INTEGRATION,LEGENDRE,GAUSS */
4933
0d969553 4934/* INPUT ARGUMENTS : */
7fd59977 4935/* ------------------ */
4936
0d969553
Y
4937/* NDIMF : Dimension of the function */
4938/* BFUNX : Function to integrate passed as argument */
4939/* Should be declared as EXTERNAL in the call routine. */
7fd59977 4940/* SUBROUTINE BFUNX(NDIMF,X,VAL,IER) */
4941/* REAL *8 X,VAL */
0d969553 4942/* K : Parameter determining the degree of the LEGENDRE polynom that
7fd59977 4943*/
0d969553
Y
4944/* can take a value between 0 and 10. */
4945/* The degree of the polynom is equal to 4 k, that is 4, 8,
7fd59977 4946*/
0d969553
Y
4947/* 12, 16, 20, 24, 28, 32, 36 and 40. */
4948/* If K is not correct, the degree is set to 40 directly.
7fd59977 4949*/
0d969553
Y
4950/* XD : Lower limit of the interval of integration. */
4951/* XF : Upper limit of the interval of integration. */
4952/* SAUX1 : Auxiliary table */
4953/* SAUX2 : Auxiliary table */
7fd59977 4954
0d969553 4955/* OUTPUT ARGUMENTS : */
7fd59977 4956/* ------------------- */
4957
0d969553
Y
4958/* SOMME : Value of the integral */
4959/* NITER : Number of iterations to be carried out. */
4960/* It is equal to the degree of the polynom. */
7fd59977 4961
0d969553 4962/* IER : Error code : */
7fd59977 4963/* < 0 ==> Attention - Warning */
0d969553
Y
4964/* = 0 ==> Everything is OK */
4965/* > 0 ==> Critical error - Apply special processing */
4966/* ==> Error in the calculation of BFUNX (return code */
4967/* of this routine */
7fd59977 4968
0d969553 4969/* If error => SUM = 0 */
7fd59977 4970
0d969553 4971/* COMMONS USED : */
7fd59977 4972/* ----------------- */
4973
4974
4975
0d969553 4976/* REFERENCES CALLED : */
7fd59977 4977/* ---------------------- */
4978
4979/* Type Name */
4980/* @ BFUNX MVGAUS0 */
4981
0d969553 4982/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 4983/* --------------------------------- */
4984
0d969553
Y
4985/* See the explanations detailed in the listing */
4986/* Use of the GAUSS method (orthogonal polynoms) */
4987/* The symmetry of roots of these polynomes is used */
4988/* Depending on K, the degree of the interpolated polynom grows.
7fd59977 4989*/
0d969553
Y
4990/* If you wish to calculate the integral with a given precision, */
4991/* loop on k varying from 1 to 10 and test the difference of 2
7fd59977 4992*/
258ff83b 4993/* consecutive iterations. Stop the loop if this difference is less that */
0d969553
Y
4994/* an epsilon value set to 10E-6 for example. */
4995/* If S1 and S2 are 2 successive iterations, test following this example :
7fd59977 4996 */
4997
4998/* AF=DABS(S1-S2) */
4999/* AS=DABS(S2) */
0d969553 5000/* If AS < 1 test if FS < eps otherwise test if AF/AS < eps
7fd59977 5001*/
5002/* -- ----- ----- */
7fd59977 5003/* > */
5004/************************************************************************
5005******/
5006/* DECLARATIONS */
5007/************************************************************************
5008******/
5009
5010
5011
0d969553 5012/* ****** General Initialization */
7fd59977 5013
5014 /* Parameter adjustments */
5015 --somme;
5016 --saux2;
5017 --saux1;
5018
5019 /* Function Body */
fadcea2c
RL
5020 AdvApp2Var_SysBase::mvriraz_(ndimf,
5021 &somme[1]);
7fd59977 5022 *iercod = 0;
5023
0d969553 5024/* ****** Loading of coefficients U and H ** */
7fd59977 5025/* -------------------------------------------- */
5026
5027 mvgaus0_(k, u, h__, &ndeg, iercod);
5028 if (*iercod > 0) {
5029 goto L9999;
5030 }
5031
0d969553
Y
5032/* ****** C1X => Medium interval point [XD,XF] */
5033/* ****** C2X => 1/2 amplitude interval [XD,XF] */
7fd59977 5034
5035 c1x = (*xf + *xd) * .5;
5036 c2x = (*xf - *xd) * .5;
5037
5038/* ---------------------------------------- */
0d969553 5039/* ****** Integration for degree NDEG ** */
7fd59977 5040/* ---------------------------------------- */
5041
5042 i__1 = ndeg;
5043 for (j = 1; j <= i__1; ++j) {
5044 t = c2x * u[j - 1];
5045
5046 x = c1x + t;
5047 (*bfunx)(ndimf, &x, &saux1[1], iercod);
5048 if (*iercod != 0) {
5049 goto L9999;
5050 }
5051
5052 x = c1x - t;
5053 (*bfunx)(ndimf, &x, &saux2[1], iercod);
5054 if (*iercod != 0) {
5055 goto L9999;
5056 }
5057
5058 i__2 = *ndimf;
5059 for (idimf = 1; idimf <= i__2; ++idimf) {
5060 somme[idimf] += h__[j - 1] * (saux1[idimf] + saux2[idimf]);
5061 }
5062
5063 }
5064
5065 *niter = ndeg << 1;
5066 i__1 = *ndimf;
5067 for (idimf = 1; idimf <= i__1; ++idimf) {
5068 somme[idimf] *= c2x;
5069 }
5070
0d969553 5071/* ****** End of sub-program ** */
7fd59977 5072
5073L9999:
5074
5075 return 0 ;
5076} /* mmgaus1_ */
5077//=======================================================================
5078//function : mmherm0_
5079//purpose :
5080//=======================================================================
5081int mmherm0_(doublereal *debfin,
5082 integer *iercod)
5083{
1ef32e96
RL
5084 integer c__576 = 576;
5085 integer c__6 = 6;
7fd59977 5086
5087
5088 /* System generated locals */
5089 integer i__1, i__2;
5090 doublereal d__1;
5091
5092 /* Local variables */
1ef32e96
RL
5093 doublereal amat[36] /* was [6][6] */;
5094 integer iord[2];
5095 doublereal prod;
5096 integer iord1, iord2;
5097 doublereal miden[36] /* was [6][6] */;
5098 integer ncmat;
5099 doublereal epspi, d1, d2;
5100 integer ii, jj, pp, ncf;
5101 doublereal cof[6];
5102 integer iof[2], ier;
5103 doublereal mat[36] /* was [6][6] */;
5104 integer cot;
5105 doublereal abid[72] /* was [12][6] */;
7fd59977 5106/* ***********************************************************************
5107 */
5108
0d969553 5109/* FUNCTION : */
7fd59977 5110/* ---------- */
0d969553 5111/* INIT OF COEFFS. OF POLYNOMS OF HERMIT INTERPOLATION */
7fd59977 5112
0d969553 5113/* KEYWORDS : */
7fd59977 5114/* ----------- */
5115/* MATH_ACCES :: HERMITE */
5116
0d969553 5117/* INPUT ARGUMENTS */
7fd59977 5118/* -------------------- */
0d969553
Y
5119/* DEBFIN : PARAMETERS DEFINING THE CONSTRAINTS */
5120/* DEBFIN(1) : FIRST PARAMETER */
5121/* DEBFIN(2) : SECOND PARAMETER */
7fd59977 5122
0d969553 5123/* ONE SHOULD HAVE: */
7fd59977 5124/* ABS (DEBFIN(I)) < 100 */
0d969553 5125/* and */
7fd59977 5126/* (ABS(DEBFIN(1)+ABS(DEBFIN(2))) > 1/100 */
0d969553 5127/* (for overflows) */
7fd59977 5128
5129/* ABS(DEBFIN(2)-DEBFIN(1)) / (ABS(DEBFIN(1)+ABS(DEBFIN(2))) > 1/100
5130*/
0d969553 5131/* (for the conditioning) */
7fd59977 5132
5133
0d969553 5134/* OUTPUT ARGUMENTS : */
7fd59977 5135/* --------------------- */
5136
0d969553
Y
5137/* IERCOD : Error code : 0 : O.K. */
5138/* 1 : value of DEBFIN */
5139/* are unreasonable */
5140/* -1 : init was already done */
5141/* (OK but no processing) */
7fd59977 5142
0d969553 5143/* COMMONS USED : */
7fd59977 5144/* ------------------ */
5145
0d969553 5146/* REFERENCES CALLED : */
7fd59977 5147/* ---------------------- */
5148/* Type Name */
5149
0d969553 5150/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 5151/* ----------------------------------- */
5152
0d969553
Y
5153/* This program initializes the coefficients of Hermit polynoms */
5154/* that are read later by MMHERM1 */
7fd59977 5155/* ***********************************************************************
5156 */
5157
5158
5159
5160/* **********************************************************************
5161*/
5162
0d969553 5163/* FUNCTION : */
7fd59977 5164/* ---------- */
258ff83b 5165/* Used to STORE coefficients of Hermit interpolation polynoms */
7fd59977 5166
0d969553 5167/* KEYWORDS : */
7fd59977 5168/* ----------- */
5169/* HERMITE */
5170
0d969553 5171/* DEMSCRIPTION/NOTES/LIMITATIONS : */
7fd59977 5172/* ----------------------------------- */
5173
0d969553
Y
5174/* The coefficients of hermit polynoms are calculated by */
5175/* the routine MMHERM0 and read by the routine MMHERM1 */
7fd59977 5176/* > */
5177/* **********************************************************************
5178*/
5179
5180
5181
5182
5183
0d969553 5184/* NBCOEF is the size of CMHERM (see below) */
7fd59977 5185/* ***********************************************************************
5186 */
5187
5188
5189
5190
5191
5192
5193
5194/* ***********************************************************************
5195 */
0d969553 5196/* Data checking */
7fd59977 5197/* ***********************************************************************
5198 */
5199
5200
5201 /* Parameter adjustments */
5202 --debfin;
5203
5204 /* Function Body */
41194117 5205 d1 = advapp_abs(debfin[1]);
7fd59977 5206 if (d1 > (float)100.) {
5207 goto L9101;
5208 }
5209
41194117 5210 d2 = advapp_abs(debfin[2]);
7fd59977 5211 if (d2 > (float)100.) {
5212 goto L9101;
5213 }
5214
5215 d2 = d1 + d2;
5216 if (d2 < (float).01) {
5217 goto L9101;
5218 }
5219
41194117 5220 d1 = (d__1 = debfin[2] - debfin[1], advapp_abs(d__1));
7fd59977 5221 if (d1 / d2 < (float).01) {
5222 goto L9101;
5223 }
5224
5225
5226/* ***********************************************************************
5227 */
0d969553 5228/* Initialization */
7fd59977 5229/* ***********************************************************************
5230 */
5231
5232 *iercod = 0;
5233
5234 epspi = 1e-10;
5235
5236
5237/* ***********************************************************************
5238 */
5239
0d969553 5240/* IS IT ALREADY INITIALIZED ? */
7fd59977 5241
41194117 5242 d1 = advapp_abs(debfin[1]) + advapp_abs(debfin[2]);
7fd59977 5243 d1 *= 16111959;
5244
5245 if (debfin[1] != mmcmher_.tdebut) {
5246 goto L100;
5247 }
5248 if (debfin[2] != mmcmher_.tfinal) {
5249 goto L100;
5250 }
5251 if (d1 != mmcmher_.verifi) {
5252 goto L100;
5253 }
5254
5255
5256 goto L9001;
5257
5258
5259/* ***********************************************************************
5260 */
0d969553 5261/* CALCULATION */
7fd59977 5262/* ***********************************************************************
5263 */
5264
5265
5266L100:
5267
0d969553 5268/* Init. matrix identity : */
7fd59977 5269
5270 ncmat = 36;
fadcea2c
RL
5271 AdvApp2Var_SysBase::mvriraz_(&ncmat,
5272 miden);
7fd59977 5273
5274 for (ii = 1; ii <= 6; ++ii) {
5275 miden[ii + ii * 6 - 7] = 1.;
5276/* L110: */
5277 }
5278
5279
5280
0d969553 5281/* Init to 0 of table CMHERM */
7fd59977 5282
fadcea2c 5283 AdvApp2Var_SysBase::mvriraz_(&c__576, mmcmher_.cmherm);
7fd59977 5284
0d969553 5285/* Calculation by solution of linear systems */
7fd59977 5286
5287 for (iord1 = -1; iord1 <= 2; ++iord1) {
5288 for (iord2 = -1; iord2 <= 2; ++iord2) {
5289
5290 iord[0] = iord1;
5291 iord[1] = iord2;
5292
5293
5294 iof[0] = 0;
5295 iof[1] = iord[0] + 1;
5296
5297
5298 ncf = iord[0] + iord[1] + 2;
5299
0d969553 5300/* Calculate matrix MAT to invert: */
7fd59977 5301
5302 for (cot = 1; cot <= 2; ++cot) {
5303
5304
5305 if (iord[cot - 1] > -1) {
5306 prod = 1.;
5307 i__1 = ncf;
5308 for (jj = 1; jj <= i__1; ++jj) {
5309 cof[jj - 1] = 1.;
5310/* L200: */
5311 }
5312 }
5313
5314 i__1 = iord[cot - 1] + 1;
5315 for (pp = 1; pp <= i__1; ++pp) {
5316
5317 ii = pp + iof[cot - 1];
5318
5319 prod = 1.;
5320
5321 i__2 = pp - 1;
5322 for (jj = 1; jj <= i__2; ++jj) {
5323 mat[ii + jj * 6 - 7] = (float)0.;
5324/* L300: */
5325 }
5326
5327 i__2 = ncf;
5328 for (jj = pp; jj <= i__2; ++jj) {
5329
0d969553 5330/* everything is done in these 3 lines
7fd59977 5331 */
5332
5333 mat[ii + jj * 6 - 7] = cof[jj - 1] * prod;
5334 cof[jj - 1] *= jj - pp;
5335 prod *= debfin[cot];
5336
5337/* L400: */
5338 }
5339/* L500: */
5340 }
5341
5342/* L1000: */
5343 }
5344
5345/* Inversion */
5346
5347 if (ncf >= 1) {
5348 AdvApp2Var_MathBase::mmmrslwd_(&c__6, &ncf, &ncf, mat, miden, &epspi, abid, amat, &
5349 ier);
5350 if (ier > 0) {
5351 goto L9101;
5352 }
5353 }
5354
5355 for (cot = 1; cot <= 2; ++cot) {
5356 i__1 = iord[cot - 1] + 1;
5357 for (pp = 1; pp <= i__1; ++pp) {
5358 i__2 = ncf;
5359 for (ii = 1; ii <= i__2; ++ii) {
5360 mmcmher_.cmherm[ii + (pp + (cot + ((iord1 + (iord2 <<
5361 2)) << 1)) * 3) * 6 + 155] = amat[ii + (pp +
5362 iof[cot - 1]) * 6 - 7];
5363/* L1300: */
5364 }
5365/* L1400: */
5366 }
5367/* L1500: */
5368 }
5369
5370/* L2000: */
5371 }
5372/* L2010: */
5373 }
5374
5375/* ***********************************************************************
5376 */
5377
0d969553 5378/* The initialized flag is located: */
7fd59977 5379
5380 mmcmher_.tdebut = debfin[1];
5381 mmcmher_.tfinal = debfin[2];
5382
41194117 5383 d1 = advapp_abs(debfin[1]) + advapp_abs(debfin[2]);
7fd59977 5384 mmcmher_.verifi = d1 * 16111959;
5385
5386
5387/* ***********************************************************************
5388 */
5389
5390 goto L9999;
5391
5392/* ***********************************************************************
5393 */
5394
5395L9101:
5396 *iercod = 1;
5397 goto L9999;
5398
5399L9001:
5400 *iercod = -1;
5401 goto L9999;
5402
5403/* ***********************************************************************
5404 */
5405
5406L9999:
5407
5408 AdvApp2Var_SysBase::maermsg_("MMHERM0", iercod, 7L);
5409
5410/* ***********************************************************************
5411 */
5412 return 0 ;
5413} /* mmherm0_ */
5414
5415//=======================================================================
5416//function : mmherm1_
5417//purpose :
5418//=======================================================================
5419int mmherm1_(doublereal *debfin,
5420 integer *ordrmx,
5421 integer *iordre,
5422 doublereal *hermit,
5423 integer *iercod)
5424{
5425 /* System generated locals */
5426 integer hermit_dim1, hermit_dim2, hermit_offset;
5427
5428 /* Local variables */
1ef32e96
RL
5429 integer nbval;
5430 doublereal d1;
5431 integer cot;
7fd59977 5432
5433/* ***********************************************************************
5434 */
5435
0d969553 5436/* FUNCTION : */
7fd59977 5437/* ---------- */
0d969553 5438/* reading of coeffs. of HERMIT interpolation polynoms */
7fd59977 5439
0d969553 5440/* KEYWORDS : */
7fd59977 5441/* ----------- */
0d969553 5442/* MATH_ACCES :: HERMIT */
7fd59977 5443
0d969553 5444/* INPUT ARGUMENTS : */
7fd59977 5445/* -------------------- */
0d969553
Y
5446/* DEBFIN : PARAMETES DEFINING THE CONSTRAINTS */
5447/* DEBFIN(1) : FIRST PARAMETER */
5448/* DEBFIN(2) : SECOND PARAMETER */
7fd59977 5449
0d969553
Y
5450/* Should be equal to the corresponding arguments during the */
5451/* last call to MMHERM0 for the initialization of coeffs. */
7fd59977 5452
0d969553
Y
5453/* ORDRMX : indicates the dimensioning of HERMIT: */
5454/* there is no choice : ORDRMX should be equal to the value */
5455/* of PARAMETER IORDMX of INCLUDE MMCMHER, or 2 for the moment */
7fd59977 5456
258ff83b 5457/* IORDRE (2) : Orders of constraints in each corresponding parameter DEBFIN(I) */
0d969553 5458/* should be between -1 (no constraints) and ORDRMX. */
7fd59977 5459
5460
0d969553 5461/* OUTPUT ARGUMENTS : */
7fd59977 5462/* --------------------- */
5463
0d969553
Y
5464/* HERMIT : HERMIT(1:IORDRE(1)+IORDRE(2)+2, j, cote) are the */
5465/* coefficients in the canonic base of Hermit polynom */
5466/* corresponding to orders IORDRE with parameters DEBFIN for */
5467/* the constraint of order j on DEBFIN(cote). j is between 0 and IORDRE(cote). */
7fd59977 5468
5469
0d969553
Y
5470/* IERCOD : Error code : */
5471/* -1: O.K but necessary to reinitialize the coefficients */
5472/* (info for optimization) */
7fd59977 5473/* 0 : O.K. */
0d969553
Y
5474/* 1 : Error in MMHERM0 */
5475/* 2 : arguments invalid */
7fd59977 5476
0d969553 5477/* COMMONS USED : */
7fd59977 5478/* ------------------ */
5479
0d969553 5480/* REFERENCES CALLED : */
7fd59977 5481/* ---------------------- */
5482/* Type Name */
5483
0d969553 5484/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 5485/* ----------------------------------- */
5486
0d969553
Y
5487/* This program reads coefficients of Hermit polynoms */
5488/* that were earlier initialized by MMHERM0 */
5489
5490/* PMN : initialisation is no more done by the caller. */
7fd59977 5491
7fd59977 5492
7fd59977 5493/* ***********************************************************************
5494 */
5495
5496
5497
5498/* **********************************************************************
5499*/
5500
0d969553 5501/* FUNCTION : */
7fd59977 5502/* ---------- */
258ff83b 5503/* Serves to STORE the coefficients of Hermit interpolation polynoms */
7fd59977 5504
0d969553 5505/* KEYWORDS : */
7fd59977 5506/* ----------- */
5507/* HERMITE */
5508
0d969553 5509/* DEMSCRIPTION/NOTES/LIMITATIONS : */
7fd59977 5510/* ----------------------------------- */
5511
0d969553
Y
5512/* the coefficients of Hetmit polynoms are calculated by */
5513/* routine MMHERM0 and read by routine MMHERM1 */
7fd59977 5514
7fd59977 5515/* > */
5516/* **********************************************************************
5517*/
5518
5519
5520
5521
5522
0d969553 5523/* NBCOEF is the size of CMHERM (see lower) */
7fd59977 5524
5525
5526
5527/* ***********************************************************************
5528 */
5529
5530
5531
5532
5533
5534/* ***********************************************************************
5535 */
0d969553 5536/* Initializations */
7fd59977 5537/* ***********************************************************************
5538 */
5539
5540 /* Parameter adjustments */
5541 --debfin;
5542 hermit_dim1 = (*ordrmx << 1) + 2;
5543 hermit_dim2 = *ordrmx + 1;
5544 hermit_offset = hermit_dim1 * hermit_dim2 + 1;
5545 hermit -= hermit_offset;
5546 --iordre;
5547
5548 /* Function Body */
5549 *iercod = 0;
5550
5551
5552/* ***********************************************************************
5553 */
0d969553 5554/* Data Checking */
7fd59977 5555/* ***********************************************************************
5556 */
5557
5558
5559 if (*ordrmx != 2) {
5560 goto L9102;
5561 }
5562
5563 for (cot = 1; cot <= 2; ++cot) {
5564 if (iordre[cot] < -1) {
5565 goto L9102;
5566 }
5567 if (iordre[cot] > *ordrmx) {
5568 goto L9102;
5569 }
5570/* L100: */
5571 }
5572
5573
0d969553 5574/* IS-IT CORRECTLY INITIALIZED ? */
7fd59977 5575
41194117 5576 d1 = advapp_abs(debfin[1]) + advapp_abs(debfin[2]);
7fd59977 5577 d1 *= 16111959;
5578
0d969553 5579/* OTHERWISE IT IS INITIALIZED */
7fd59977 5580
5581 if (debfin[1] != mmcmher_.tdebut || debfin[2] != mmcmher_.tfinal || d1
5582 != mmcmher_.verifi) {
5583 *iercod = -1;
5584 mmherm0_(&debfin[1], iercod);
5585 if (*iercod > 0) {
5586 goto L9101;
5587 }
5588 }
5589
5590
5591/* ***********************************************************************
5592 */
0d969553 5593/* READING */
7fd59977 5594/* ***********************************************************************
5595 */
5596
5597 nbval = 36;
5598
5599 AdvApp2Var_SysBase::msrfill_(&nbval, &mmcmher_.cmherm[((((iordre[1] + (iordre[2] << 2)) << 1)
5600 + 1) * 3 + 1) * 6 + 156], &hermit[hermit_offset]);
5601
5602/* ***********************************************************************
5603 */
5604
5605 goto L9999;
5606
5607/* ***********************************************************************
5608 */
5609
5610L9101:
5611 *iercod = 1;
5612 goto L9999;
5613
5614L9102:
5615 *iercod = 2;
5616 goto L9999;
5617
5618/* ***********************************************************************
5619 */
5620
5621L9999:
5622
5623 AdvApp2Var_SysBase::maermsg_("MMHERM1", iercod, 7L);
5624
5625/* ***********************************************************************
5626 */
5627 return 0 ;
5628} /* mmherm1_ */
5629
5630//=======================================================================
5631//function : AdvApp2Var_MathBase::mmhjcan_
5632//purpose :
5633//=======================================================================
5634int AdvApp2Var_MathBase::mmhjcan_(integer *ndimen,
5635 integer *ncourb,
5636 integer *ncftab,
5637 integer *orcont,
5638 integer *ncflim,
5639 doublereal *tcbold,
5640 doublereal *tdecop,
5641 doublereal *tcbnew,
5642 integer *iercod)
5643
5644{
1ef32e96
RL
5645 integer c__2 = 2;
5646 integer c__21 = 21;
7fd59977 5647 /* System generated locals */
5648 integer tcbold_dim1, tcbold_dim2, tcbold_offset, tcbnew_dim1, tcbnew_dim2,
5649 tcbnew_offset, i__1, i__2, i__3, i__4, i__5;
5650
5651
5652 /* Local variables */
1ef32e96
RL
5653 logical ldbg;
5654 integer ndeg;
5655 doublereal taux1[21];
5656 integer d__, e, i__, k;
5657 doublereal mfact;
5658 integer ncoeff;
5659 doublereal tjacap[21];
5660 integer iordre[2];
5661 doublereal hermit[36]/* was [6][3][2] */, ctenor, bornes[2];
5662 integer ier;
5663 integer aux1, aux2;
7fd59977 5664
5665/* ***********************************************************************
5666 */
5667
0d969553 5668/* FUNCTION : */
7fd59977 5669/* ---------- */
0d969553
Y
5670/* CONVERSION OF TABLE TCBOLD OF POLYNOMIAL CURVE COEFFICIENTS */
5671/* EXPRESSED IN HERMIT JACOBI BASE, INTO A */
5672/* TABLE OF COEFFICIENTS TCBNEW OF COURVES EXPRESSED IN THE CANONIC BASE */
7fd59977 5673
0d969553 5674/* KEYWORDS : */
7fd59977 5675/* ----------- */
0d969553 5676/* CANNONIC, HERMIT, JACCOBI */
7fd59977 5677
0d969553 5678/* INPUT ARGUMENTS : */
7fd59977 5679/* -------------------- */
0d969553
Y
5680/* ORDHER : ORDER OF HERMIT POLYNOMS OR ORDER OF CONTINUITY */
5681/* NCOEFS : NUMBER OF COEFFICIENTS OF A POLYNOMIAL CURVE */
5682/* FOR ONE OF ITS NDIM COMPONENTS;(DEGREE+1 OF THE CURVE)
7fd59977 5683*/
0d969553
Y
5684/* NDIM : DIMENSION OF THE CURVE */
5685/* CBHEJA : TABLE OF COEFFICIENTS OF THE CURVE IN THE BASE */
5686/* HERMIT JACOBI */
7fd59977 5687/* (H(0,-1),..,H(ORDHER,-1),H(0,1),..,H(ORDHER,1), */
5688/* JA(ORDHER+1,2*ORDHER+2),....,JA(ORDHER+1,NCOEFS-1) */
5689
0d969553 5690/* OUTPUT ARGUMENTS : */
7fd59977 5691/* --------------------- */
0d969553 5692/* CBRCAN : TABLE OF COEFFICIENTS OF THE CURVE IN THE CANONIC BASE */
7fd59977 5693/* (1, t, ...) */
5694
0d969553 5695/* COMMONS USED : */
7fd59977 5696/* ------------------ */
5697
5698
0d969553 5699/* REFERENCES CALLED : */
7fd59977 5700/* --------------------- */
5701
5702
7fd59977 5703/* ***********************************************************************
5704 */
5705
5706
5707/* ***********************************************************************
5708 */
5709
0d969553 5710/* FUNCTION : */
7fd59977 5711/* ---------- */
0d969553 5712/* Providesinteger constants from 0 to 1000 */
7fd59977 5713
0d969553 5714/* KEYWORDS : */
7fd59977 5715/* ----------- */
0d969553 5716/* ALL, INTEGER */
7fd59977 5717
0d969553 5718/* DEMSCRIPTION/NOTES/LIMITATIONS : */
7fd59977 5719/* ----------------------------------- */
7fd59977 5720/* > */
5721/* ***********************************************************************
5722 */
5723
5724
5725/* ***********************************************************************
5726 */
5727
5728
5729
5730
5731/* ***********************************************************************
5732 */
0d969553 5733/* INITIALIZATION */
7fd59977 5734/* ***********************************************************************
5735 */
5736
5737 /* Parameter adjustments */
5738 --ncftab;
5739 tcbnew_dim1 = *ndimen;
5740 tcbnew_dim2 = *ncflim;
5741 tcbnew_offset = tcbnew_dim1 * (tcbnew_dim2 + 1) + 1;
5742 tcbnew -= tcbnew_offset;
5743 tcbold_dim1 = *ndimen;
5744 tcbold_dim2 = *ncflim;
5745 tcbold_offset = tcbold_dim1 * (tcbold_dim2 + 1) + 1;
5746 tcbold -= tcbold_offset;
5747
5748 /* Function Body */
5749 ldbg = AdvApp2Var_SysBase::mnfndeb_() >= 2;
5750 if (ldbg) {
5751 AdvApp2Var_SysBase::mgenmsg_("MMHJCAN", 7L);
5752 }
5753 *iercod = 0;
5754
5755 bornes[0] = -1.;
5756 bornes[1] = 1.;
5757
5758/* ***********************************************************************
5759 */
0d969553 5760/* PROCESSING */
7fd59977 5761/* ***********************************************************************
5762 */
5763
5764 if (*orcont > 2) {
5765 goto L9101;
5766 }
5767 if (*ncflim > 21) {
5768 goto L9101;
5769 }
5770
0d969553 5771/* CALCULATION OF HERMIT POLYNOMS IN THE CANONIC BASE ON (-1,1) */
7fd59977 5772
5773
5774 iordre[0] = *orcont;
5775 iordre[1] = *orcont;
5776 mmherm1_(bornes, &c__2, iordre, hermit, &ier);
5777 if (ier > 0) {
5778 goto L9102;
5779 }
5780
5781
5782 aux1 = *orcont + 1;
5783 aux2 = aux1 << 1;
5784
5785 i__1 = *ncourb;
5786 for (e = 1; e <= i__1; ++e) {
5787
5788 ctenor = (tdecop[e] - tdecop[e - 1]) / 2;
5789 ncoeff = ncftab[e];
5790 ndeg = ncoeff - 1;
5791 if (ncoeff > 21) {
5792 goto L9101;
5793 }
5794
5795 i__2 = *ndimen;
5796 for (d__ = 1; d__ <= i__2; ++d__) {
5797
0d969553
Y
5798/* CONVERSION OF THE COEFFICIENTS OF THE PART OF THE CURVE EXPRESSED */
5799/* IN HERMIT BASE, INTO THE CANONIC BASE */
7fd59977 5800
fadcea2c 5801 AdvApp2Var_SysBase::mvriraz_(&ncoeff, taux1);
7fd59977 5802
5803 i__3 = aux2;
5804 for (k = 1; k <= i__3; ++k) {
5805 i__4 = aux1;
5806 for (i__ = 1; i__ <= i__4; ++i__) {
5807 i__5 = i__ - 1;
5808 mfact = AdvApp2Var_MathBase::pow__di(&ctenor, &i__5);
5809 taux1[k - 1] += (tcbold[d__ + (i__ + e * tcbold_dim2) *
5810 tcbold_dim1] * hermit[k + (i__ + 2) * 6 - 19] +
5811 tcbold[d__ + (i__ + aux1 + e * tcbold_dim2) *
5812 tcbold_dim1] * hermit[k + (i__ + 5) * 6 - 19]) *
5813 mfact;
5814 }
5815 }
5816
5817
5818 i__3 = ncoeff;
5819 for (i__ = aux2 + 1; i__ <= i__3; ++i__) {
5820 taux1[i__ - 1] = tcbold[d__ + (i__ + e * tcbold_dim2) *
5821 tcbold_dim1];
5822 }
5823
0d969553
Y
5824/* CONVERSION OF THE COEFFICIENTS OF THE PART OF THE CURVE EXPRESSED */
5825/* IN CANONIC-JACOBI BASE, INTO THE CANONIC BASE */
5826
7fd59977 5827
5828
5829 AdvApp2Var_MathBase::mmapcmp_(&minombr_.nbr[1], &c__21, &ncoeff, taux1, tjacap);
5830 AdvApp2Var_MathBase::mmjacan_(orcont, &ndeg, tjacap, taux1);
5831
0d969553
Y
5832/* RECOPY THE COEFS RESULTING FROM THE CONVERSION IN THE TABLE */
5833/* OF RESULTS */
7fd59977 5834
5835 i__3 = ncoeff;
5836 for (i__ = 1; i__ <= i__3; ++i__) {
5837 tcbnew[d__ + (i__ + e * tcbnew_dim2) * tcbnew_dim1] = taux1[
5838 i__ - 1];
5839 }
5840
5841 }
5842 }
5843
5844 goto L9999;
5845
5846/* ***********************************************************************
5847 */
0d969553 5848/* PROCESSING OF ERRORS */
7fd59977 5849/* ***********************************************************************
5850 */
5851
5852L9101:
5853 *iercod = 1;
5854 goto L9999;
5855L9102:
5856 *iercod = 2;
5857 goto L9999;
5858
5859/* ***********************************************************************
5860 */
0d969553 5861/* RETURN CALLING PROGRAM */
7fd59977 5862/* ***********************************************************************
5863 */
5864
5865L9999:
5866
5867 AdvApp2Var_SysBase::maermsg_("MMHJCAN", iercod, 7L);
5868 if (ldbg) {
5869 AdvApp2Var_SysBase::mgsomsg_("MMHJCAN", 7L);
5870 }
5871 return 0 ;
5872} /* mmhjcan_ */
5873
5874//=======================================================================
5875//function : AdvApp2Var_MathBase::mminltt_
5876//purpose :
5877//=======================================================================
5878 int AdvApp2Var_MathBase::mminltt_(integer *ncolmx,
5879 integer *nlgnmx,
5880 doublereal *tabtri,
5881 integer *nbrcol,
5882 integer *nbrlgn,
5883 doublereal *ajoute,
5884 doublereal *,//epseg,
5885 integer *iercod)
5886{
5887 /* System generated locals */
5888 integer tabtri_dim1, tabtri_offset, i__1, i__2;
5889
5890 /* Local variables */
1ef32e96
RL
5891 logical idbg;
5892 integer icol, ilgn, nlgn, noct, inser;
5893 doublereal epsega = 0.;
5894 integer ibb;
7fd59977 5895
5896/* ***********************************************************************
5897 */
5898
0d969553 5899/* FUNCTION : */
7fd59977 5900/* ---------- */
0d969553 5901/* . Insert a line in a table parsed without redundance */
7fd59977 5902
0d969553 5903/* KEYWORDS : */
7fd59977 5904/* ----------- */
5905/* TOUS,MATH_ACCES :: TABLEAU&,INSERTION,&TABLEAU */
5906
0d969553 5907/* INPUT ARGUMENTS : */
7fd59977 5908/* -------------------- */
0d969553
Y
5909/* . NCOLMX : Number of columns in the table */
5910/* . NLGNMX : Number of lines in the table */
5911/* . TABTRI : Table parsed by lines without redundances */
5912/* . NBRCOL : Number of columns used */
5913/* . NBRLGN : Number of lines used */
5914/* . AJOUTE : Line to be added */
5915/* . EPSEGA : Epsilon to test the redundance */
5916
5917/* OUTPUT ARGUMENTS : */
7fd59977 5918/* --------------------- */
0d969553
Y
5919/* . TABTRI : Table parsed by lines without redundances */
5920/* . NBRLGN : Number of lines used */
5921/* . IERCOD : 0 -> No problem */
5922/* 1 -> The table is full */
7fd59977 5923
0d969553 5924/* COMMONS USED : */
7fd59977 5925/* ------------------ */
5926
0d969553 5927/* REFERENCES CALLED : */
7fd59977 5928/* --------------------- */
5929
0d969553 5930/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 5931/* ----------------------------------- */
0d969553 5932/* . The line is inserted only if there is no line with all
7fd59977 5933*/
0d969553 5934/* elements equl to those which are planned to be insered, to epsilon. */
7fd59977 5935
0d969553 5936/* . Level of de debug = 3 */
7fd59977 5937
0d969553 5938
258ff83b 5939/**/
0d969553 5940/* DECLARATIONS , CONTROL OF INPUT ARGUMENTS , INITIALIZATION */
7fd59977 5941/* ***********************************************************************
5942 */
5943
0d969553 5944/* --- Parameters */
7fd59977 5945
5946
0d969553 5947/* --- Functions */
7fd59977 5948
5949
0d969553 5950/* --- Local variables */
7fd59977 5951
5952
0d969553 5953/* --- Messages */
7fd59977 5954
5955 /* Parameter adjustments */
5956 tabtri_dim1 = *ncolmx;
5957 tabtri_offset = tabtri_dim1 + 1;
5958 tabtri -= tabtri_offset;
5959 --ajoute;
5960
5961 /* Function Body */
5962 ibb = AdvApp2Var_SysBase::mnfndeb_();
5963 idbg = ibb >= 3;
5964 if (idbg) {
5965 AdvApp2Var_SysBase::mgenmsg_("MMINLTT", 7L);
5966 }
5967
0d969553 5968/* --- Control arguments */
7fd59977 5969
5970 if (*nbrlgn >= *nlgnmx) {
5971 goto L9001;
5972 }
5973
5974/* -------------------- */
0d969553 5975/* *** INITIALIZATION */
7fd59977 5976/* -------------------- */
5977
5978 *iercod = 0;
5979
5980/* ---------------------------- */
0d969553 5981/* *** SEARCH OF REDUNDANCE */
7fd59977 5982/* ---------------------------- */
5983
5984 i__1 = *nbrlgn;
5985 for (ilgn = 1; ilgn <= i__1; ++ilgn) {
5986 if (tabtri[ilgn * tabtri_dim1 + 1] >= ajoute[1] - epsega) {
5987 if (tabtri[ilgn * tabtri_dim1 + 1] <= ajoute[1] + epsega) {
5988 i__2 = *nbrcol;
5989 for (icol = 1; icol <= i__2; ++icol) {
5990 if (tabtri[icol + ilgn * tabtri_dim1] < ajoute[icol] -
5991 epsega || tabtri[icol + ilgn * tabtri_dim1] >
5992 ajoute[icol] + epsega) {
5993 goto L20;
5994 }
5995/* L10: */
5996 }
5997 goto L9999;
5998 } else {
5999 goto L30;
6000 }
6001 }
6002L20:
6003 ;
6004 }
6005
6006/* ----------------------------------- */
0d969553 6007/* *** SEARCH OF THE INSERTION POINT */
7fd59977 6008/* ----------------------------------- */
6009
6010L30:
6011
6012 i__1 = *nbrlgn;
6013 for (ilgn = 1; ilgn <= i__1; ++ilgn) {
6014 i__2 = *nbrcol;
6015 for (icol = 1; icol <= i__2; ++icol) {
6016 if (tabtri[icol + ilgn * tabtri_dim1] < ajoute[icol]) {
6017 goto L50;
6018 }
6019 if (tabtri[icol + ilgn * tabtri_dim1] > ajoute[icol]) {
6020 goto L70;
6021 }
6022/* L60: */
6023 }
6024L50:
6025 ;
6026 }
6027
6028 ilgn = *nbrlgn + 1;
6029
6030/* -------------- */
6031/* *** INSERTION */
6032/* -------------- */
6033
6034L70:
6035
6036 inser = ilgn;
6037 ++(*nbrlgn);
6038
0d969553 6039/* --- Shift lower */
7fd59977 6040
6041 nlgn = *nbrlgn - inser;
6042 if (nlgn > 0) {
6043 noct = (*ncolmx << 3) * nlgn;
fadcea2c
RL
6044 AdvApp2Var_SysBase::mcrfill_(&noct,
6045 &tabtri[inser * tabtri_dim1 + 1],
6046 &tabtri[(inser + 1)* tabtri_dim1 + 1]);
7fd59977 6047 }
6048
0d969553 6049/* --- Copy line */
7fd59977 6050
6051 noct = *nbrcol << 3;
fadcea2c
RL
6052 AdvApp2Var_SysBase::mcrfill_(&noct,
6053 &ajoute[1],
6054 &tabtri[inser * tabtri_dim1 + 1]);
7fd59977 6055
6056 goto L9999;
6057
6058/* ******************************************************************** */
0d969553 6059/* OUTPUT ERROR , RETURN CALLING PROGRAM , MESSAGES */
7fd59977 6060/* ******************************************************************** */
6061
0d969553 6062/* --- The table is already full */
7fd59977 6063
6064L9001:
6065 *iercod = 1;
6066
0d969553 6067/* --- End */
7fd59977 6068
6069L9999:
6070 if (*iercod != 0) {
6071 AdvApp2Var_SysBase::maermsg_("MMINLTT", iercod, 7L);
6072 }
6073 if (idbg) {
6074 AdvApp2Var_SysBase::mgsomsg_("MMINLTT", 7L);
6075 }
6076 return 0 ;
6077} /* mminltt_ */
6078
6079//=======================================================================
6080//function : AdvApp2Var_MathBase::mmjacan_
6081//purpose :
6082//=======================================================================
fadcea2c 6083 int AdvApp2Var_MathBase::mmjacan_(const integer *ideriv,
7fd59977 6084 integer *ndeg,
6085 doublereal *poljac,
6086 doublereal *polcan)
6087{
6088 /* System generated locals */
6089 integer poljac_dim1, i__1, i__2;
6090
6091 /* Local variables */
1ef32e96
RL
6092 integer iptt, i__, j, ibb;
6093 doublereal bid;
7fd59977 6094
6095/* ***********************************************************************
6096 */
6097
0d969553 6098/* FUNCTION : */
7fd59977 6099/* ---------- */
0d969553
Y
6100/* Routine of transfer of Jacobi normalized to canonic [-1,1], */
6101/* the tables are ranked by even, then by uneven degree. */
7fd59977 6102
0d969553 6103/* KEYWORDS : */
7fd59977 6104/* ----------- */
6105/* LEGENDRE,JACOBI,PASSAGE. */
6106
0d969553 6107/* INPUT ARGUMENTS : */
7fd59977 6108/* ------------------ */
0d969553
Y
6109/* IDERIV : Order of Jacobi between -1 and 2. */
6110/* NDEG : The true degree of the polynom. */
6111/* POLJAC : The polynom in the Jacobi base. */
7fd59977 6112
0d969553 6113/* OUTPUT ARGUMENTS : */
7fd59977 6114/* ------------------- */
0d969553 6115/* POLCAN : The curve expressed in the canonic base [-1,1]. */
7fd59977 6116
0d969553 6117/* COMMONS USED : */
7fd59977 6118/* ---------------- */
6119
0d969553 6120/* REFERENCES CALLED : */
7fd59977 6121/* ----------------------- */
6122
0d969553 6123/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 6124/* ----------------------------------- */
6125
7fd59977 6126/* > */
6127/* ***********************************************************************
6128 */
6129
0d969553 6130/* Name of the routine */
7fd59977 6131
0d969553 6132/* Matrices of conversion */
7fd59977 6133
6134
6135/* ***********************************************************************
6136 */
6137
0d969553 6138/* FUNCTION : */
7fd59977 6139/* ---------- */
0d969553 6140/* MATRIX OF TRANSFORMATION OF LEGENDRE BASE */
7fd59977 6141
0d969553 6142/* KEYWORDS : */
7fd59977 6143/* ----------- */
6144/* MATH */
6145
0d969553 6146/* DEMSCRIPTION/NOTES/LIMITATIONS : */
7fd59977 6147/* ----------------------------------- */
6148
7fd59977 6149/* > */
6150/* ***********************************************************************
6151 */
6152
6153
6154
0d969553 6155/* Legendre common / Restricted Casteljau. */
7fd59977 6156
0d969553
Y
6157/* 0:1 0 Concerns the even terms, 1 the uneven terms. */
6158/* CANPLG : Matrix of passage to canonic from Jacobi with calculated parities */
6159/* PLGCAN : Matrix of passage from Jacobi to canonic with calculated parities */
7fd59977 6160
6161
6162/* ***********************************************************************
6163 */
6164
6165 /* Parameter adjustments */
6166 poljac_dim1 = *ndeg / 2 + 1;
6167
6168 /* Function Body */
6169 ibb = AdvApp2Var_SysBase::mnfndeb_();
6170 if (ibb >= 5) {
6171 AdvApp2Var_SysBase::mgenmsg_("MMJACAN", 7L);
6172 }
6173
0d969553 6174/* ----------------- Expression of terms of even degree ----------------
7fd59977 6175*/
6176
6177 i__1 = *ndeg / 2;
6178 for (i__ = 0; i__ <= i__1; ++i__) {
6179 bid = 0.;
6180 iptt = i__ * 31 - (i__ + 1) * i__ / 2 + 1;
6181 i__2 = *ndeg / 2;
6182 for (j = i__; j <= i__2; ++j) {
6183 bid += mmjcobi_.plgcan[iptt + j + *ideriv * 992 + 991] * poljac[
6184 j];
6185/* L310: */
6186 }
6187 polcan[i__ * 2] = bid;
6188/* L300: */
6189 }
6190
0d969553 6191/* --------------- Expression of terms of uneven degree ----------------
7fd59977 6192*/
6193
6194 if (*ndeg == 0) {
6195 goto L9999;
6196 }
6197
6198 i__1 = (*ndeg - 1) / 2;
6199 for (i__ = 0; i__ <= i__1; ++i__) {
6200 bid = 0.;
6201 iptt = i__ * 31 - (i__ + 1) * i__ / 2 + 1;
6202 i__2 = (*ndeg - 1) / 2;
6203 for (j = i__; j <= i__2; ++j) {
6204 bid += mmjcobi_.plgcan[iptt + j + ((*ideriv << 1) + 1) * 496 +
6205 991] * poljac[j + poljac_dim1];
6206/* L410: */
6207 }
6208 polcan[(i__ << 1) + 1] = bid;
6209/* L400: */
6210 }
6211
6212/* -------------------------------- The end -----------------------------
6213*/
6214
6215L9999:
6216 if (ibb >= 5) {
6217 AdvApp2Var_SysBase::mgsomsg_("MMJACAN", 7L);
6218 }
6219 return 0;
6220} /* mmjacan_ */
6221
6222//=======================================================================
6223//function : AdvApp2Var_MathBase::mmjaccv_
6224//purpose :
6225//=======================================================================
fadcea2c
RL
6226 int AdvApp2Var_MathBase::mmjaccv_(const integer *ncoef,
6227 const integer *ndim,
6228 const integer *ider,
6229 const doublereal *crvlgd,
7fd59977 6230 doublereal *polaux,
6231 doublereal *crvcan)
6232
6233{
6234 /* Initialized data */
6235
6236 static char nomprg[8+1] = "MMJACCV ";
6237
6238 /* System generated locals */
6239 integer crvlgd_dim1, crvlgd_offset, crvcan_dim1, crvcan_offset,
6240 polaux_dim1, i__1, i__2;
6241
6242 /* Local variables */
1ef32e96 6243 integer ndeg, i__, nd, ii, ibb;
7fd59977 6244
6245/* ***********************************************************************
6246 */
6247
0d969553 6248/* FUNCTION : */
7fd59977 6249/* ---------- */
0d969553 6250/* Passage from the normalized Jacobi base to the canonic base. */
7fd59977 6251
0d969553 6252/* KEYWORDS : */
7fd59977 6253/* ----------- */
0d969553 6254/* SMOOTHING, BASE, LEGENDRE */
7fd59977 6255
6256
0d969553 6257/* INPUT ARGUMENTS : */
7fd59977 6258/* ------------------ */
0d969553
Y
6259/* NDIM: Space Dimension. */
6260/* NCOEF: Degree +1 of the polynom. */
6261/* IDER: Order of Jacobi polynoms. */
6262/* CRVLGD : Curve in the base of Jacobi. */
7fd59977 6263
0d969553 6264/* OUTPUT ARGUMENTS : */
7fd59977 6265/* ------------------- */
0d969553
Y
6266/* POLAUX : Auxilliary space. */
6267/* CRVCAN : The curve in the canonic base [-1,1] */
7fd59977 6268
0d969553 6269/* COMMONS USED : */
7fd59977 6270/* ---------------- */
6271
0d969553 6272/* REFERENCES CALLED : */
7fd59977 6273/* ----------------------- */
6274
0d969553 6275/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 6276/* ----------------------------------- */
6277
7fd59977 6278/* > */
6279/* *********************************************************************
6280*/
6281
0d969553 6282/* Name of the routine */
7fd59977 6283 /* Parameter adjustments */
6284 polaux_dim1 = (*ncoef - 1) / 2 + 1;
6285 crvcan_dim1 = *ncoef - 1 + 1;
6286 crvcan_offset = crvcan_dim1;
6287 crvcan -= crvcan_offset;
6288 crvlgd_dim1 = *ncoef - 1 + 1;
6289 crvlgd_offset = crvlgd_dim1;
6290 crvlgd -= crvlgd_offset;
6291
6292 /* Function Body */
6293
6294 ibb = AdvApp2Var_SysBase::mnfndeb_();
6295 if (ibb >= 3) {
6296 AdvApp2Var_SysBase::mgenmsg_(nomprg, 6L);
6297 }
6298
6299 ndeg = *ncoef - 1;
6300
6301 i__1 = *ndim;
6302 for (nd = 1; nd <= i__1; ++nd) {
0d969553 6303/* Loading of the auxilliary table. */
7fd59977 6304 ii = 0;
6305 i__2 = ndeg / 2;
6306 for (i__ = 0; i__ <= i__2; ++i__) {
6307 polaux[i__] = crvlgd[ii + nd * crvlgd_dim1];
6308 ii += 2;
6309/* L310: */
6310 }
6311
6312 ii = 1;
6313 if (ndeg >= 1) {
6314 i__2 = (ndeg - 1) / 2;
6315 for (i__ = 0; i__ <= i__2; ++i__) {
6316 polaux[i__ + polaux_dim1] = crvlgd[ii + nd * crvlgd_dim1];
6317 ii += 2;
6318/* L320: */
6319 }
6320 }
0d969553 6321/* Call the routine of base change. */
7fd59977 6322 AdvApp2Var_MathBase::mmjacan_(ider, &ndeg, polaux, &crvcan[nd * crvcan_dim1]);
6323/* L300: */
6324 }
6325
6326
6327/* L9999: */
6328 return 0;
6329} /* mmjaccv_ */
6330
6331//=======================================================================
6332//function : mmloncv_
6333//purpose :
6334//=======================================================================
6335int mmloncv_(integer *ndimax,
6336 integer *ndimen,
6337 integer *ncoeff,
6338 doublereal *courbe,
6339 doublereal *tdebut,
6340 doublereal *tfinal,
6341 doublereal *xlongc,
6342 integer *iercod)
6343
6344{
6345 /* Initialized data */
6346
1ef32e96 6347 integer kgar = 0;
7fd59977 6348
6349 /* System generated locals */
6350 integer courbe_dim1, courbe_offset, i__1, i__2;
6351
6352 /* Local variables */
1ef32e96 6353 doublereal tran;
1d47d8d0 6354 integer ngaus = 0;
6355 doublereal c1, c2, d1, d2,
6356 wgaus[20] = {0.}, uroot[20] = {0.}, x1, x2, dd;
1ef32e96
RL
6357 integer ii, jj, kk;
6358 doublereal som;
6359 doublereal der1, der2;
7fd59977 6360
6361
6362
6363
6364/* **********************************************************************
6365*/
6366
0d969553
Y
6367/* FUNCTION : Length of an arc of curve on a given interval */
6368/* ---------- for a function the mathematic representation */
6369/* which of is a multidimensional polynom. */
258ff83b 6370/* The polynom is a set of polynoms the coefficients which of are ranked */
6371/* in a table with 2 indices, each line relative to 1 polynom. */
0d969553
Y
6372/* The polynom is defined by its coefficients ordered by increasing
6373* power of the variable. */
6374/* All polynoms have the same number of coefficients (and the same degree). */
7fd59977 6375
0d969553 6376/* KEYWORDS : LENGTH, CURVE */
7fd59977 6377/* ----------- */
6378
0d969553 6379/* INPUT ARGUMENTS : */
7fd59977 6380/* -------------------- */
6381
0d969553
Y
6382/* NDIMAX : Max number of lines of tables (max number of polynoms). */
6383/* NDIMEN : Dimension of the polynom (Nomber of polynoms). */
6384/* NCOEFF : Number of coefficients of the polynom (no limitation) */
6385/* This is degree + 1 */
6386/* COURBE : Coefficients of the polynom ordered by increasing power */
6387/* Dimension to (NDIMAX,NCOEFF). */
6388/* TDEBUT : Lower limit of integration for length calculation. */
6389/* TFINAL : Upper limit of integration for length calculation. */
6390
6391/* OUTPUT ARGUMENTS : */
7fd59977 6392/* --------------------- */
0d969553 6393/* XLONGC : Length of arc of curve */
7fd59977 6394
0d969553
Y
6395/* IERCOD : Error code : */
6396/* = 0 ==> All is OK */
6397/* = 1 ==> NDIMEN or NCOEFF negative or null */
6398/* = 2 ==> Pb loading Legendre roots and Gauss weight */
6399/* by MVGAUS0. */
7fd59977 6400
0d969553 6401/* If error => XLONGC = 0 */
7fd59977 6402
0d969553 6403/* COMMONS USED : */
7fd59977 6404/* ------------------ */
6405
6406/* .Neant. */
6407
0d969553 6408/* REFERENCES CALLED : */
7fd59977 6409/* ---------------------- */
6410/* Type Name */
6411/* MAERMSG R*8 DSQRT I*4 MIN */
6412/* MVGAUS0 */
6413
0d969553 6414/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 6415/* ----------------------------------- */
6416
0d969553
Y
6417/* See VGAUSS to understand well the technique. */
6418/* Actually SQRT (dpi^2) is integrated for i=1,nbdime */
6419/* Calculation of the derivative is included in the code to avoid an additional */
6420/* call of the routine. */
7fd59977 6421
0d969553
Y
6422/* The integrated function is strictly increasing, it */
6423/* is not necessary to use a high degree for the GAUSS method GAUSS. */
7fd59977 6424
0d969553
Y
6425/* The degree of LEGENDRE polynom results from the degree of the */
6426/* polynom to be integrated. It can vary from 4 to 40 (with step of 4). */
7fd59977 6427
0d969553 6428/* The precision (relative) of integration is of order 1.D-8. */
7fd59977 6429
0d969553 6430/* ATTENTION : if TDEBUT > TFINAL, the length is NEGATIVE. */
7fd59977 6431
0d969553
Y
6432/* Attention : the precision of the result is not controlled. */
6433/* If you wish to control it, use MMCGLC1, taking into account that */
6434/* the performance (in time) will be worse. */
7fd59977 6435
6436/* >=====================================================================
6437*/
6438
0d969553 6439/* ATTENTION : SAVE KGAR WGAUS and UROOT EVENTUALLY */
7fd59977 6440/* ,IERXV */
6441/* INTEGER I1,I20 */
6442/* PARAMETER (I1=1,I20=20) */
6443
6444 /* Parameter adjustments */
6445 courbe_dim1 = *ndimax;
6446 courbe_offset = courbe_dim1 + 1;
6447 courbe -= courbe_offset;
6448
6449 /* Function Body */
6450
0d969553 6451/* ****** General initialization ** */
7fd59977 6452
6453 *iercod = 999999;
6454 *xlongc = 0.;
6455
0d969553 6456/* ****** Initialization of UROOT, WGAUS, NGAUS and KGAR ** */
7fd59977 6457
6458/* CALL MXVINIT(IERXV,'INTEGER',I1,KGAR,'INTEGER',I1,NGAUS */
6459/* 1 ,'DOUBLE PRECISION',I20,UROOT,'DOUBLE PRECISION',I20,WGAUS) */
6460/* IF (IERXV.GT.0) KGAR=0 */
6461
0d969553 6462/* ****** Test the equity of limits ** */
7fd59977 6463
6464 if (*tdebut == *tfinal) {
6465 *iercod = 0;
6466 goto L9900;
6467 }
6468
0d969553 6469/* ****** Test the dimension and the number of coefficients ** */
7fd59977 6470
6471 if (*ndimen <= 0 || *ncoeff <= 0) {
6472 *iercod = 1;
6473 goto L9900;
6474 }
6475
0d969553 6476/* ****** Calculate the optimal degree ** */
7fd59977 6477
6478 kk = *ncoeff / 4 + 1;
41194117 6479 kk = advapp_min(kk,10);
7fd59977 6480
0d969553
Y
6481/* ****** Return the coefficients for the integral (DEGRE=4*KK) */
6482/* if KK <> KGAR. */
7fd59977 6483
6484 if (kk != kgar) {
6485 mvgaus0_(&kk, uroot, wgaus, &ngaus, iercod);
6486 if (*iercod > 0) {
6487 kgar = 0;
6488 *iercod = 2;
6489 goto L9900;
6490 }
6491 kgar = kk;
6492 }
6493
0d969553
Y
6494/* C1 => Point medium interval */
6495/* C2 => 1/2 amplitude interval */
7fd59977 6496
6497 c1 = (*tfinal + *tdebut) * .5;
6498 c2 = (*tfinal - *tdebut) * .5;
6499
6500/* ----------------------------------------------------------- */
0d969553 6501/* ****** Integration - Loop on GAUSS intervals ** */
7fd59977 6502/* ----------------------------------------------------------- */
6503
6504 som = 0.;
6505
6506 i__1 = ngaus;
6507 for (jj = 1; jj <= i__1; ++jj) {
6508
0d969553 6509/* ****** Integration taking the symmetry into account ** */
7fd59977 6510
6511 tran = c2 * uroot[jj - 1];
6512 x1 = c1 + tran;
6513 x2 = c1 - tran;
6514
0d969553 6515/* ****** Derivation on the dimension of the space ** */
7fd59977 6516
6517 der1 = 0.;
6518 der2 = 0.;
6519 i__2 = *ndimen;
6520 for (kk = 1; kk <= i__2; ++kk) {
6521 d1 = (*ncoeff - 1) * courbe[kk + *ncoeff * courbe_dim1];
6522 d2 = d1;
6523 for (ii = *ncoeff - 1; ii >= 2; --ii) {
6524 dd = (ii - 1) * courbe[kk + ii * courbe_dim1];
6525 d1 = d1 * x1 + dd;
6526 d2 = d2 * x2 + dd;
6527/* L100: */
6528 }
6529 der1 += d1 * d1;
6530 der2 += d2 * d2;
6531/* L200: */
6532 }
6533
6534/* ****** Integration ** */
6535
6536 som += wgaus[jj - 1] * c2 * (sqrt(der1) + sqrt(der2));
6537
0d969553 6538/* ****** End of loop on GAUSS intervals ** */
7fd59977 6539
6540/* L300: */
6541 }
6542
0d969553 6543/* ****** Work ended ** */
7fd59977 6544
6545 *xlongc = som;
6546
0d969553 6547/* ****** It is forced IERCOD = 0 ** */
7fd59977 6548
6549 *iercod = 0;
6550
0d969553 6551/* ****** Final processing ** */
7fd59977 6552
6553L9900:
6554
0d969553 6555/* ****** Save UROOT, WGAUS, NGAUS and KGAR ** */
7fd59977 6556
6557/* CALL MXVSAVE(IERXV,'INTEGER',I1,KGAR,'INTEGER',I1,NGAUS */
6558/* 1 ,'DOUBLE PRECISION',I20,UROOT,'DOUBLE PRECISION',I20,WGAUS) */
6559/* IF (IERXV.GT.0) KGAR=0 */
6560
0d969553 6561/* ****** End of sub-program ** */
7fd59977 6562
6563 if (*iercod != 0) {
6564 AdvApp2Var_SysBase::maermsg_("MMLONCV", iercod, 7L);
6565 }
6566 return 0 ;
6567} /* mmloncv_ */
6568
6569//=======================================================================
6570//function : AdvApp2Var_MathBase::mmpobas_
6571//purpose :
6572//=======================================================================
6573 int AdvApp2Var_MathBase::mmpobas_(doublereal *tparam,
6574 integer *iordre,
6575 integer *ncoeff,
6576 integer *nderiv,
6577 doublereal *valbas,
6578 integer *iercod)
6579
6580{
1ef32e96
RL
6581 integer c__2 = 2;
6582 integer c__1 = 1;
7fd59977 6583
6584
6585 /* Initialized data */
6586
1ef32e96 6587 doublereal moin11[2] = { -1.,1. };
7fd59977 6588
6589 /* System generated locals */
6590 integer valbas_dim1, i__1;
6591
6592 /* Local variables */
1ef32e96
RL
6593 doublereal vjac[80], herm[24];
6594 integer iord[2];
6595 doublereal wval[4];
6596 integer nwcof, iunit;
6597 doublereal wpoly[7];
6598 integer ii, jj, iorjac;
6599 doublereal hermit[36] /* was [6][3][2] */;
6600 integer kk1, kk2, kk3;
6601 integer khe, ier;
7fd59977 6602
6603
6604/* ***********************************************************************
6605 */
6606
0d969553 6607/* FUNCTION : */
7fd59977 6608/* ---------- */
0d969553
Y
6609/* Position on the polynoms of base hermit-Jacobi */
6610/* and their succesive derivatives */
7fd59977 6611
0d969553 6612/* KEYWORDS : */
7fd59977 6613/* ----------- */
0d969553 6614/* PUBLIC, POSITION, HERMIT, JACOBI */
7fd59977 6615
0d969553 6616/* INPUT ARGUMENTS : */
7fd59977 6617/* -------------------- */
0d969553
Y
6618/* TPARAM : Parameter for which the position is found. */
6619/* IORDRE : Orderof hermit-Jacobi (-1,0,1, ou 2) */
6620/* NCOEFF : Number of coefficients of polynoms (Nb of value to calculate) */
6621/* NDERIV : Number of derivative to calculate (0<= N <=3) */
6622/* 0 -> Position simple on base functions */
6623/* N -> Position on base functions and derivative */
6624/* of order 1 to N */
6625
6626/* OUTPUT ARGUMENTS : */
7fd59977 6627/* --------------------- */
0d969553 6628/* VALBAS (NCOEFF, 0:NDERIV) : calculated value */
7fd59977 6629/* i */
6630/* d vj(t) = VALBAS(J, I) */
6631/* -- i */
6632/* dt */
6633
0d969553 6634/* IERCOD : Error code */
7fd59977 6635/* 0 : Ok */
0d969553 6636/* 1 : Incoherence of input arguments */
7fd59977 6637
0d969553
Y
6638/* COMMONS USED : */
6639/* -------------- */
7fd59977 6640
6641
0d969553
Y
6642/* REFERENCES CALLED : */
6643/* ------------------- */
7fd59977 6644
6645
0d969553 6646/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 6647/* ----------------------------------- */
6648
7fd59977 6649/* > */
6650/* ***********************************************************************
6651 */
6652/* DECLARATIONS */
6653/* ***********************************************************************
6654 */
6655
6656
6657
6658 /* Parameter adjustments */
6659 valbas_dim1 = *ncoeff;
6660 --valbas;
6661
6662 /* Function Body */
6663
6664/* ***********************************************************************
6665 */
0d969553 6666/* INITIALIZATIONS */
7fd59977 6667/* ***********************************************************************
6668 */
6669
6670 *iercod = 0;
6671
6672/* ***********************************************************************
6673 */
0d969553 6674/* PROCESSING */
7fd59977 6675/* ***********************************************************************
6676 */
6677
6678 if (*nderiv > 3) {
6679 goto L9101;
6680 }
6681 if (*ncoeff > 20) {
6682 goto L9101;
6683 }
6684 if (*iordre > 2) {
6685 goto L9101;
6686 }
6687
6688 iord[0] = *iordre;
6689 iord[1] = *iordre;
6690 iorjac = (*iordre + 1) << 1;
6691
0d969553 6692/* (1) Generic Calculations .... */
7fd59977 6693
0d969553 6694/* (1.a) Calculation of hermit polynoms */
7fd59977 6695
6696 if (*iordre >= 0) {
6697 mmherm1_(moin11, &c__2, iord, hermit, &ier);
6698 if (ier > 0) {
6699 goto L9102;
6700 }
6701 }
6702
0d969553 6703/* (1.b) Evaluation of hermit polynoms */
7fd59977 6704
6705 jj = 1;
6706 iunit = *nderiv + 1;
6707 khe = (*iordre + 1) * iunit;
6708
6709 if (*nderiv > 0) {
6710
6711 i__1 = *iordre;
6712 for (ii = 0; ii <= i__1; ++ii) {
6713 mmdrvcb_(nderiv, &c__1, &iorjac, &hermit[(ii + 3) * 6 - 18],
6714 tparam, &herm[jj - 1], &ier);
6715 if (ier > 0) {
6716 goto L9102;
6717 }
6718
6719 mmdrvcb_(nderiv, &c__1, &iorjac, &hermit[(ii + 6) * 6 - 18],
6720 tparam, &herm[jj + khe - 1], &ier);
6721 if (ier > 0) {
6722 goto L9102;
6723 }
6724 jj += iunit;
6725 }
6726
6727 } else {
6728
6729 i__1 = *iordre;
6730 for (ii = 0; ii <= i__1; ++ii) {
6731 AdvApp2Var_MathBase::mmpocrb_(&c__1, &iorjac, &hermit[(ii + 3) * 6 - 18], &c__1,
6732 tparam, &herm[jj - 1]);
6733
6734 AdvApp2Var_MathBase::mmpocrb_(&c__1, &iorjac, &hermit[(ii + 6) * 6 - 18], &c__1,
6735 tparam, &herm[jj + khe - 1]);
6736 jj += iunit;
6737 }
6738 }
6739
0d969553 6740/* (1.c) Evaluation of Jacobi polynoms */
7fd59977 6741
6742 ii = *ncoeff - iorjac;
6743
6744 mmpojac_(tparam, &iorjac, &ii, nderiv, vjac, &ier);
6745 if (ier > 0) {
6746 goto L9102;
6747 }
6748
0d969553 6749/* (1.d) Evaluation of W(t) */
7fd59977 6750
6751/* Computing MAX */
6752 i__1 = iorjac + 1;
41194117 6753 nwcof = advapp_max(i__1,1);
fadcea2c
RL
6754 AdvApp2Var_SysBase::mvriraz_(&nwcof,
6755 wpoly);
7fd59977 6756 wpoly[0] = 1.;
6757 if (*iordre == 2) {
6758 wpoly[2] = -3.;
6759 wpoly[4] = 3.;
6760 wpoly[6] = -1.;
6761 } else if (*iordre == 1) {
6762 wpoly[2] = -2.;
6763 wpoly[4] = 1.;
6764 } else if (*iordre == 0) {
6765 wpoly[2] = -1.;
6766 }
6767
6768 mmdrvcb_(nderiv, &c__1, &nwcof, wpoly, tparam, wval, &ier);
6769 if (ier > 0) {
6770 goto L9102;
6771 }
6772
6773 kk1 = *ncoeff - iorjac;
6774 kk2 = kk1 << 1;
6775 kk3 = kk1 * 3;
6776
0d969553 6777/* (2) Evaluation of order 0 */
7fd59977 6778
6779 jj = 1;
6780 i__1 = iorjac;
6781 for (ii = 1; ii <= i__1; ++ii) {
6782 valbas[ii] = herm[jj - 1];
6783 jj += iunit;
6784 }
6785
6786 i__1 = kk1;
6787 for (ii = 1; ii <= i__1; ++ii) {
6788 valbas[ii + iorjac] = wval[0] * vjac[ii - 1];
6789 }
6790
0d969553 6791/* (3) Evaluation of order 1 */
7fd59977 6792
6793 if (*nderiv >= 1) {
6794 jj = 2;
6795 i__1 = iorjac;
6796 for (ii = 1; ii <= i__1; ++ii) {
6797 valbas[ii + valbas_dim1] = herm[jj - 1];
6798 jj += iunit;
6799 }
6800
6801
6802 i__1 = kk1;
6803 for (ii = 1; ii <= i__1; ++ii) {
6804 valbas[ii + iorjac + valbas_dim1] = wval[0] * vjac[ii + kk1 - 1]
6805 + wval[1] * vjac[ii - 1];
6806 }
6807 }
6808
0d969553 6809/* (4) Evaluation of order 2 */
7fd59977 6810
6811 if (*nderiv >= 2) {
6812 jj = 3;
6813 i__1 = iorjac;
6814 for (ii = 1; ii <= i__1; ++ii) {
6815 valbas[ii + (valbas_dim1 << 1)] = herm[jj - 1];
6816 jj += iunit;
6817 }
6818
6819 i__1 = kk1;
6820 for (ii = 1; ii <= i__1; ++ii) {
6821 valbas[ii + iorjac + (valbas_dim1 << 1)] = wval[0] * vjac[ii +
6822 kk2 - 1] + wval[1] * 2 * vjac[ii + kk1 - 1] + wval[2] *
6823 vjac[ii - 1];
6824 }
6825 }
6826
0d969553 6827/* (5) Evaluation of order 3 */
7fd59977 6828
6829 if (*nderiv >= 3) {
6830 jj = 4;
6831 i__1 = iorjac;
6832 for (ii = 1; ii <= i__1; ++ii) {
6833 valbas[ii + valbas_dim1 * 3] = herm[jj - 1];
6834 jj += iunit;
6835 }
6836
6837 i__1 = kk1;
6838 for (ii = 1; ii <= i__1; ++ii) {
6839 valbas[ii + iorjac + valbas_dim1 * 3] = wval[0] * vjac[ii + kk3 -
6840 1] + wval[1] * 3 * vjac[ii + kk2 - 1] + wval[2] * 3 *
6841 vjac[ii + kk1 - 1] + wval[3] * vjac[ii - 1];
6842 }
6843 }
6844
6845 goto L9999;
6846
6847/* ***********************************************************************
6848 */
0d969553 6849/* ERROR PROCESSING */
7fd59977 6850/* ***********************************************************************
6851 */
6852
6853L9101:
6854 *iercod = 1;
6855 goto L9999;
6856
6857L9102:
6858 *iercod = 2;
6859
6860/* ***********************************************************************
6861 */
0d969553 6862/* RETURN CALLING PROGRAM */
7fd59977 6863/* ***********************************************************************
6864 */
6865
6866L9999:
6867
6868 if (*iercod > 0) {
6869 AdvApp2Var_SysBase::maermsg_("MMPOBAS", iercod, 7L);
6870 }
6871 return 0 ;
6872} /* mmpobas_ */
6873
6874//=======================================================================
6875//function : AdvApp2Var_MathBase::mmpocrb_
6876//purpose :
6877//=======================================================================
6878 int AdvApp2Var_MathBase::mmpocrb_(integer *ndimax,
6879 integer *ncoeff,
6880 doublereal *courbe,
6881 integer *ndim,
6882 doublereal *tparam,
6883 doublereal *pntcrb)
6884
6885{
6886 /* System generated locals */
6887 integer courbe_dim1, courbe_offset, i__1, i__2;
6888
6889 /* Local variables */
1ef32e96
RL
6890 integer ncof2;
6891 integer isize, nd, kcf, ncf;
7fd59977 6892
6893
6894/* ***********************************************************************
6895 */
6896
0d969553 6897/* FUNCTION : */
7fd59977 6898/* ---------- */
0d969553
Y
6899/* CALCULATE THE COORDINATES OF A POINT OF A CURVE OF GIVEN PARAMETER */
6900/* TPARAM ( IN 2D, 3D OR MORE) */
7fd59977 6901
0d969553 6902/* KEYWORDS : */
7fd59977 6903/* ----------- */
6904/* TOUS , MATH_ACCES :: COURBE&,PARAMETRE& , POSITIONNEMENT , &POINT
6905 */
6906
0d969553 6907/* INPUT ARGUMENTS : */
7fd59977 6908/* ------------------ */
0d969553
Y
6909/* NDIMAX : format / dimension of the curve */
6910/* NCOEFF : Nb of coefficients of the curve */
6911/* COURBE : Matrix of coefficients of the curve */
6912/* NDIM : Dimension useful of the workspace */
6913/* TPARAM : Value of the parameter where the point is calculated */
7fd59977 6914
0d969553 6915/* OUTPUT ARGUMENTS : */
7fd59977 6916/* ------------------- */
0d969553 6917/* PNTCRB : Coordinates of the calculated point */
7fd59977 6918
0d969553 6919/* COMMONS USED : */
7fd59977 6920/* ---------------- */
6921
6922/* .Neant. */
6923
0d969553 6924/* REFERENCES CALLED : */
7fd59977 6925/* ---------------------- */
6926/* Type Name */
6927/* MIRAZ MVPSCR2 MVPSCR3 */
6928
0d969553 6929/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 6930/* ----------------------------------- */
6931
7fd59977 6932/* > */
6933/* ***********************************************************************
6934 */
6935
6936
6937/* ***********************************************************************
6938 */
6939
6940 /* Parameter adjustments */
6941 courbe_dim1 = *ndimax;
6942 courbe_offset = courbe_dim1 + 1;
6943 courbe -= courbe_offset;
6944 --pntcrb;
6945
6946 /* Function Body */
6947 isize = *ndim << 3;
fadcea2c
RL
6948 AdvApp2Var_SysBase::miraz_(&isize,
6949 &pntcrb[1]);
7fd59977 6950
6951 if (*ncoeff <= 0) {
6952 goto L9999;
6953 }
6954
0d969553 6955/* optimal processing 3d */
7fd59977 6956
6957 if (*ndim == 3 && *ndimax == 3) {
6958 mvpscr3_(ncoeff, &courbe[courbe_offset], tparam, &pntcrb[1]);
6959
0d969553 6960/* optimal processing 2d */
7fd59977 6961
6962 } else if (*ndim == 2 && *ndimax == 2) {
6963 mvpscr2_(ncoeff, &courbe[courbe_offset], tparam, &pntcrb[1]);
6964
0d969553 6965/* Any dimension - scheme of HORNER */
7fd59977 6966
6967 } else if (*tparam == 0.) {
6968 i__1 = *ndim;
6969 for (nd = 1; nd <= i__1; ++nd) {
6970 pntcrb[nd] = courbe[nd + courbe_dim1];
6971/* L100: */
6972 }
6973 } else if (*tparam == 1.) {
6974 i__1 = *ncoeff;
6975 for (ncf = 1; ncf <= i__1; ++ncf) {
6976 i__2 = *ndim;
6977 for (nd = 1; nd <= i__2; ++nd) {
6978 pntcrb[nd] += courbe[nd + ncf * courbe_dim1];
6979/* L300: */
6980 }
6981/* L200: */
6982 }
6983 } else {
6984 ncof2 = *ncoeff + 2;
6985 i__1 = *ndim;
6986 for (nd = 1; nd <= i__1; ++nd) {
6987 i__2 = *ncoeff;
6988 for (ncf = 2; ncf <= i__2; ++ncf) {
6989 kcf = ncof2 - ncf;
6990 pntcrb[nd] = (pntcrb[nd] + courbe[nd + kcf * courbe_dim1]) * *
6991 tparam;
6992/* L500: */
6993 }
6994 pntcrb[nd] += courbe[nd + courbe_dim1];
6995/* L400: */
6996 }
6997 }
6998
6999L9999:
7000 return 0 ;
7001} /* mmpocrb_ */
7002
7003//=======================================================================
7004//function : AdvApp2Var_MathBase::mmmpocur_
7005//purpose :
7006//=======================================================================
7007 int AdvApp2Var_MathBase::mmmpocur_(integer *ncofmx,
7008 integer *ndim,
7009 integer *ndeg,
7010 doublereal *courbe,
7011 doublereal *tparam,
7012 doublereal *tabval)
7013
7014{
7015 /* System generated locals */
7016 integer courbe_dim1, courbe_offset, i__1;
7017
7018 /* Local variables */
1ef32e96
RL
7019 integer i__, nd;
7020 doublereal fu;
7fd59977 7021
7022
7023/* ***********************************************************************
7024 */
7025
0d969553 7026/* FUNCTION : */
7fd59977 7027/* ---------- */
0d969553 7028/* Position of a point on curve (ncofmx,ndim). */
7fd59977 7029
0d969553 7030/* KEYWORDS : */
7fd59977 7031/* ----------- */
7032/* TOUS , AB_SPECIFI :: COURBE&,POLYNOME&,POSITIONNEMENT,&POINT */
7033
0d969553 7034/* INPUT ARGUMENTS : */
7fd59977 7035/* ------------------ */
0d969553
Y
7036/* NCOFMX: Format / degree of the CURVE. */
7037/* NDIM : Dimension of the space. */
7038/* NDEG : Degree of the polynom. */
7039/* COURBE: Coefficients of the curve. */
7040/* TPARAM: Parameter on the curve */
7fd59977 7041
0d969553 7042/* OUTPUT ARGUMENTS : */
7fd59977 7043/* ------------------- */
0d969553 7044/* TABVAL(NDIM): The resulting point (or table of values) */
7fd59977 7045
0d969553 7046/* COMMONS USED : */
7fd59977 7047/* ---------------- */
7048
0d969553 7049/* REFERENCES CALLED : */
7fd59977 7050/* ----------------------- */
7051
0d969553 7052/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 7053/* ----------------------------------- */
7054
7fd59977 7055/* > */
7056/* ***********************************************************************
7057 */
7058
7059 /* Parameter adjustments */
7060 --tabval;
7061 courbe_dim1 = *ncofmx;
7062 courbe_offset = courbe_dim1 + 1;
7063 courbe -= courbe_offset;
7064
7065 /* Function Body */
7066 if (*ndeg < 1) {
7067 i__1 = *ndim;
7068 for (nd = 1; nd <= i__1; ++nd) {
7069 tabval[nd] = 0.;
7070/* L290: */
7071 }
7072 } else {
7073 i__1 = *ndim;
7074 for (nd = 1; nd <= i__1; ++nd) {
7075 fu = courbe[*ndeg + nd * courbe_dim1];
7076 for (i__ = *ndeg - 1; i__ >= 1; --i__) {
7077 fu = fu * *tparam + courbe[i__ + nd * courbe_dim1];
7078/* L120: */
7079 }
7080 tabval[nd] = fu;
7081/* L300: */
7082 }
7083 }
7084 return 0 ;
7085} /* mmmpocur_ */
7086
7087//=======================================================================
7088//function : mmpojac_
7089//purpose :
7090//=======================================================================
7091int mmpojac_(doublereal *tparam,
7092 integer *iordre,
7093 integer *ncoeff,
7094 integer *nderiv,
7095 doublereal *valjac,
7096 integer *iercod)
7097
7098{
1ef32e96 7099 integer c__2 = 2;
7fd59977 7100
7fd59977 7101 /* System generated locals */
7102 integer valjac_dim1, i__1, i__2;
7103
7104 /* Local variables */
1ef32e96
RL
7105 doublereal cofa, cofb, denom, tnorm[100];
7106 integer ii, jj, kk1, kk2;
7107 doublereal aux1, aux2;
7fd59977 7108
7109
7110/* ***********************************************************************
7111 */
7112
0d969553 7113/* FUNCTION : */
7fd59977 7114/* ---------- */
0d969553
Y
7115/* Positioning on Jacobi polynoms and their derivatives */
7116/* successive by a recurrent algorithm */
7fd59977 7117
0d969553 7118/* KEYWORDS : */
7fd59977 7119/* ----------- */
0d969553 7120/* RESERVE, POSITIONING, JACOBI */
7fd59977 7121
0d969553 7122/* INPUT ARGUMENTS : */
7fd59977 7123/* -------------------- */
0d969553
Y
7124/* TPARAM : Parameter for which positioning is done. */
7125/* IORDRE : Order of hermit-?? (-1,0,1, or 2) */
7126/* NCOEFF : Number of coeeficients of polynoms (Nb of value to */
7127/* calculate) */
7128/* NDERIV : Number of derivative to calculate (0<= N <=3) */
7129/* 0 -> Position simple on jacobi functions */
7130/* N -> Position on jacobi functions and their */
7131/* derivatives of order 1 to N. */
7132
7133/* OUTPUT ARGUMENTS : */
7fd59977 7134/* --------------------- */
0d969553 7135/* VALJAC (NCOEFF, 0:NDERIV) : the calculated values */
7fd59977 7136/* i */
7137/* d vj(t) = VALJAC(J, I) */
7138/* -- i */
7139/* dt */
7140
0d969553 7141/* IERCOD : Error Code */
7fd59977 7142/* 0 : Ok */
0d969553 7143/* 1 : Incoherence of input arguments */
7fd59977 7144
0d969553 7145/* COMMONS USED : */
7fd59977 7146/* ------------------ */
7147
7148
0d969553 7149/* REFERENCES CALLED : */
7fd59977 7150/* --------------------- */
7151
7152
0d969553 7153/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 7154/* ----------------------------------- */
7155
7fd59977 7156/* > */
7157/* ***********************************************************************
7158 */
7159/* DECLARATIONS */
7160/* ***********************************************************************
7161 */
7162
7163
0d969553 7164/* static varaibles */
7fd59977 7165
7166
7167
7168 /* Parameter adjustments */
7169 valjac_dim1 = *ncoeff;
7170 --valjac;
7171
7172 /* Function Body */
7173
7174/* ***********************************************************************
7175 */
7176/* INITIALISATIONS */
7177/* ***********************************************************************
7178 */
7179
7180 *iercod = 0;
7181
7182/* ***********************************************************************
7183 */
0d969553 7184/* Processing */
7fd59977 7185/* ***********************************************************************
7186 */
7187
7188 if (*nderiv > 3) {
7189 goto L9101;
7190 }
7191 if (*ncoeff > 100) {
7192 goto L9101;
7193 }
7194
0d969553 7195/* --- Calculation of norms */
7fd59977 7196
7197/* IF (NCOEFF.GT.NBCOF) THEN */
7198 i__1 = *ncoeff;
7199 for (ii = 1; ii <= i__1; ++ii) {
7200 kk1 = ii - 1;
7201 aux2 = 1.;
7202 i__2 = *iordre;
7203 for (jj = 1; jj <= i__2; ++jj) {
7204 aux2 = aux2 * (doublereal) (kk1 + *iordre + jj) / (doublereal) (
7205 kk1 + jj);
7206 }
7207 i__2 = (*iordre << 1) + 1;
7208 tnorm[ii - 1] = sqrt(aux2 * (kk1 * 2. + (*iordre << 1) + 1) / pow__ii(&
7209 c__2, &i__2));
7210 }
7211
7fd59977 7212/* END IF */
7213
0d969553 7214/* --- Trivial Positions ----- */
7fd59977 7215
7216 valjac[1] = 1.;
7217 aux1 = (doublereal) (*iordre + 1);
7218 valjac[2] = aux1 * *tparam;
7219
7220 if (*nderiv >= 1) {
7221 valjac[valjac_dim1 + 1] = 0.;
7222 valjac[valjac_dim1 + 2] = aux1;
7223
7224 if (*nderiv >= 2) {
7225 valjac[(valjac_dim1 << 1) + 1] = 0.;
7226 valjac[(valjac_dim1 << 1) + 2] = 0.;
7227
7228 if (*nderiv >= 3) {
7229 valjac[valjac_dim1 * 3 + 1] = 0.;
7230 valjac[valjac_dim1 * 3 + 2] = 0.;
7231 }
7232 }
7233 }
7234
0d969553 7235/* --- Positioning by recurrence */
7fd59977 7236
7237 i__1 = *ncoeff;
7238 for (ii = 3; ii <= i__1; ++ii) {
7239
7240 kk1 = ii - 1;
7241 kk2 = ii - 2;
7242 aux1 = (doublereal) (*iordre + kk2);
7243 aux2 = aux1 * 2;
7244 cofa = aux2 * (aux2 + 1) * (aux2 + 2);
7245 cofb = (aux2 + 2) * -2. * aux1 * aux1;
7246 denom = kk1 * 2. * (kk2 + (*iordre << 1) + 1) * aux2;
7247 denom = 1. / denom;
7248
7249/* --> Pi(t) */
7250 valjac[ii] = (cofa * *tparam * valjac[kk1] + cofb * valjac[kk2]) *
7251 denom;
7252/* --> P'i(t) */
7253 if (*nderiv >= 1) {
7254 valjac[ii + valjac_dim1] = (cofa * *tparam * valjac[kk1 +
7255 valjac_dim1] + cofa * valjac[kk1] + cofb * valjac[kk2 +
7256 valjac_dim1]) * denom;
7257/* --> P''i(t) */
7258 if (*nderiv >= 2) {
7259 valjac[ii + (valjac_dim1 << 1)] = (cofa * *tparam * valjac[
7260 kk1 + (valjac_dim1 << 1)] + cofa * 2 * valjac[kk1 +
7261 valjac_dim1] + cofb * valjac[kk2 + (valjac_dim1 << 1)]
7262 ) * denom;
7263 }
7264/* --> P'i(t) */
7265 if (*nderiv >= 3) {
7266 valjac[ii + valjac_dim1 * 3] = (cofa * *tparam * valjac[kk1 +
7267 valjac_dim1 * 3] + cofa * 3 * valjac[kk1 + (
7268 valjac_dim1 << 1)] + cofb * valjac[kk2 + valjac_dim1 *
7269 3]) * denom;
7270 }
7271 }
7272 }
7273
0d969553 7274/* ---> Normalization */
7fd59977 7275
7276 i__1 = *ncoeff;
7277 for (ii = 1; ii <= i__1; ++ii) {
7278 i__2 = *nderiv;
7279 for (jj = 0; jj <= i__2; ++jj) {
7280 valjac[ii + jj * valjac_dim1] = tnorm[ii - 1] * valjac[ii + jj *
7281 valjac_dim1];
7282 }
7283 }
7284
7285 goto L9999;
7286
7287/* ***********************************************************************
7288 */
0d969553 7289/* PROCESSING OF ERRORS */
7fd59977 7290/* ***********************************************************************
7291 */
7292
7293L9101:
7294 *iercod = 1;
7295 goto L9999;
7296
7297
7298/* ***********************************************************************
7299 */
0d969553 7300/* RETURN CALLING PROGRAM */
7fd59977 7301/* ***********************************************************************
7302 */
7303
7304L9999:
7305
7306 if (*iercod > 0) {
7307 AdvApp2Var_SysBase::maermsg_("MMPOJAC", iercod, 7L);
7308 }
7309 return 0 ;
7310} /* mmpojac_ */
7311
7312//=======================================================================
7313//function : AdvApp2Var_MathBase::mmposui_
7314//purpose :
7315//=======================================================================
7316 int AdvApp2Var_MathBase::mmposui_(integer *dimmat,
7317 integer *,//nistoc,
7318 integer *aposit,
7319 integer *posuiv,
7320 integer *iercod)
7321
7322{
7323 /* System generated locals */
7324 integer i__1, i__2;
7325
7326 /* Local variables */
1ef32e96
RL
7327 logical ldbg;
7328 integer imin, jmin, i__, j, k;
7329 logical trouve;
7fd59977 7330
7331/* ***********************************************************************
7332 */
7333
0d969553 7334/* FUNCTION : */
7fd59977 7335/* ---------- */
0d969553
Y
7336/* FILL THE TABLE OF POSITIONING POSUIV WHICH ALLOWS TO */
7337/* PARSE BY COLUMN THE INFERIOR TRIANGULAR PART OF THE */
7338/* MATRIX IN FORM OF PROFILE */
7fd59977 7339
7340
0d969553 7341/* KEYWORDS : */
7fd59977 7342/* ----------- */
0d969553 7343/* RESERVE, MATRIX, PROFILE */
7fd59977 7344
0d969553 7345/* INPUT ARGUMENTS : */
7fd59977 7346/* -------------------- */
7347
0d969553
Y
7348/* NISTOC: NUMBER OF COEFFICIENTS IN THE PROFILE */
7349/* DIMMAT: NUMBER OF LINE OF THE SYMMETRIC SQUARE MATRIX */
7350/* APOSIT: TABLE OF POSITIONING OF STORAGE TERMS */
258ff83b 7351/* APOSIT(1,I) CONTAINS THE NUMBER OF TERMES-1 ON LINE */
0d969553 7352/* I IN THE PROFILE OF THE MATRIX */
258ff83b 7353/* APOSIT(2,I) CONTAINS THE INDEX OF STORAGE OF DIAGONAL TERM */
0d969553 7354/* OF LINE I */
7fd59977 7355
7356
0d969553 7357/* OUTPUT ARGUMENTS : */
7fd59977 7358/* --------------------- */
0d969553
Y
7359/* POSUIV: POSUIV(K) (WHERE K IS THE INDEX OF STORAGE OF MAT(I,J)) */
7360/* CONTAINS THE SMALLEST NUMBER IMIN>I OF THE LINE THAT */
7361/* POSSESSES A TERM MAT(IMIN,J) THAT IS IN THE PROFILE. */
7362/* IF THERE IS NO TERM MAT(IMIN,J) IN THE PROFILE THEN POSUIV(K)=-1 */
7fd59977 7363
7364
0d969553 7365/* COMMONS USED : */
7fd59977 7366/* ------------------ */
7367
7368
0d969553 7369/* REFERENCES CALLED : */
7fd59977 7370/* --------------------- */
7371
7372
0d969553 7373/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 7374/* ----------------------------------- */
7375
7376
7fd59977 7377/* ***********************************************************************
7378 */
7379/* DECLARATIONS */
7380/* ***********************************************************************
7381 */
7382
7383
7384
7385/* ***********************************************************************
7386 */
0d969553 7387/* INITIALIZATIONS */
7fd59977 7388/* ***********************************************************************
7389 */
7390
7391 /* Parameter adjustments */
7392 aposit -= 3;
7393 --posuiv;
7394
7395 /* Function Body */
7396 ldbg = AdvApp2Var_SysBase::mnfndeb_() >= 2;
7397 if (ldbg) {
7398 AdvApp2Var_SysBase::mgenmsg_("MMPOSUI", 7L);
7399 }
7400 *iercod = 0;
7401
7402
7403/* ***********************************************************************
7404 */
0d969553 7405/* PROCESSING */
7fd59977 7406/* ***********************************************************************
7407 */
7408
7409
7410
7411 i__1 = *dimmat;
7412 for (i__ = 1; i__ <= i__1; ++i__) {
7413 jmin = i__ - aposit[(i__ << 1) + 1];
7414 i__2 = i__;
7415 for (j = jmin; j <= i__2; ++j) {
7416 imin = i__ + 1;
7417 trouve = FALSE_;
7418 while(! trouve && imin <= *dimmat) {
7419 if (imin - aposit[(imin << 1) + 1] <= j) {
7420 trouve = TRUE_;
7421 } else {
7422 ++imin;
7423 }
7424 }
7425 k = aposit[(i__ << 1) + 2] - i__ + j;
7426 if (trouve) {
7427 posuiv[k] = imin;
7428 } else {
7429 posuiv[k] = -1;
7430 }
7431 }
7432 }
7433
7434
7435
7436
7437
7438 goto L9999;
7439
7440/* ***********************************************************************
7441 */
0d969553 7442/* ERROR PROCESSING */
7fd59977 7443/* ***********************************************************************
7444 */
7445
7446
7447
7448
7449/* ***********************************************************************
7450 */
0d969553 7451/* RETURN CALLING PROGRAM */
7fd59977 7452/* ***********************************************************************
7453 */
7454
7455L9999:
7456
7457/* ___ DESALLOCATION, ... */
7458
7459 AdvApp2Var_SysBase::maermsg_("MMPOSUI", iercod, 7L);
7460 if (ldbg) {
7461 AdvApp2Var_SysBase::mgsomsg_("MMPOSUI", 7L);
7462 }
7463 return 0 ;
7464} /* mmposui_ */
7465
7466//=======================================================================
7467//function : AdvApp2Var_MathBase::mmresol_
7468//purpose :
7469//=======================================================================
7470 int AdvApp2Var_MathBase::mmresol_(integer *hdimen,
7471 integer *gdimen,
7472 integer *hnstoc,
7473 integer *gnstoc,
7474 integer *mnstoc,
7475 doublereal *matsyh,
7476 doublereal *matsyg,
7477 doublereal *vecsyh,
7478 doublereal *vecsyg,
7479 integer *hposit,
7480 integer *hposui,
7481 integer *gposit,
7482 integer *mmposui,
7483 integer *mposit,
7484 doublereal *vecsol,
7485 integer *iercod)
7486
7487{
1ef32e96 7488 integer c__100 = 100;
7fd59977 7489
7490 /* System generated locals */
7491 integer i__1, i__2;
7492
7493 /* Local variables */
1ef32e96
RL
7494 logical ldbg;
7495 doublereal* mcho = 0;
7496 integer jmin, jmax, i__, j, k, l;
7497 intptr_t iofv1, iofv2, iofv3, iofv4;
7498 doublereal *v1 = 0, *v2 = 0, *v3 = 0, *v4 = 0;
7499 integer deblig, dimhch;
7500 doublereal* hchole = 0;
7501 intptr_t iofmch, iofmam, iofhch;
7502 doublereal* matsym = 0;
7503 integer ier;
7504 integer aux;
7fd59977 7505
7506
7507
7508/* ***********************************************************************
7509 */
7510
0d969553 7511/* FUNCTION : */
7fd59977 7512/* ---------- */
0d969553 7513/* SOLUTION OF THE SYSTEM */
7fd59977 7514/* H t(G) V B */
7515/* = */
7516/* G 0 L C */
7517
0d969553 7518/* KEYWORDS : */
7fd59977 7519/* ----------- */
0d969553 7520/* RESERVE, SOLUTION, SYSTEM, LAGRANGIAN */
7fd59977 7521
0d969553 7522/* INPUT ARGUMENTS : */
7fd59977 7523/* -------------------- */
0d969553
Y
7524/* HDIMEN: NOMBER OF LINE (OR COLUMN) OF THE HESSIAN MATRIX */
7525/* GDIMEN: NOMBER OF LINE OF THE MATRIX OF CONSTRAINTS */
7526/* HNSTOC: NOMBErS OF TERMS IN THE PROFILE OF HESSIAN MATRIX
7527*/
7528/* GNSTOC: NOMBERS OF TERMS IN THE PROFILE OF THE MATRIX OF CONSTRAINTS */
7529/* MNSTOC: NOMBERS OF TERMS IN THE PROFILE OF THE MATRIX M= G H t(G) */
7530/* where H IS THE HESSIAN MATRIX AND G IS THE MATRIX OF CONSTRAINTS */
258ff83b 7531/* MATSYH: TRIANGULAR INFERIOR PART OF THE HESSIAN MATRIX */
0d969553
Y
7532/* IN FORM OF PROFILE */
7533/* MATSYG: MATRIX OF CONSTRAINTS IN FORM OF PROFILE */
7534/* VECSYH: VECTOR OF THE SECOND MEMBER ASSOCIATED TO MATSYH */
7535/* VECSYG: VECTOR OF THE SECOND MEMBER ASSOCIATED TO MATSYG */
7536/* HPOSIT: TABLE OF POSITIONING OF THE HESSIAN MATRIX */
7537/* HPOSIT(1,I) CONTAINS THE NUMBER OF TERMS -1 */
7538/* WHICH ARE IN THE PROFILE AT LINE I */
7539/* HPOSIT(2,I) CONTAINS THE INDEX OF STORAGE OF TERM */
7540/* DIAGONAL OF THE MATRIX AT LINE I */
7541/* HPOSUI: TABLE ALLOWING TO PARSE THE HESSIAN MATRIX BY COLUMN */
7542/* IN FORM OF PROFILE */
7543/* HPOSUI(K) CONTAINS THE NUMBER OF LINE IMIN FOLLOWING THE CURRENT LINE*/
7544/* I WHERE H(I,J)=MATSYH(K) AS IT EXISTS IN THE */
7545/* SAME COLUMN J A TERM IN THE PROFILE OF LINE IMIN */
7546/* IF SUCH TERM DOES NOT EXIST IMIN=-1 */
7547/* GPOSIT: TABLE OF POSITIONING OF THE MATRIX OF CONSTRAINTS */
7548/* GPOSIT(1,I) CONTAINS THE NUMBER OF TERMS OF LINE I */
7549/* WHICH ARE IN THE PROFILE */
258ff83b 7550/* GPOSIT(2,I) CONTAINS THE INDEX OF STORAGE OF THE LAST TERM */
0d969553
Y
7551/* OF LINE I WHICH IS IN THE PROFILE */
7552/* GPOSIT(3,I) CONTAINS THE NUMBER OF COLUMN CORRESPONDING */
7553/* TO THE FIRST TERM OF LINE I WHICH IS IN THE PROFILE */
258ff83b 7554/* MMPOSUI, MPOSIT: SAME STRUCTURE AS HPOSUI, BUT FOR MATRIX */
7fd59977 7555/* M=G H t(G) */
7556
7557
0d969553 7558/* OUTPUT ARGUMENTS : */
7fd59977 7559/* --------------------- */
0d969553
Y
7560/* VECSOL: VECTOR SOLUTION V OF THE SYSTEM */
7561/* IERCOD: ERROR CODE */
7fd59977 7562
0d969553 7563/* COMMONS USED : */
7fd59977 7564/* ------------------ */
7565
7566
0d969553 7567/* REFERENCES CALLED : */
7fd59977 7568/* --------------------- */
7569
7570
0d969553 7571/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 7572/* ----------------------------------- */
7fd59977 7573/* > */
7574/* ***********************************************************************
7575 */
7576/* DECLARATIONS */
7577/* ***********************************************************************
7578 */
7579
7580/* ***********************************************************************
7581 */
7582/* INITIALISATIONS */
7583/* ***********************************************************************
7584 */
7585
7586 /* Parameter adjustments */
7587 --vecsol;
7588 hposit -= 3;
7589 --vecsyh;
7590 --hposui;
7591 --matsyh;
7592 --matsyg;
7593 --vecsyg;
7594 gposit -= 4;
7595 --mmposui;
7596 mposit -= 3;
7597
7598 /* Function Body */
7599 ldbg = AdvApp2Var_SysBase::mnfndeb_() >= 2;
7600 if (ldbg) {
7601 AdvApp2Var_SysBase::mgenmsg_("MMRESOL", 7L);
7602 }
7603 *iercod = 0;
7604 iofhch = 0;
7605 iofv1 = 0;
7606 iofv2 = 0;
7607 iofv3 = 0;
7608 iofv4 = 0;
7609 iofmam = 0;
7610 iofmch = 0;
7611
7612/* ***********************************************************************
7613 */
0d969553 7614/* PROCESSING */
7fd59977 7615/* ***********************************************************************
7616 */
7617
0d969553 7618/* Dynamic allocation */
1ef32e96
RL
7619 AdvApp2Var_SysBase anAdvApp2Var_SysBase;
7620 anAdvApp2Var_SysBase.macrar8_(hdimen, &c__100, v1, &iofv1, &ier);
7fd59977 7621 if (ier > 0) {
7622 goto L9102;
7623 }
7624 dimhch = hposit[(*hdimen << 1) + 2];
1ef32e96 7625 anAdvApp2Var_SysBase.macrar8_(&dimhch, &c__100, hchole, &iofhch, &ier);
7fd59977 7626 if (ier > 0) {
7627 goto L9102;
7628 }
7629
0d969553
Y
7630/* solution of system 1 H V1 = b */
7631/* where H=MATSYH and b=VECSYH */
7fd59977 7632
7633 mmchole_(hnstoc, hdimen, &matsyh[1], &hposit[3], &hposui[1], &hchole[
7634 iofhch], &ier);
7635 if (ier > 0) {
7636 goto L9101;
7637 }
7638 mmrslss_(hnstoc, hdimen, &hchole[iofhch], &hposit[3], &hposui[1], &vecsyh[
7639 1], &v1[iofv1], &ier);
7640 if (ier > 0) {
7641 goto L9102;
7642 }
7643
0d969553 7644/* Case when there are constraints */
7fd59977 7645
7646 if (*gdimen > 0) {
7647
0d969553
Y
7648/* Calculate the vector of the second member V2=G H(-1) b -c = G v1-c */
7649/* of system of unknown Lagrangian vector MULTIP */
7650/* where G=MATSYG */
7651/* c=VECSYG */
7fd59977 7652
1ef32e96 7653 anAdvApp2Var_SysBase.macrar8_(gdimen, &c__100, v2, &iofv2, &ier);
7fd59977 7654 if (ier > 0) {
7655 goto L9102;
7656 }
1ef32e96 7657 anAdvApp2Var_SysBase.macrar8_(hdimen, &c__100, v3, &iofv3, &ier);
7fd59977 7658 if (ier > 0) {
7659 goto L9102;
7660 }
1ef32e96 7661 anAdvApp2Var_SysBase.macrar8_(gdimen, &c__100, v4, &iofv4, &ier);
7fd59977 7662 if (ier > 0) {
7663 goto L9102;
7664 }
1ef32e96 7665 anAdvApp2Var_SysBase.macrar8_(mnstoc, &c__100, matsym, &iofmam, &ier);
7fd59977 7666 if (ier > 0) {
7667 goto L9102;
7668 }
7669
7670 deblig = 1;
7671 mmatvec_(gdimen, hdimen, &gposit[4], gnstoc, &matsyg[1], &v1[iofv1], &
7672 deblig, &v2[iofv2], &ier);
7673 if (ier > 0) {
7674 goto L9101;
7675 }
7676 i__1 = *gdimen;
7677 for (i__ = 1; i__ <= i__1; ++i__) {
7678 v2[i__ + iofv2 - 1] -= vecsyg[i__];
7679 }
7680
0d969553 7681/* Calculate the matrix M= G H(-1) t(G) */
7fd59977 7682/* RESOL DU SYST 2 : H qi = gi */
0d969553 7683/* where is a vector column of t(G) */
7fd59977 7684/* qi=v3 */
0d969553
Y
7685/* then calculate G qi */
7686/* then construct M in form of profile */
7fd59977 7687
7688
7689
7690 i__1 = *gdimen;
7691 for (i__ = 1; i__ <= i__1; ++i__) {
fadcea2c
RL
7692 AdvApp2Var_SysBase::mvriraz_(hdimen, &v1[iofv1]);
7693 AdvApp2Var_SysBase::mvriraz_(hdimen, &v3[iofv3]);
7694 AdvApp2Var_SysBase::mvriraz_(gdimen, &v4[iofv4]);
7fd59977 7695 jmin = gposit[i__ * 3 + 3];
7696 jmax = gposit[i__ * 3 + 1] + gposit[i__ * 3 + 3] - 1;
7697 aux = gposit[i__ * 3 + 2] - gposit[i__ * 3 + 1] - jmin + 1;
7698 i__2 = jmax;
7699 for (j = jmin; j <= i__2; ++j) {
7700 k = j + aux;
7701 v1[j + iofv1 - 1] = matsyg[k];
7702 }
7703 mmrslss_(hnstoc, hdimen, &hchole[iofhch], &hposit[3], &hposui[1],
7704 &v1[iofv1], &v3[iofv3], &ier);
7705 if (ier > 0) {
7706 goto L9101;
7707 }
7708
7709 deblig = i__;
7710 mmatvec_(gdimen, hdimen, &gposit[4], gnstoc, &matsyg[1], &v3[
7711 iofv3], &deblig, &v4[iofv4], &ier);
7712 if (ier > 0) {
7713 goto L9101;
7714 }
7715
7716 k = mposit[(i__ << 1) + 2];
7717 matsym[k + iofmam - 1] = v4[i__ + iofv4 - 1];
7718 while(mmposui[k] > 0) {
7719 l = mmposui[k];
7720 k = mposit[(l << 1) + 2] - l + i__;
7721 matsym[k + iofmam - 1] = v4[l + iofv4 - 1];
7722 }
7723 }
7724
7725
0d969553
Y
7726/* SOLVE SYST 3 M L = V2 */
7727/* WITH L=V4 */
7fd59977 7728
7729
fadcea2c 7730 AdvApp2Var_SysBase::mvriraz_(gdimen, &v4[iofv4]);
1ef32e96 7731 anAdvApp2Var_SysBase.macrar8_(mnstoc, &c__100, mcho, &iofmch, &ier);
7fd59977 7732 if (ier > 0) {
7733 goto L9102;
7734 }
7735 mmchole_(mnstoc, gdimen, &matsym[iofmam], &mposit[3], &mmposui[1], &
7736 mcho[iofmch], &ier);
7737 if (ier > 0) {
7738 goto L9101;
7739 }
7740 mmrslss_(mnstoc, gdimen, &mcho[iofmch], &mposit[3], &mmposui[1], &v2[
7741 iofv2], &v4[iofv4], &ier);
7742 if (ier > 0) {
7743 goto L9102;
7744 }
7745
7746
0d969553 7747/* CALCULATE THE VECTOR OF THE SECOND MEMBER OF THE SYSTEM Hx = b - t(G) L
7fd59977 7748*/
7749/* = V1 */
7750
fadcea2c 7751 AdvApp2Var_SysBase::mvriraz_(hdimen, &v1[iofv1]);
7fd59977 7752 mmtmave_(gdimen, hdimen, &gposit[4], gnstoc, &matsyg[1], &v4[iofv4], &
7753 v1[iofv1], &ier);
7754 if (ier > 0) {
7755 goto L9101;
7756 }
7757 i__1 = *hdimen;
7758 for (i__ = 1; i__ <= i__1; ++i__) {
7759 v1[i__ + iofv1 - 1] = vecsyh[i__] - v1[i__ + iofv1 - 1];
7760 }
7761
7762/* RESOL SYST 4 Hx = b - t(G) L */
7763
7764
7765 mmrslss_(hnstoc, hdimen, &hchole[iofhch], &hposit[3], &hposui[1], &v1[
7766 iofv1], &vecsol[1], &ier);
7767 if (ier > 0) {
7768 goto L9102;
7769 }
7770 } else {
7771 i__1 = *hdimen;
7772 for (i__ = 1; i__ <= i__1; ++i__) {
7773 vecsol[i__] = v1[i__ + iofv1 - 1];
7774 }
7775 }
7776
7777 goto L9999;
7778
7779/* ***********************************************************************
7780 */
0d969553 7781/* PROCESSING OF ERRORS */
7fd59977 7782/* ***********************************************************************
7783 */
7784
7785
7786L9101:
7787 *iercod = 1;
7788 goto L9999;
7789
7790L9102:
0d969553 7791 AdvApp2Var_SysBase::mswrdbg_("MMRESOL : PROBLEM WITH DIMMAT", 30L);
7fd59977 7792 *iercod = 2;
7793
7794/* ***********************************************************************
7795 */
0d969553 7796/* RETURN CALLING PROGRAM */
7fd59977 7797/* ***********************************************************************
7798 */
7799
7800L9999:
7801
7802/* ___ DESALLOCATION, ... */
1ef32e96 7803 anAdvApp2Var_SysBase.macrdr8_(hdimen, &c__100, v1, &iofv1, &ier);
7fd59977 7804 if (*iercod == 0 && ier > 0) {
7805 *iercod = 3;
7806 }
1ef32e96 7807 anAdvApp2Var_SysBase.macrdr8_(&dimhch, &c__100, hchole, &iofhch, &ier);
7fd59977 7808 if (*iercod == 0 && ier > 0) {
7809 *iercod = 3;
7810 }
1ef32e96 7811 anAdvApp2Var_SysBase.macrdr8_(gdimen, &c__100, v2, &iofv2, &ier);
7fd59977 7812 if (*iercod == 0 && ier > 0) {
7813 *iercod = 3;
7814 }
1ef32e96 7815 anAdvApp2Var_SysBase.macrdr8_(hdimen, &c__100, v3, &iofv3, &ier);
7fd59977 7816 if (*iercod == 0 && ier > 0) {
7817 *iercod = 3;
7818 }
1ef32e96 7819 anAdvApp2Var_SysBase.macrdr8_(gdimen, &c__100, v4, &iofv4, &ier);
7fd59977 7820 if (*iercod == 0 && ier > 0) {
7821 *iercod = 3;
7822 }
1ef32e96 7823 anAdvApp2Var_SysBase.macrdr8_(mnstoc, &c__100, matsym, &iofmam, &ier);
7fd59977 7824 if (*iercod == 0 && ier > 0) {
7825 *iercod = 3;
7826 }
1ef32e96 7827 anAdvApp2Var_SysBase.macrdr8_(mnstoc, &c__100, mcho, &iofmch, &ier);
7fd59977 7828 if (*iercod == 0 && ier > 0) {
7829 *iercod = 3;
7830 }
7831
7832 AdvApp2Var_SysBase::maermsg_("MMRESOL", iercod, 7L);
7833 if (ldbg) {
7834 AdvApp2Var_SysBase::mgsomsg_("MMRESOL", 7L);
7835 }
7836 return 0 ;
7837} /* mmresol_ */
7838
7839//=======================================================================
7840//function : mmrslss_
7841//purpose :
7842//=======================================================================
7843int mmrslss_(integer *,//mxcoef,
7844 integer *dimens,
7845 doublereal *smatri,
7846 integer *sposit,
7847 integer *posuiv,
7848 doublereal *mscnmbr,
7849 doublereal *soluti,
7850 integer *iercod)
7851{
7852 /* System generated locals */
7853 integer i__1, i__2;
7854
7855 /* Local variables */
1ef32e96
RL
7856 logical ldbg;
7857 integer i__, j;
7858 doublereal somme;
7859 integer pointe, ptcour;
7fd59977 7860
7861/* ***********************************************************************
7862 */
7863
0d969553 7864/* FuNCTION : */
7fd59977 7865/* ---------- T */
0d969553
Y
7866/* Solves linear system SS x = b where S is a */
7867/* triangular lower matrix given in form of profile */
7fd59977 7868
0d969553 7869/* KEYWORDS : */
7fd59977 7870/* ----------- */
7871/* RESERVE, MATRICE_PROFILE, RESOLUTION, CHOLESKI */
7872
0d969553 7873/* INPUT ARGUMENTS : */
7fd59977 7874/* -------------------- */
0d969553
Y
7875/* MXCOEF : Maximum number of non-null coefficient in the matrix */
7876/* DIMENS : Dimension of the matrix */
7877/* SMATRI(MXCOEF) : Values of coefficients of the matrix */
7fd59977 7878/* SPOSIT(2,DIMENS): */
0d969553
Y
7879/* SPOSIT(1,*) : Distance diagonal-extremity of the line */
7880/* SPOSIT(2,*) : Position of diagonal terms in AMATRI */
7881/* POSUIV(MXCOEF): first line inferior not out of profile */
7882/* MSCNMBR(DIMENS): Vector second member of the equation */
7fd59977 7883
0d969553 7884/* OUTPUT ARGUMENTS : */
7fd59977 7885/* --------------------- */
0d969553
Y
7886/* SOLUTI(NDIMEN) : Result vector */
7887/* IERCOD : Error code 0 : ok */
7fd59977 7888
0d969553 7889/* COMMONS USED : */
7fd59977 7890/* ------------------ */
7891
7892
0d969553 7893/* REFERENCES CALLED : */
7fd59977 7894/* --------------------- */
7895
7896
0d969553 7897/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 7898/* ----------------------------------- */
7899/* T */
0d969553
Y
7900/* SS is the decomposition of choleski of a symmetric matrix */
7901/* defined postive, that can result from routine MMCHOLE. */
7fd59977 7902
0d969553 7903/* For a full matrix it is possible to use MRSLMSC */
7fd59977 7904
0d969553 7905/* LEVEL OF DEBUG = 4 */
7fd59977 7906/* > */
7907/* ***********************************************************************
7908 */
7909/* DECLARATIONS */
7910/* ***********************************************************************
7911 */
7912
7913
7914
7915/* ***********************************************************************
7916 */
7917/* INITIALISATIONS */
7918/* ***********************************************************************
7919 */
7920
7921 /* Parameter adjustments */
7922 --posuiv;
7923 --smatri;
7924 --soluti;
7925 --mscnmbr;
7926 sposit -= 3;
7927
7928 /* Function Body */
7929 ldbg = AdvApp2Var_SysBase::mnfndeb_() >= 4;
7930 if (ldbg) {
7931 AdvApp2Var_SysBase::mgenmsg_("MMRSLSS", 7L);
7932 }
7933 *iercod = 0;
7934
7935/* ***********************************************************************
7936 */
0d969553 7937/* PROCESSING */
7fd59977 7938/* ***********************************************************************
7939 */
7940
0d969553 7941/* ----- Solution of Sw = b */
7fd59977 7942
7943 i__1 = *dimens;
7944 for (i__ = 1; i__ <= i__1; ++i__) {
7945
7946 pointe = sposit[(i__ << 1) + 2];
7947 somme = 0.;
7948 i__2 = i__ - 1;
7949 for (j = i__ - sposit[(i__ << 1) + 1]; j <= i__2; ++j) {
7950 somme += smatri[pointe - (i__ - j)] * soluti[j];
7951 }
7952
7953 soluti[i__] = (mscnmbr[i__] - somme) / smatri[pointe];
7954 }
7955/* T */
0d969553 7956/* ----- Solution of S u = w */
7fd59977 7957
7958 for (i__ = *dimens; i__ >= 1; --i__) {
7959
7960 pointe = sposit[(i__ << 1) + 2];
7961 j = posuiv[pointe];
7962 somme = 0.;
7963 while(j > 0) {
7964 ptcour = sposit[(j << 1) + 2] - (j - i__);
7965 somme += smatri[ptcour] * soluti[j];
7966 j = posuiv[ptcour];
7967 }
7968
7969 soluti[i__] = (soluti[i__] - somme) / smatri[pointe];
7970 }
7971
7972 goto L9999;
7973
7974/* ***********************************************************************
7975 */
0d969553 7976/* ERROR PROCESSING */
7fd59977 7977/* ***********************************************************************
7978 */
7979
7980
7981/* ***********************************************************************
7982 */
0d969553 7983/* RETURN PROGRAM CALLING */
7fd59977 7984/* ***********************************************************************
7985 */
7986
7987L9999:
7988
7989 AdvApp2Var_SysBase::maermsg_("MMRSLSS", iercod, 7L);
7990 if (ldbg) {
7991 AdvApp2Var_SysBase::mgsomsg_("MMRSLSS", 7L);
7992 }
7993 return 0 ;
7994} /* mmrslss_ */
7995
7996//=======================================================================
7997//function : mmrslw_
7998//purpose :
7999//=======================================================================
8000int mmrslw_(integer *normax,
8001 integer *nordre,
8002 integer *ndimen,
8003 doublereal *epspiv,
8004 doublereal *abmatr,
8005 doublereal *xmatri,
8006 integer *iercod)
8007{
8008 /* System generated locals */
8009 integer abmatr_dim1, abmatr_offset, xmatri_dim1, xmatri_offset, i__1,
8010 i__2, i__3;
8011 doublereal d__1;
8012
8013 /* Local variables */
1ef32e96
RL
8014 integer kpiv;
8015 doublereal pivot;
8016 integer ii, jj, kk;
8017 doublereal akj;
7fd59977 8018
8019
8020/* **********************************************************************
8021*/
8022
0d969553 8023/* FUNCTION : */
7fd59977 8024/* ---------- */
0d969553
Y
8025/* Solution of a linear system A.x = B of N equations to N */
8026/* unknown by Gauss method (partial pivot) or : */
8027/* A is matrix NORDRE * NORDRE, */
8028/* B is matrix NORDRE (lines) * NDIMEN (columns), */
8029/* x is matrix NORDRE (lines) * NDIMEN (columns). */
8030/* In this program, A and B are stored in matrix ABMATR */
8031/* the lines and columns which of were inverted. ABMATR(k,j) is */
8032/* term A(j,k) if k <= NORDRE, B(j,k-NORDRE) otherwise (see example). */
8033
8034/* KEYWORDS : */
7fd59977 8035/* ----------- */
8036/* TOUS, MATH_ACCES::EQUATION&, MATRICE&, RESOLUTION, GAUSS, &SOLUTION */
8037
0d969553 8038/* INPUT ARGUMENTS : */
7fd59977 8039/* ------------------ */
0d969553
Y
8040/* NORMAX : Max size of the first index of XMATRI. This argument */
8041/* serves only for the declaration of dimension of XMATRI and should be */
8042/* above or equal to NORDRE. */
8043/* NORDRE : Order of the matrix i.e. number of equations and */
8044/* unknown quantities of the linear system to be solved. */
8045/* NDIMEN : Number of the second member. */
8046/* EPSPIV : Minimal value of a pivot. If during the calculation */
8047/* the absolute value of the pivot is below EPSPIV, the */
8048/* system of equations is declared singular. EPSPIV should */
8049/* be a "small" real. */
8050
8051/* ABMATR(NORDRE+NDIMEN,NORDRE) : Auxiliary matrix containing */
8052/* matrix A and matrix B. */
8053
8054/* OUTPUT ARGUMENTS : */
7fd59977 8055/* ------------------- */
0d969553
Y
8056/* XMATRI : Matrix containing NORDRE*NDIMEN solutions. */
8057/* IERCOD=0 shows that all solutions are calculated. */
8058/* IERCOD=1 shows that the matrix is of lower rank than NORDRE */
8059/* (the system is singular). */
7fd59977 8060
0d969553 8061/* COMMONS USED : */
7fd59977 8062/* ---------------- */
8063
0d969553 8064/* REFERENCES CALLED : */
7fd59977 8065/* ----------------------- */
8066
0d969553 8067/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 8068/* ----------------------------------- */
0d969553
Y
8069/* ATTENTION : the indices of line and column are inverted */
8070/* compared to usual indices. */
8071/* System : */
7fd59977 8072/* a1*x + b1*y = c1 */
8073/* a2*x + b2*y = c2 */
0d969553 8074/* should be represented by matrix ABMATR : */
7fd59977 8075
8076/* ABMATR(1,1) = a1 ABMATR(1,2) = a2 */
8077/* ABMATR(2,1) = b1 ABMATR(2,2) = b2 */
8078/* ABMATR(3,1) = c1 ABMATR(3,2) = c2 */
8079
0d969553 8080/* To solve this system, it is necessary to set : */
7fd59977 8081
0d969553
Y
8082/* NORDRE = 2 (there are 2 equations with 2 unknown values), */
8083/* NDIMEN = 1 (there is only one second member), */
8084/* any NORMAX can be taken >= NORDRE. */
7fd59977 8085
0d969553
Y
8086/* To use this routine, it is recommended to use one of */
8087/* interfaces : MMRSLWI or MMMRSLWD. */
7fd59977 8088/* > */
8089/* **********************************************************************
8090*/
8091
0d969553 8092/* Name of the routine */
7fd59977 8093
8094/* INTEGER IBB,MNFNDEB */
8095
8096/* IBB=MNFNDEB() */
8097/* IF (IBB.GE.2) CALL MGENMSG(NOMPR) */
8098 /* Parameter adjustments */
8099 xmatri_dim1 = *normax;
8100 xmatri_offset = xmatri_dim1 + 1;
8101 xmatri -= xmatri_offset;
8102 abmatr_dim1 = *nordre + *ndimen;
8103 abmatr_offset = abmatr_dim1 + 1;
8104 abmatr -= abmatr_offset;
8105
8106 /* Function Body */
8107 *iercod = 0;
8108
8109/* *********************************************************************
8110*/
0d969553 8111/* Triangulation of matrix ABMATR. */
7fd59977 8112/* *********************************************************************
8113*/
8114
8115 i__1 = *nordre;
8116 for (kk = 1; kk <= i__1; ++kk) {
8117
0d969553 8118/* ---------- Find max pivot in column KK. ------------
7fd59977 8119--- */
8120
8121 pivot = *epspiv;
8122 kpiv = 0;
8123 i__2 = *nordre;
8124 for (jj = kk; jj <= i__2; ++jj) {
41194117 8125 akj = (d__1 = abmatr[kk + jj * abmatr_dim1], advapp_abs(d__1));
7fd59977 8126 if (akj > pivot) {
8127 pivot = akj;
8128 kpiv = jj;
8129 }
8130/* L100: */
8131 }
8132 if (kpiv == 0) {
8133 goto L9900;
8134 }
8135
0d969553 8136/* --------- Swapping of line KPIV with line KK. ------
7fd59977 8137--- */
8138
8139 if (kpiv != kk) {
8140 i__2 = *nordre + *ndimen;
8141 for (jj = kk; jj <= i__2; ++jj) {
8142 akj = abmatr[jj + kk * abmatr_dim1];
8143 abmatr[jj + kk * abmatr_dim1] = abmatr[jj + kpiv *
8144 abmatr_dim1];
8145 abmatr[jj + kpiv * abmatr_dim1] = akj;
8146/* L200: */
8147 }
8148 }
8149
0d969553 8150/* ---------- Removal and triangularization. -----------
7fd59977 8151--- */
8152
8153 pivot = -abmatr[kk + kk * abmatr_dim1];
8154 i__2 = *nordre;
8155 for (ii = kk + 1; ii <= i__2; ++ii) {
8156 akj = abmatr[kk + ii * abmatr_dim1] / pivot;
8157 i__3 = *nordre + *ndimen;
8158 for (jj = kk + 1; jj <= i__3; ++jj) {
8159 abmatr[jj + ii * abmatr_dim1] += akj * abmatr[jj + kk *
8160 abmatr_dim1];
8161/* L400: */
8162 }
8163/* L300: */
8164 }
8165
8166
8167/* L1000: */
8168 }
8169
8170/* *********************************************************************
8171*/
0d969553
Y
8172/* Solution of the system of triangular equations. */
8173/* Matrix ABMATR(NORDRE+JJ,II), contains second members */
8174/* of the system for 1<=j<=NDIMEN and 1<=i<=NORDRE. */
7fd59977 8175/* *********************************************************************
8176*/
8177
8178
0d969553 8179/* ---------------- Calculation of solutions by ascending. -----------------
7fd59977 8180*/
8181
8182 for (kk = *nordre; kk >= 1; --kk) {
8183 pivot = abmatr[kk + kk * abmatr_dim1];
8184 i__1 = *ndimen;
8185 for (ii = 1; ii <= i__1; ++ii) {
8186 akj = abmatr[ii + *nordre + kk * abmatr_dim1];
8187 i__2 = *nordre;
8188 for (jj = kk + 1; jj <= i__2; ++jj) {
8189 akj -= abmatr[jj + kk * abmatr_dim1] * xmatri[jj + ii *
8190 xmatri_dim1];
8191/* L800: */
8192 }
8193 xmatri[kk + ii * xmatri_dim1] = akj / pivot;
8194/* L700: */
8195 }
8196/* L600: */
8197 }
8198 goto L9999;
8199
258ff83b 8200/* ------If the absolute value of a pivot is smaller than -------- */
0d969553 8201/* ---------- EPSPIV: return the code of error. ------------
7fd59977 8202*/
8203
8204L9900:
8205 *iercod = 1;
8206
8207
8208
8209L9999:
8210 if (*iercod > 0) {
8211 AdvApp2Var_SysBase::maermsg_("MMRSLW ", iercod, 7L);
8212 }
8213/* IF (IBB.GE.2) CALL MGSOMSG(NOMPR) */
8214 return 0 ;
8215} /* mmrslw_ */
8216
8217//=======================================================================
8218//function : AdvApp2Var_MathBase::mmmrslwd_
8219//purpose :
8220//=======================================================================
8221 int AdvApp2Var_MathBase::mmmrslwd_(integer *normax,
8222 integer *nordre,
8223 integer *ndim,
8224 doublereal *amat,
8225 doublereal *bmat,
8226 doublereal *epspiv,
8227 doublereal *aaux,
8228 doublereal *xmat,
8229 integer *iercod)
8230
8231{
8232 /* System generated locals */
8233 integer amat_dim1, amat_offset, bmat_dim1, bmat_offset, xmat_dim1,
8234 xmat_offset, aaux_dim1, aaux_offset, i__1, i__2;
8235
8236 /* Local variables */
1ef32e96
RL
8237 integer i__, j;
8238 integer ibb;
7fd59977 8239
8240/* IMPLICIT DOUBLE PRECISION (A-H,O-Z) */
8241/* IMPLICIT INTEGER (I-N) */
8242
8243
8244/* **********************************************************************
8245*/
8246
0d969553 8247/* FUNCTION : */
7fd59977 8248/* ---------- */
0d969553
Y
8249/* Solution of a linear system by Gauss method where */
8250/* the second member is a table of vectors. Method of partial pivot. */
7fd59977 8251
0d969553 8252/* KEYWORDS : */
7fd59977 8253/* ----------- */
0d969553 8254/* ALL, MATH_ACCES :: */
7fd59977 8255/* SYSTEME&,EQUATION&, RESOLUTION,GAUSS ,&VECTEUR */
8256
0d969553 8257/* INPUT ARGUMENTS : */
7fd59977 8258/* ------------------ */
0d969553
Y
8259/* NORMAX : Max. Dimension of AMAT. */
8260/* NORDRE : Order of the matrix. */
8261/* NDIM : Number of columns of BMAT and XMAT. */
8262/* AMAT(NORMAX,NORDRE) : The processed matrix. */
8263/* BMAT(NORMAX,NDIM) : The matrix of second member. */
8264/* XMAT(NORMAX,NDIM) : The matrix of solutions. */
8265/* EPSPIV : Min value of a pivot. */
8266
8267/* OUTPUT ARGUMENTS : */
7fd59977 8268/* ------------------- */
0d969553
Y
8269/* AAUX(NORDRE+NDIM,NORDRE) : Auxiliary matrix. */
8270/* XMAT(NORMAX,NDIM) : Matrix of solutions. */
8271/* IERCOD=0 shows that solutions in XMAT are valid. */
8272/* IERCOD=1 shows that matrix AMAT is of lower rank than NORDRE. */
7fd59977 8273
0d969553 8274/* COMMONS USED : */
7fd59977 8275/* ---------------- */
8276
8277/* .Neant. */
8278
0d969553 8279/* REFERENCES CALLED : */
7fd59977 8280/* ---------------------- */
8281/* Type Name */
8282/* MAERMSG MGENMSG MGSOMSG */
8283/* MMRSLW I*4 MNFNDEB */
8284
0d969553 8285/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 8286/* ----------------------------------- */
0d969553
Y
8287/* ATTENTION : lines and columns are located in usual order : */
8288/* 1st index = index line */
8289/* 2nd index = index column */
8290/* Example, the system : */
7fd59977 8291/* a1*x + b1*y = c1 */
8292/* a2*x + b2*y = c2 */
0d969553 8293/* is represented by matrix AMAT : */
7fd59977 8294
8295/* AMAT(1,1) = a1 AMAT(2,1) = a2 */
8296/* AMAT(1,2) = b1 AMAT(2,2) = b2 */
8297
0d969553
Y
8298/* The first index is the index of line, the second index */
8299/* is the index of columns (Compare with MMRSLWI which is faster). */
7fd59977 8300
7fd59977 8301/* > */
8302/* **********************************************************************
8303*/
8304
0d969553 8305/* Name of the routine */
7fd59977 8306
8307 /* Parameter adjustments */
8308 amat_dim1 = *normax;
8309 amat_offset = amat_dim1 + 1;
8310 amat -= amat_offset;
8311 xmat_dim1 = *normax;
8312 xmat_offset = xmat_dim1 + 1;
8313 xmat -= xmat_offset;
8314 aaux_dim1 = *nordre + *ndim;
8315 aaux_offset = aaux_dim1 + 1;
8316 aaux -= aaux_offset;
8317 bmat_dim1 = *normax;
8318 bmat_offset = bmat_dim1 + 1;
8319 bmat -= bmat_offset;
8320
8321 /* Function Body */
8322 ibb = AdvApp2Var_SysBase::mnfndeb_();
8323 if (ibb >= 3) {
8324 AdvApp2Var_SysBase::mgenmsg_("MMMRSLW", 7L);
8325 }
8326
0d969553 8327/* Initialization of the auxiliary matrix. */
7fd59977 8328
8329 i__1 = *nordre;
8330 for (i__ = 1; i__ <= i__1; ++i__) {
8331 i__2 = *nordre;
8332 for (j = 1; j <= i__2; ++j) {
8333 aaux[j + i__ * aaux_dim1] = amat[i__ + j * amat_dim1];
8334/* L200: */
8335 }
8336/* L100: */
8337 }
8338
0d969553 8339/* Second member. */
7fd59977 8340
8341 i__1 = *nordre;
8342 for (i__ = 1; i__ <= i__1; ++i__) {
8343 i__2 = *ndim;
8344 for (j = 1; j <= i__2; ++j) {
8345 aaux[j + *nordre + i__ * aaux_dim1] = bmat[i__ + j * bmat_dim1];
8346/* L400: */
8347 }
8348/* L300: */
8349 }
8350
0d969553 8351/* Solution of the system of equations. */
7fd59977 8352
8353 mmrslw_(normax, nordre, ndim, epspiv, &aaux[aaux_offset], &xmat[
8354 xmat_offset], iercod);
8355
8356
8357 if (*iercod != 0) {
8358 AdvApp2Var_SysBase::maermsg_("MMMRSLW", iercod, 7L);
8359 }
8360 if (ibb >= 3) {
8361 AdvApp2Var_SysBase::mgsomsg_("MMMRSLW", 7L);
8362 }
8363 return 0 ;
8364} /* mmmrslwd_ */
8365
8366//=======================================================================
8367//function : AdvApp2Var_MathBase::mmrtptt_
8368//purpose :
8369//=======================================================================
8370 int AdvApp2Var_MathBase::mmrtptt_(integer *ndglgd,
8371 doublereal *rtlegd)
8372
8373{
1ef32e96 8374 integer ideb, nmod2, nsur2, ilong, ibb;
7fd59977 8375
8376
8377/* **********************************************************************
8378*/
8379
0d969553 8380/* FUNCTION : */
7fd59977 8381/* ---------- */
0d969553
Y
8382/* Extracts from Common LDGRTL the STRICTLY positive roots of the */
8383/* Legendre polynom of degree NDGLGD, for 2 <= NDGLGD <= 61. */
7fd59977 8384
0d969553 8385/* KEYWORDS : */
7fd59977 8386/* ----------- */
8387/* TOUS, AB_SPECIFI::COMMON&, EXTRACTION, &RACINE, &LEGENDRE. */
8388
0d969553 8389/* INPUT ARGUMENTS : */
7fd59977 8390/* ------------------ */
0d969553
Y
8391/* NDGLGD : Mathematic degree of Legendre polynom. */
8392/* This degree should be above or equal to 2 and */
8393/* below or equal to 61. */
7fd59977 8394
0d969553 8395/* OUTPUT ARGUMENTS : */
7fd59977 8396/* ------------------- */
0d969553
Y
8397/* RTLEGD : The table of strictly positive roots of */
8398/* Legendre polynom of degree NDGLGD. */
7fd59977 8399
0d969553 8400/* COMMONS USED : */
7fd59977 8401/* ---------------- */
8402
0d969553 8403/* REFERENCES CALLED : */
7fd59977 8404/* ----------------------- */
8405
0d969553 8406/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 8407/* ----------------------------------- */
0d969553
Y
8408/* ATTENTION: the condition on NDEGRE ( 2 <= NDEGRE <= 61) is not */
8409/* tested. The caller should make the test. */
8410
7fd59977 8411/* > */
8412/* **********************************************************************
8413*/
0d969553 8414/* Nome of the routine */
7fd59977 8415
8416
0d969553
Y
8417/* Common MLGDRTL: */
8418/* This common includes POSITIVE roots of Legendre polynoms */
8419/* AND the weight of Gauss quadrature formulas on all */
8420/* POSITIVE roots of Legendre polynoms. */
7fd59977 8421
8422
8423/* ***********************************************************************
8424 */
8425
0d969553 8426/* FUNCTION : */
7fd59977 8427/* ---------- */
0d969553 8428/* The common of Legendre roots. */
7fd59977 8429
0d969553 8430/* KEYWORDS : */
7fd59977 8431/* ----------- */
8432/* BASE LEGENDRE */
8433
0d969553 8434/* DEMSCRIPTION/NOTES/LIMITATIONS : */
7fd59977 8435/* ----------------------------------- */
8436
7fd59977 8437/* > */
8438/* ***********************************************************************
8439 */
8440
8441
8442
8443
0d969553
Y
8444/* ROOTAB : Table of all rotts of Legendre polynoms */
8445/* between [0,1]. They are ranked for degrees increasing from 2 to 61. */
8446/* HILTAB : Table of Legendre interpolators concerning ROOTAB. */
8447/* The address is the same. */
8448/* HI0TAB : Table of Legendre interpolators for root x=0 */
8449/* the polynoms of UNEVEN degree. */
8450/* RTLTB0 : Table of Li(uk) where uk are roots of a */
8451/* Legendre polynom of EVEN degree. */
8452/* RTLTB1 : Table of Li(uk) where uk are roots of a */
8453/* Legendre polynom of UNEVEN degree. */
7fd59977 8454
8455
8456/************************************************************************
8457*****/
8458 /* Parameter adjustments */
8459 --rtlegd;
8460
8461 /* Function Body */
8462 ibb = AdvApp2Var_SysBase::mnfndeb_();
8463 if (ibb >= 3) {
8464 AdvApp2Var_SysBase::mgenmsg_("MMRTPTT", 7L);
8465 }
8466 if (*ndglgd < 2) {
8467 goto L9999;
8468 }
8469
8470 nsur2 = *ndglgd / 2;
8471 nmod2 = *ndglgd % 2;
8472
8473 ilong = nsur2 << 3;
8474 ideb = nsur2 * (nsur2 - 1) / 2 + 1;
fadcea2c
RL
8475 AdvApp2Var_SysBase::mcrfill_(&ilong,
8476 &mlgdrtl_.rootab[ideb + nmod2 * 465 - 1],
8477 &rtlegd[1]);
7fd59977 8478
8479/* ----------------------------- The end --------------------------------
8480*/
8481
8482L9999:
8483 if (ibb >= 3) {
8484 AdvApp2Var_SysBase::mgsomsg_("MMRTPTT", 7L);
8485 }
8486 return 0;
8487} /* mmrtptt_ */
8488
8489//=======================================================================
8490//function : AdvApp2Var_MathBase::mmsrre2_
8491//purpose :
8492//=======================================================================
8493 int AdvApp2Var_MathBase::mmsrre2_(doublereal *tparam,
8494 integer *nbrval,
8495 doublereal *tablev,
8496 doublereal *epsil,
8497 integer *numint,
8498 integer *itypen,
8499 integer *iercod)
8500{
8501 /* System generated locals */
8502 doublereal d__1;
8503
8504 /* Local variables */
1ef32e96 8505 integer ideb, ifin, imil, ibb;
7fd59977 8506
8507/* ***********************************************************************
8508 */
8509
0d969553 8510/* FUNCTION : */
7fd59977 8511/* -------- */
8512
0d969553
Y
8513/* Find the interval corresponding to a valueb given in */
8514/* increasing order of real numbers with double precision. */
7fd59977 8515
0d969553 8516/* KEYWORDS : */
7fd59977 8517/* --------- */
8518/* TOUS,MATH_ACCES::TABLEAU&,POINT&,CORRESPONDANCE,&RANG */
8519
0d969553 8520/* INPUT ARGUMENTS : */
7fd59977 8521/* ------------------ */
8522
0d969553
Y
8523/* TPARAM : Value to be tested. */
8524/* NBRVAL : Size of TABLEV */
8525/* TABLEV : Table of reals. */
8526/* EPSIL : Epsilon of precision */
7fd59977 8527
0d969553 8528/* OUTPUT ARGUMENTS : */
7fd59977 8529/* ------------------- */
8530
0d969553
Y
8531/* NUMINT : Number of the interval (between 1 and NBRVAL-1). */
8532/* ITYPEN : = 0 TPARAM is inside the interval NUMINT */
8533/* = 1 : TPARAM corresponds to the lower limit of */
8534/* the provided interval. */
8535/* = 2 : TPARAM corresponds to the upper limit of */
8536/* the provided interval. */
7fd59977 8537
0d969553 8538/* IERCOD : Error code. */
7fd59977 8539/* = 0 : OK */
0d969553
Y
8540/* = 1 : TABLEV does not contain enough elements. */
8541/* = 2 : TPARAM out of limits of TABLEV. */
7fd59977 8542
0d969553 8543/* COMMONS USED : */
7fd59977 8544/* ---------------- */
8545
0d969553 8546/* REFERENCES CALLED : */
7fd59977 8547/* ------------------- */
8548
0d969553 8549/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 8550/* --------------------------------- */
0d969553
Y
8551/* There are NBRVAL values in TABLEV which stands for NBRVAL-1 intervals. */
8552/* One searches the interval containing TPARAM by */
8553/* dichotomy. Complexity of the algorithm : Log(n)/Log(2).(RBD). */
7fd59977 8554/* > */
8555/* ***********************************************************************
8556 */
8557
8558
8559/* Initialisations */
8560
8561 /* Parameter adjustments */
8562 --tablev;
8563
8564 /* Function Body */
8565 ibb = AdvApp2Var_SysBase::mnfndeb_();
8566 if (ibb >= 6) {
8567 AdvApp2Var_SysBase::mgenmsg_("MMSRRE2", 7L);
8568 }
8569
8570 *iercod = 0;
8571 *numint = 0;
8572 *itypen = 0;
8573 ideb = 1;
8574 ifin = *nbrval;
8575
0d969553 8576/* TABLEV should contain at least two values */
7fd59977 8577
8578 if (*nbrval < 2) {
8579 *iercod = 1;
8580 goto L9999;
8581 }
8582
0d969553 8583/* TPARAM should be between extreme limits of TABLEV. */
7fd59977 8584
8585 if (*tparam < tablev[1] || *tparam > tablev[*nbrval]) {
8586 *iercod = 2;
8587 goto L9999;
8588 }
8589
0d969553 8590/* ----------------------- SEARCH OF THE INTERVAL --------------------
7fd59977 8591*/
8592
8593L1000:
8594
0d969553 8595/* Test end of loop (found). */
7fd59977 8596
8597 if (ideb + 1 == ifin) {
8598 *numint = ideb;
8599 goto L2000;
8600 }
8601
0d969553 8602/* Find by dichotomy on increasing values of TABLEV. */
7fd59977 8603
8604 imil = (ideb + ifin) / 2;
8605 if (*tparam >= tablev[ideb] && *tparam <= tablev[imil]) {
8606 ifin = imil;
8607 } else {
8608 ideb = imil;
8609 }
8610
8611 goto L1000;
8612
258ff83b 8613/* -------------- TEST IF TPARAM IS NOT A VALUE --------- */
0d969553 8614/* ------------------------OF TABLEV UP TO EPSIL ----------------------
7fd59977 8615*/
8616
8617L2000:
41194117 8618 if ((d__1 = *tparam - tablev[ideb], advapp_abs(d__1)) < *epsil) {
7fd59977 8619 *itypen = 1;
8620 goto L9999;
8621 }
41194117 8622 if ((d__1 = *tparam - tablev[ifin], advapp_abs(d__1)) < *epsil) {
7fd59977 8623 *itypen = 2;
8624 goto L9999;
8625 }
8626
8627/* --------------------------- THE END ----------------------------------
8628*/
8629
8630L9999:
8631 if (*iercod > 0) {
8632 AdvApp2Var_SysBase::maermsg_("MMSRRE2", iercod, 7L);
8633 }
8634 if (ibb >= 6) {
8635 AdvApp2Var_SysBase::mgsomsg_("MMSRRE2", 7L);
8636 }
8637 return 0 ;
8638} /* mmsrre2_ */
8639
8640//=======================================================================
8641//function : mmtmave_
8642//purpose :
8643//=======================================================================
8644int mmtmave_(integer *nligne,
8645 integer *ncolon,
8646 integer *gposit,
8647 integer *,//gnstoc,
8648 doublereal *gmatri,
8649 doublereal *vecin,
8650 doublereal *vecout,
8651 integer *iercod)
8652
8653{
8654 /* System generated locals */
8655 integer i__1, i__2;
8656
8657 /* Local variables */
1ef32e96
RL
8658 logical ldbg;
8659 integer imin, imax, i__, j, k;
8660 doublereal somme;
8661 integer aux;
7fd59977 8662
8663
8664/* ***********************************************************************
8665 */
8666
0d969553 8667/* FUNCTION : */
7fd59977 8668/* ---------- */
8669/* t */
0d969553
Y
8670/* CREATES PRODUCT G V */
8671/* WHERE THE MATRIX IS IN FORM OF PROFILE */
7fd59977 8672
0d969553 8673/* KEYWORDS : */
7fd59977 8674/* ----------- */
0d969553 8675/* RESERVE, PRODUCT, MATRIX, PROFILE, VECTOR */
7fd59977 8676
0d969553 8677/* INPUT ARGUMENTS : */
7fd59977 8678/* -------------------- */
0d969553
Y
8679/* NLIGNE : NUMBER OF LINE OF THE MATRIX */
8680/* NCOLON : NOMBER OF COLUMN OF THE MATRIX */
8681/* GPOSIT: TABLE OF POSITIONING OF TERMS OF STORAGE */
258ff83b 8682/* GPOSIT(1,I) CONTAINS THE NUMBER of TERMS-1 ON LINE */
8683/* I IN THE PROFILE OF THE MATRIX */
8684/* GPOSIT(2,I) CONTAINS THE INDEX OF STORAGE OF THE DIAGONAL TERM*/
0d969553 8685/* OF LINE I */
258ff83b 8686/* GPOSIT(3,I) CONTAINS THE INDEX COLUMN OF THE FIRST TERM OF */
0d969553
Y
8687/* PROFILE OF LINE I */
8688/* GNSTOC : NOMBER OF TERM IN THE PROFILE OF GMATRI */
8689/* GMATRI : MATRIX OF CONSTRAINTS IN FORM OF PROFILE */
8690/* VECIN : INPUT VECTOR */
8691
8692/* OUTPUT ARGUMENTS : */
7fd59977 8693/* --------------------- */
0d969553
Y
8694/* VECOUT : VECTOR PRODUCT */
8695/* IERCOD : ERROR CODE */
7fd59977 8696
8697
0d969553 8698/* COMMONS USED : */
7fd59977 8699/* ------------------ */
8700
8701
0d969553 8702/* REFERENCES CALLED : */
7fd59977 8703/* --------------------- */
8704
8705
0d969553 8706/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 8707/* ----------------------------------- */
7fd59977 8708/* > */
8709/* ***********************************************************************
8710 */
8711/* DECLARATIONS */
8712/* ***********************************************************************
8713 */
8714
8715
8716
8717/* ***********************************************************************
8718 */
8719/* INITIALISATIONS */
8720/* ***********************************************************************
8721 */
8722
8723 /* Parameter adjustments */
8724 --vecin;
8725 gposit -= 4;
8726 --vecout;
8727 --gmatri;
8728
8729 /* Function Body */
8730 ldbg = AdvApp2Var_SysBase::mnfndeb_() >= 2;
8731 if (ldbg) {
8732 AdvApp2Var_SysBase::mgenmsg_("MMTMAVE", 7L);
8733 }
8734 *iercod = 0;
8735
8736/* ***********************************************************************
8737 */
0d969553 8738/* PROCESSING */
7fd59977 8739/* ***********************************************************************
8740 */
8741
8742
8743
8744 i__1 = *ncolon;
8745 for (i__ = 1; i__ <= i__1; ++i__) {
8746 somme = 0.;
8747 i__2 = *nligne;
8748 for (j = 1; j <= i__2; ++j) {
8749 imin = gposit[j * 3 + 3];
8750 imax = gposit[j * 3 + 1] + gposit[j * 3 + 3] - 1;
8751 aux = gposit[j * 3 + 2] - gposit[j * 3 + 1] - imin + 1;
8752 if (imin <= i__ && i__ <= imax) {
8753 k = i__ + aux;
8754 somme += gmatri[k] * vecin[j];
8755 }
8756 }
8757 vecout[i__] = somme;
8758 }
8759
8760
8761
8762
8763
8764 goto L9999;
8765
8766/* ***********************************************************************
8767 */
0d969553 8768/* ERROR PROCESSING */
7fd59977 8769/* ***********************************************************************
8770 */
8771
8772
8773/* ***********************************************************************
8774 */
0d969553 8775/* RETURN CALLING PROGRAM */
7fd59977 8776/* ***********************************************************************
8777 */
8778
8779L9999:
8780
8781/* ___ DESALLOCATION, ... */
8782
8783 AdvApp2Var_SysBase::maermsg_("MMTMAVE", iercod, 7L);
8784 if (ldbg) {
8785 AdvApp2Var_SysBase::mgsomsg_("MMTMAVE", 7L);
8786 }
8787 return 0 ;
8788} /* mmtmave_ */
8789
8790//=======================================================================
8791//function : mmtrpj0_
8792//purpose :
8793//=======================================================================
8794int mmtrpj0_(integer *ncofmx,
8795 integer *ndimen,
8796 integer *ncoeff,
8797 doublereal *epsi3d,
8798 doublereal *crvlgd,
8799 doublereal *ycvmax,
8800 doublereal *epstrc,
8801 integer *ncfnew)
8802
8803{
8804 /* System generated locals */
8805 integer crvlgd_dim1, crvlgd_offset, i__1, i__2;
8806 doublereal d__1;
8807
8808 /* Local variables */
1ef32e96
RL
8809 integer ncut, i__;
8810 doublereal bidon, error;
8811 integer nd;
7fd59977 8812
8813
8814/* ***********************************************************************
8815 */
8816
0d969553 8817/* FUNCTION : */
7fd59977 8818/* ---------- */
0d969553
Y
8819/* Lowers the degree of a curve defined on (-1,1) in the direction of */
8820/* Legendre with a given precision. */
7fd59977 8821
0d969553 8822/* KEYWORDS : */
7fd59977 8823/* ----------- */
0d969553 8824/* LEGENDRE, POLYGON, TRUNCATION, CURVE, SMOOTHING. */
7fd59977 8825
0d969553 8826/* INPUT ARGUMENTS : */
7fd59977 8827/* ------------------ */
0d969553
Y
8828/* NCOFMX : Max Nb of coeff. of the curve (dimensioning). */
8829/* NDIMEN : Dimension of the space. */
8830/* NCOEFF : Degree +1 of the polynom. */
8831/* EPSI3D : Precision required for the approximation. */
8832/* CRVLGD : The curve the degree which of it is required to lower. */
7fd59977 8833
0d969553 8834/* OUTPUT ARGUMENTS : */
7fd59977 8835/* ------------------- */
0d969553
Y
8836/* EPSTRC : Precision of the approximation. */
8837/* NCFNEW : Degree +1 of the resulting polynom. */
7fd59977 8838
0d969553 8839/* COMMONS USED : */
7fd59977 8840/* ---------------- */
8841
0d969553 8842/* REFERENCES CALLED : */
7fd59977 8843/* ----------------------- */
8844
0d969553 8845/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 8846/* ----------------------------------- */
7fd59977 8847/* > */
8848/* ***********************************************************************
8849 */
8850
8851
0d969553 8852/* ------- Minimum degree that can be attained : Stop at 1 (RBD) ---------
7fd59977 8853*/
8854
8855 /* Parameter adjustments */
8856 --ycvmax;
8857 crvlgd_dim1 = *ncofmx;
8858 crvlgd_offset = crvlgd_dim1 + 1;
8859 crvlgd -= crvlgd_offset;
8860
8861 /* Function Body */
8862 *ncfnew = 1;
0d969553 8863/* ------------------- Init for error calculation -----------------------
7fd59977 8864*/
8865 i__1 = *ndimen;
8866 for (i__ = 1; i__ <= i__1; ++i__) {
8867 ycvmax[i__] = 0.;
8868/* L100: */
8869 }
8870 *epstrc = 0.;
8871 error = 0.;
8872
0d969553 8873/* Cutting of coefficients. */
7fd59977 8874
8875 ncut = 2;
0d969553 8876/* ------ Loop on the series of Legendre :NCOEFF --> 2 (RBD) -----------
7fd59977 8877*/
8878 i__1 = ncut;
8879 for (i__ = *ncoeff; i__ >= i__1; --i__) {
0d969553 8880/* Factor of renormalization. */
7fd59977 8881 bidon = ((i__ - 1) * 2. + 1.) / 2.;
8882 bidon = sqrt(bidon);
8883 i__2 = *ndimen;
8884 for (nd = 1; nd <= i__2; ++nd) {
41194117 8885 ycvmax[nd] += (d__1 = crvlgd[i__ + nd * crvlgd_dim1], advapp_abs(d__1)) *
7fd59977 8886 bidon;
8887/* L310: */
8888 }
0d969553 8889/* Cutting is stopped if the norm becomes too great. */
7fd59977 8890 error = AdvApp2Var_MathBase::mzsnorm_(ndimen, &ycvmax[1]);
8891 if (error > *epsi3d) {
8892 *ncfnew = i__;
8893 goto L9999;
8894 }
8895
0d969553 8896/* --- Max error cumulee when the I-th coeff is removed. */
7fd59977 8897
8898 *epstrc = error;
8899
8900/* L300: */
8901 }
8902
0d969553 8903/* --------------------------------- End --------------------------------
7fd59977 8904*/
8905
8906L9999:
8907 return 0;
8908} /* mmtrpj0_ */
8909
8910//=======================================================================
8911//function : mmtrpj2_
8912//purpose :
8913//=======================================================================
8914int mmtrpj2_(integer *ncofmx,
8915 integer *ndimen,
8916 integer *ncoeff,
8917 doublereal *epsi3d,
8918 doublereal *crvlgd,
8919 doublereal *ycvmax,
8920 doublereal *epstrc,
8921 integer *ncfnew)
8922
8923{
8924 /* Initialized data */
8925
8926 static doublereal xmaxj[57] = { .9682458365518542212948163499456,
8927 .986013297183269340427888048593603,
8928 1.07810420343739860362585159028115,
8929 1.17325804490920057010925920756025,
8930 1.26476561266905634732910520370741,
8931 1.35169950227289626684434056681946,
8932 1.43424378958284137759129885012494,
8933 1.51281316274895465689402798226634,
8934 1.5878364329591908800533936587012,
8935 1.65970112228228167018443636171226,
8936 1.72874345388622461848433443013543,
8937 1.7952515611463877544077632304216,
8938 1.85947199025328260370244491818047,
8939 1.92161634324190018916351663207101,
8940 1.98186713586472025397859895825157,
8941 2.04038269834980146276967984252188,
8942 2.09730119173852573441223706382076,
8943 2.15274387655763462685970799663412,
8944 2.20681777186342079455059961912859,
8945 2.25961782459354604684402726624239,
8946 2.31122868752403808176824020121524,
8947 2.36172618435386566570998793688131,
8948 2.41117852396114589446497298177554,
8949 2.45964731268663657873849811095449,
8950 2.50718840313973523778244737914028,
8951 2.55385260994795361951813645784034,
8952 2.59968631659221867834697883938297,
8953 2.64473199258285846332860663371298,
8954 2.68902863641518586789566216064557,
8955 2.73261215675199397407027673053895,
8956 2.77551570192374483822124304745691,
8957 2.8177699459714315371037628127545,
8958 2.85940333797200948896046563785957,
8959 2.90044232019793636101516293333324,
8960 2.94091151970640874812265419871976,
8961 2.98083391718088702956696303389061,
8962 3.02023099621926980436221568258656,
8963 3.05912287574998661724731962377847,
8964 3.09752842783622025614245706196447,
8965 3.13546538278134559341444834866301,
8966 3.17295042316122606504398054547289,
8967 3.2099992681699613513775259670214,
8968 3.24662674946606137764916854570219,
8969 3.28284687953866689817670991319787,
8970 3.31867291347259485044591136879087,
8971 3.35411740487202127264475726990106,
8972 3.38919225660177218727305224515862,
8973 3.42390876691942143189170489271753,
8974 3.45827767149820230182596660024454,
8975 3.49230918177808483937957161007792,
8976 3.5260130200285724149540352829756,
8977 3.55939845146044235497103883695448,
8978 3.59247431368364585025958062194665,
8979 3.62524904377393592090180712976368,
8980 3.65773070318071087226169680450936,
8981 3.68992700068237648299565823810245,
8982 3.72184531357268220291630708234186 };
8983
8984 /* System generated locals */
8985 integer crvlgd_dim1, crvlgd_offset, i__1, i__2;
8986 doublereal d__1;
8987
8988 /* Local variables */
1ef32e96
RL
8989 integer ncut, i__;
8990 doublereal bidon, error;
8991 integer ia, nd;
8992 doublereal bid, eps1;
7fd59977 8993
8994
8995/* ***********************************************************************
8996 */
8997
0d969553 8998/* FUNCTION : */
7fd59977 8999/* ---------- */
0d969553
Y
9000/* Lower the degree of a curve defined on (-1,1) in the direction of */
9001/* Legendre with a given precision. */
7fd59977 9002
0d969553 9003/* KEYWORDS : */
7fd59977 9004/* ----------- */
0d969553 9005/* LEGENDRE, POLYGON, TRUNCATION, CURVE, SMOOTHING. */
7fd59977 9006
0d969553 9007/* INPUT ARGUMENTS : */
7fd59977 9008/* ------------------ */
0d969553
Y
9009/* NCOFMX : Max nb of coeff. of the curve (dimensioning). */
9010/* NDIMEN : Dimension of the space. */
9011/* NCOEFF : Degree +1 of the polynom. */
9012/* EPSI3D : Precision required for the approximation. */
9013/* CRVLGD : The curve the degree which of will be lowered. */
7fd59977 9014
0d969553 9015/* OUTPUT ARGUMENTS : */
7fd59977 9016/* ------------------- */
0d969553 9017/* YCVMAX : Auxiliary table (error max on each dimension).
7fd59977 9018*/
0d969553
Y
9019/* EPSTRC : Precision of the approximation. */
9020/* NCFNEW : Degree +1 of the resulting polynom. */
7fd59977 9021
0d969553 9022/* COMMONS USED : */
7fd59977 9023/* ---------------- */
9024
0d969553 9025/* REFERENCES CALLED : */
7fd59977 9026/* ----------------------- */
9027
0d969553 9028/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 9029/* ----------------------------------- */
7fd59977 9030/* > */
9031/* ***********************************************************************
9032 */
9033
9034
9035 /* Parameter adjustments */
9036 --ycvmax;
9037 crvlgd_dim1 = *ncofmx;
9038 crvlgd_offset = crvlgd_dim1 + 1;
9039 crvlgd -= crvlgd_offset;
9040
9041 /* Function Body */
9042
9043
9044
0d969553 9045/* Minimum degree that can be reached : Stop at IA (RBD). -------------
7fd59977 9046*/
9047 ia = 2;
9048 *ncfnew = ia;
0d969553 9049/* Init for calculation of error. */
7fd59977 9050 i__1 = *ndimen;
9051 for (i__ = 1; i__ <= i__1; ++i__) {
9052 ycvmax[i__] = 0.;
9053/* L100: */
9054 }
9055 *epstrc = 0.;
9056 error = 0.;
9057
0d969553 9058/* Cutting of coefficients. */
7fd59977 9059
9060 ncut = ia + 1;
0d969553 9061/* ------ Loop on the series of Jacobi :NCOEFF --> IA+1 (RBD) ----------
7fd59977 9062*/
9063 i__1 = ncut;
9064 for (i__ = *ncoeff; i__ >= i__1; --i__) {
0d969553 9065/* Factor of renormalization. */
7fd59977 9066 bidon = xmaxj[i__ - ncut];
9067 i__2 = *ndimen;
9068 for (nd = 1; nd <= i__2; ++nd) {
41194117 9069 ycvmax[nd] += (d__1 = crvlgd[i__ + nd * crvlgd_dim1], advapp_abs(d__1)) *
7fd59977 9070 bidon;
9071/* L310: */
9072 }
0d969553 9073/* One stops to cut if the norm becomes too great. */
7fd59977 9074 error = AdvApp2Var_MathBase::mzsnorm_(ndimen, &ycvmax[1]);
9075 if (error > *epsi3d) {
9076 *ncfnew = i__;
9077 goto L400;
9078 }
9079
0d969553 9080/* --- Max error cumulated when the I-th coeff is removed. */
7fd59977 9081
9082 *epstrc = error;
9083
9084/* L300: */
9085 }
9086
0d969553 9087/* ------- Cutting of zero coeffs of interpolation (RBD) -------
7fd59977 9088*/
9089
9090L400:
9091 if (*ncfnew == ia) {
9092 AdvApp2Var_MathBase::mmeps1_(&eps1);
9093 for (i__ = ia; i__ >= 2; --i__) {
9094 bid = 0.;
9095 i__1 = *ndimen;
9096 for (nd = 1; nd <= i__1; ++nd) {
41194117 9097 bid += (d__1 = crvlgd[i__ + nd * crvlgd_dim1], advapp_abs(d__1));
7fd59977 9098/* L600: */
9099 }
9100 if (bid > eps1) {
9101 *ncfnew = i__;
9102 goto L9999;
9103 }
9104/* L500: */
9105 }
0d969553 9106/* --- If all coeffs can be removed, this is a point. */
7fd59977 9107 *ncfnew = 1;
9108 }
9109
0d969553 9110/* --------------------------------- End --------------------------------
7fd59977 9111*/
9112
9113L9999:
9114 return 0;
9115} /* mmtrpj2_ */
9116
9117//=======================================================================
9118//function : mmtrpj4_
9119//purpose :
9120//=======================================================================
9121int mmtrpj4_(integer *ncofmx,
9122 integer *ndimen,
9123 integer *ncoeff,
9124 doublereal *epsi3d,
9125 doublereal *crvlgd,
9126 doublereal *ycvmax,
9127 doublereal *epstrc,
9128 integer *ncfnew)
9129{
9130 /* Initialized data */
9131
9132 static doublereal xmaxj[55] = { 1.1092649593311780079813740546678,
9133 1.05299572648705464724876659688996,
9134 1.0949715351434178709281698645813,
9135 1.15078388379719068145021100764647,
9136 1.2094863084718701596278219811869,
9137 1.26806623151369531323304177532868,
9138 1.32549784426476978866302826176202,
9139 1.38142537365039019558329304432581,
9140 1.43575531950773585146867625840552,
9141 1.48850442653629641402403231015299,
9142 1.53973611681876234549146350844736,
9143 1.58953193485272191557448229046492,
9144 1.63797820416306624705258190017418,
9145 1.68515974143594899185621942934906,
9146 1.73115699602477936547107755854868,
9147 1.77604489805513552087086912113251,
9148 1.81989256661534438347398400420601,
9149 1.86276344480103110090865609776681,
9150 1.90471563564740808542244678597105,
9151 1.94580231994751044968731427898046,
9152 1.98607219357764450634552790950067,
9153 2.02556989246317857340333585562678,
9154 2.06433638992049685189059517340452,
9155 2.10240936014742726236706004607473,
9156 2.13982350649113222745523925190532,
9157 2.17661085564771614285379929798896,
9158 2.21280102016879766322589373557048,
9159 2.2484214321456956597803794333791,
9160 2.28349755104077956674135810027654,
9161 2.31805304852593774867640120860446,
9162 2.35210997297725685169643559615022,
9163 2.38568889602346315560143377261814,
9164 2.41880904328694215730192284109322,
9165 2.45148841120796359750021227795539,
9166 2.48374387161372199992570528025315,
9167 2.5155912654873773953959098501893,
9168 2.54704548720896557684101746505398,
9169 2.57812056037881628390134077704127,
9170 2.60882970619319538196517982945269,
9171 2.63918540521920497868347679257107,
9172 2.66919945330942891495458446613851,
9173 2.69888301230439621709803756505788,
9174 2.72824665609081486737132853370048,
9175 2.75730041251405791603760003778285,
9176 2.78605380158311346185098508516203,
9177 2.81451587035387403267676338931454,
9178 2.84269522483114290814009184272637,
9179 2.87060005919012917988363332454033,
9180 2.89823818258367657739520912946934,
9181 2.92561704377132528239806135133273,
9182 2.95274375377994262301217318010209,
9183 2.97962510678256471794289060402033,
9184 3.00626759936182712291041810228171,
9185 3.03267744830655121818899164295959,
9186 3.05886060707437081434964933864149 };
9187
9188 /* System generated locals */
9189 integer crvlgd_dim1, crvlgd_offset, i__1, i__2;
9190 doublereal d__1;
9191
9192 /* Local variables */
1ef32e96
RL
9193 integer ncut, i__;
9194 doublereal bidon, error;
9195 integer ia, nd;
9196 doublereal bid, eps1;
7fd59977 9197
9198
9199
9200/* ***********************************************************************
9201 */
9202
0d969553 9203/* FUNCTION : */
7fd59977 9204/* ---------- */
0d969553
Y
9205/* Lowers the degree of a curve defined on (-1,1) in the direction of */
9206/* Legendre with a given precision. */
7fd59977 9207
0d969553 9208/* KEYWORDS : */
7fd59977 9209/* ----------- */
0d969553 9210/* LEGENDRE, POLYGON, TRONCATION, CURVE, SMOOTHING. */
7fd59977 9211
0d969553 9212/* INPUT ARGUMENTS : */
7fd59977 9213/* ------------------ */
0d969553
Y
9214/* NCOFMX : Max nb of coeff. of the curve (dimensioning). */
9215/* NDIMEN : Dimension of the space. */
9216/* NCOEFF : Degree +1 of the polynom. */
9217/* EPSI3D : Precision required for the approximation. */
9218/* CRVLGD : The curve which wishes to lower the degree. */
7fd59977 9219
0d969553 9220/* OUTPUT ARGUMENTS : */
7fd59977 9221/* ------------------- */
0d969553 9222/* YCVMAX : Auxiliary table (max error on each dimension).
7fd59977 9223*/
0d969553
Y
9224/* EPSTRC : Precision of the approximation. */
9225/* NCFNEW : Degree +1 of the resulting polynom. */
7fd59977 9226
0d969553 9227/* COMMONS USED : */
7fd59977 9228/* ---------------- */
9229
0d969553 9230/* REFERENCES CALLED : */
7fd59977 9231/* ----------------------- */
9232
0d969553 9233/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 9234/* ----------------------------------- */
7fd59977 9235/* > */
9236/* ***********************************************************************
9237 */
9238
9239
9240 /* Parameter adjustments */
9241 --ycvmax;
9242 crvlgd_dim1 = *ncofmx;
9243 crvlgd_offset = crvlgd_dim1 + 1;
9244 crvlgd -= crvlgd_offset;
9245
9246 /* Function Body */
9247
9248
9249
0d969553 9250/* Minimum degree that can be reached : Stop at IA (RBD). -------------
7fd59977 9251*/
9252 ia = 4;
9253 *ncfnew = ia;
0d969553 9254/* Init for error calculation. */
7fd59977 9255 i__1 = *ndimen;
9256 for (i__ = 1; i__ <= i__1; ++i__) {
9257 ycvmax[i__] = 0.;
9258/* L100: */
9259 }
9260 *epstrc = 0.;
9261 error = 0.;
9262
0d969553 9263/* Cutting of coefficients. */
7fd59977 9264
9265 ncut = ia + 1;
0d969553 9266/* ------ Loop on the series of Jacobi :NCOEFF --> IA+1 (RBD) ----------
7fd59977 9267*/
9268 i__1 = ncut;
9269 for (i__ = *ncoeff; i__ >= i__1; --i__) {
0d969553 9270/* Factor of renormalization. */
7fd59977 9271 bidon = xmaxj[i__ - ncut];
9272 i__2 = *ndimen;
9273 for (nd = 1; nd <= i__2; ++nd) {
41194117 9274 ycvmax[nd] += (d__1 = crvlgd[i__ + nd * crvlgd_dim1], advapp_abs(d__1)) *
7fd59977 9275 bidon;
9276/* L310: */
9277 }
0d969553 9278/* Stop cutting if the norm becomes too great. */
7fd59977 9279 error = AdvApp2Var_MathBase::mzsnorm_(ndimen, &ycvmax[1]);
9280 if (error > *epsi3d) {
9281 *ncfnew = i__;
9282 goto L400;
9283 }
9284
0d969553 9285/* -- Error max cumulated when the I-eme coeff is removed. */
7fd59977 9286
9287 *epstrc = error;
9288
9289/* L300: */
9290 }
9291
0d969553 9292/* ------- Cutting of zero coeffs of the pole of interpolation (RBD) -------
7fd59977 9293*/
9294
9295L400:
9296 if (*ncfnew == ia) {
9297 AdvApp2Var_MathBase::mmeps1_(&eps1);
9298 for (i__ = ia; i__ >= 2; --i__) {
9299 bid = 0.;
9300 i__1 = *ndimen;
9301 for (nd = 1; nd <= i__1; ++nd) {
41194117 9302 bid += (d__1 = crvlgd[i__ + nd * crvlgd_dim1], advapp_abs(d__1));
7fd59977 9303/* L600: */
9304 }
9305 if (bid > eps1) {
9306 *ncfnew = i__;
9307 goto L9999;
9308 }
9309/* L500: */
9310 }
0d969553 9311/* --- If all coeffs can be removed, this is a point. */
7fd59977 9312 *ncfnew = 1;
9313 }
9314
0d969553 9315/* --------------------------------- End --------------------------------
7fd59977 9316*/
9317
9318L9999:
9319 return 0;
9320} /* mmtrpj4_ */
9321
9322//=======================================================================
9323//function : mmtrpj6_
9324//purpose :
9325//=======================================================================
9326int mmtrpj6_(integer *ncofmx,
9327 integer *ndimen,
9328 integer *ncoeff,
9329 doublereal *epsi3d,
9330 doublereal *crvlgd,
9331 doublereal *ycvmax,
9332 doublereal *epstrc,
9333 integer *ncfnew)
9334
9335{
9336 /* Initialized data */
9337
9338 static doublereal xmaxj[53] = { 1.21091229812484768570102219548814,
9339 1.11626917091567929907256116528817,
9340 1.1327140810290884106278510474203,
9341 1.1679452722668028753522098022171,
9342 1.20910611986279066645602153641334,
9343 1.25228283758701572089625983127043,
9344 1.29591971597287895911380446311508,
9345 1.3393138157481884258308028584917,
9346 1.3821288728999671920677617491385,
9347 1.42420414683357356104823573391816,
9348 1.46546895108549501306970087318319,
9349 1.50590085198398789708599726315869,
9350 1.54550385142820987194251585145013,
9351 1.58429644271680300005206185490937,
9352 1.62230484071440103826322971668038,
9353 1.65955905239130512405565733793667,
9354 1.69609056468292429853775667485212,
9355 1.73193098017228915881592458573809,
9356 1.7671112206990325429863426635397,
9357 1.80166107681586964987277458875667,
9358 1.83560897003644959204940535551721,
9359 1.86898184653271388435058371983316,
9360 1.90180515174518670797686768515502,
9361 1.93410285411785808749237200054739,
9362 1.96589749778987993293150856865539,
9363 1.99721027139062501070081653790635,
9364 2.02806108474738744005306947877164,
9365 2.05846864831762572089033752595401,
9366 2.08845055210580131460156962214748,
9367 2.11802334209486194329576724042253,
9368 2.14720259305166593214642386780469,
9369 2.17600297710595096918495785742803,
9370 2.20443832785205516555772788192013,
9371 2.2325216999457379530416998244706,
9372 2.2602654243075083168599953074345,
9373 2.28768115912702794202525264301585,
9374 2.3147799369092684021274946755348,
9375 2.34157220782483457076721300512406,
9376 2.36806787963276257263034969490066,
9377 2.39427635443992520016789041085844,
9378 2.42020656255081863955040620243062,
9379 2.44586699364757383088888037359254,
9380 2.47126572552427660024678584642791,
9381 2.49641045058324178349347438430311,
9382 2.52130850028451113942299097584818,
9383 2.54596686772399937214920135190177,
9384 2.5703922285006754089328998222275,
9385 2.59459096001908861492582631591134,
9386 2.61856915936049852435394597597773,
9387 2.64233265984385295286445444361827,
9388 2.66588704638685848486056711408168,
9389 2.68923766976735295746679957665724,
9390 2.71238965987606292679677228666411 };
9391
9392 /* System generated locals */
9393 integer crvlgd_dim1, crvlgd_offset, i__1, i__2;
9394 doublereal d__1;
9395
9396 /* Local variables */
1ef32e96
RL
9397 integer ncut, i__;
9398 doublereal bidon, error;
9399 integer ia, nd;
9400 doublereal bid, eps1;
7fd59977 9401
9402
9403
9404/* ***********************************************************************
9405 */
9406
0d969553 9407/* FUNCTION : */
7fd59977 9408/* ---------- */
0d969553
Y
9409/* Lowers the degree of a curve defined on (-1,1) in the direction of */
9410/* Legendre to a given precision. */
7fd59977 9411
0d969553 9412/* KEYWORDS : */
7fd59977 9413/* ----------- */
0d969553 9414/* LEGENDRE,POLYGON,TRUNCATION,CURVE,SMOOTHING. */
7fd59977 9415
0d969553 9416/* INPUT ARGUMENTS : */
7fd59977 9417/* ------------------ */
0d969553
Y
9418/* NCOFMX : Max nb of coeff. of the curve (dimensioning). */
9419/* NDIMEN : Dimension of the space. */
9420/* NCOEFF : Degree +1 of the polynom. */
9421/* EPSI3D : Precision required for the approximation. */
9422/* CRVLGD : The curve the degree which of will be lowered. */
7fd59977 9423
0d969553 9424/* OUTPUT ARGUMENTS : */
7fd59977 9425/* ------------------- */
258ff83b 9426/* YCVMAX : Auxiliary table (max error on each dimension). */
0d969553
Y
9427/* EPSTRC : Precision of the approximation. */
9428/* NCFNEW : Degree +1 of the resulting polynom. */
7fd59977 9429
0d969553 9430/* COMMONS USED : */
7fd59977 9431/* ---------------- */
9432
0d969553 9433/* REFERENCES CALLED : */
7fd59977 9434/* ----------------------- */
9435
0d969553 9436/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 9437/* ----------------------------------- */
7fd59977 9438/* > */
9439/* ***********************************************************************
9440 */
9441
9442
9443 /* Parameter adjustments */
9444 --ycvmax;
9445 crvlgd_dim1 = *ncofmx;
9446 crvlgd_offset = crvlgd_dim1 + 1;
9447 crvlgd -= crvlgd_offset;
9448
9449 /* Function Body */
9450
9451
9452
0d969553 9453/* Minimum degree that can be reached : Stop at IA (RBD). -------------
7fd59977 9454*/
9455 ia = 6;
9456 *ncfnew = ia;
0d969553 9457/* Init for error calculation. */
7fd59977 9458 i__1 = *ndimen;
9459 for (i__ = 1; i__ <= i__1; ++i__) {
9460 ycvmax[i__] = 0.;
9461/* L100: */
9462 }
9463 *epstrc = 0.;
9464 error = 0.;
9465
0d969553 9466/* Cutting of coefficients. */
7fd59977 9467
9468 ncut = ia + 1;
0d969553 9469/* ------ Loop on the series of Jacobi :NCOEFF --> IA+1 (RBD) ----------
7fd59977 9470*/
9471 i__1 = ncut;
9472 for (i__ = *ncoeff; i__ >= i__1; --i__) {
0d969553 9473/* Factor of renormalization. */
7fd59977 9474 bidon = xmaxj[i__ - ncut];
9475 i__2 = *ndimen;
9476 for (nd = 1; nd <= i__2; ++nd) {
41194117 9477 ycvmax[nd] += (d__1 = crvlgd[i__ + nd * crvlgd_dim1], advapp_abs(d__1)) *
7fd59977 9478 bidon;
9479/* L310: */
9480 }
0d969553 9481/* Stop cutting if the norm becomes too great. */
7fd59977 9482 error = AdvApp2Var_MathBase::mzsnorm_(ndimen, &ycvmax[1]);
9483 if (error > *epsi3d) {
9484 *ncfnew = i__;
9485 goto L400;
9486 }
9487
0d969553 9488/* --- Max error cumulated when the I-th coeff is removed. */
7fd59977 9489
9490 *epstrc = error;
9491
9492/* L300: */
9493 }
9494
0d969553 9495/* ------- Cutting of zero coeff. of the pole of interpolation (RBD) -------
7fd59977 9496*/
9497
9498L400:
9499 if (*ncfnew == ia) {
9500 AdvApp2Var_MathBase::mmeps1_(&eps1);
9501 for (i__ = ia; i__ >= 2; --i__) {
9502 bid = 0.;
9503 i__1 = *ndimen;
9504 for (nd = 1; nd <= i__1; ++nd) {
41194117 9505 bid += (d__1 = crvlgd[i__ + nd * crvlgd_dim1], advapp_abs(d__1));
7fd59977 9506/* L600: */
9507 }
9508 if (bid > eps1) {
9509 *ncfnew = i__;
9510 goto L9999;
9511 }
9512/* L500: */
9513 }
0d969553 9514/* --- If all coeffs can be removed, this is a point. */
7fd59977 9515 *ncfnew = 1;
9516 }
9517
0d969553 9518/* --------------------------------- End --------------------------------
7fd59977 9519*/
9520
9521L9999:
9522 return 0;
9523} /* mmtrpj6_ */
9524
9525//=======================================================================
9526//function : AdvApp2Var_MathBase::mmtrpjj_
9527//purpose :
9528//=======================================================================
9529 int AdvApp2Var_MathBase::mmtrpjj_(integer *ncofmx,
9530 integer *ndimen,
9531 integer *ncoeff,
9532 doublereal *epsi3d,
9533 integer *iordre,
9534 doublereal *crvlgd,
9535 doublereal *ycvmax,
9536 doublereal *errmax,
9537 integer *ncfnew)
9538{
9539 /* System generated locals */
9540 integer crvlgd_dim1, crvlgd_offset;
9541
9542 /* Local variables */
1ef32e96 9543 integer ia;
7fd59977 9544
9545
9546/* ***********************************************************************
9547 */
9548
0d969553 9549/* FUNCTION : */
7fd59977 9550/* ---------- */
0d969553
Y
9551/* Lower the degree of a curve defined on (-1,1) in the direction of */
9552/* Legendre with a given precision. */
7fd59977 9553
0d969553 9554/* KEYWORDS : */
7fd59977 9555/* ----------- */
0d969553 9556/* LEGENDRE, POLYGON, TRUNCATION, CURVE, SMOOTHING. */
7fd59977 9557
0d969553 9558/* INPUT ARGUMENTS : */
7fd59977 9559/* ------------------ */
0d969553
Y
9560/* NCOFMX : Max Nb coeff. of the curve (dimensioning). */
9561/* NDIMEN : Dimension of the space. */
9562/* NCOEFF : Degree +1 of the polynom. */
9563/* EPSI3D : Precision required for the approximation. */
9564/* IORDRE : Order of continuity at the extremities. */
9565/* CRVLGD : The curve the degree which of should be lowered. */
9566
9567/* OUTPUT ARGUMENTS : */
7fd59977 9568/* ------------------- */
0d969553
Y
9569/* ERRMAX : Precision of the approximation. */
9570/* NCFNEW : Degree +1 of the resulting polynom. */
7fd59977 9571
0d969553 9572/* COMMONS USED : */
7fd59977 9573/* ---------------- */
9574
0d969553 9575/* REFERENCES CALLED : */
7fd59977 9576/* ----------------------- */
9577
0d969553 9578/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 9579/* ----------------------------------- */
7fd59977 9580/* > */
9581/* ***********************************************************************
9582 */
9583
9584
9585 /* Parameter adjustments */
9586 --ycvmax;
9587 crvlgd_dim1 = *ncofmx;
9588 crvlgd_offset = crvlgd_dim1 + 1;
9589 crvlgd -= crvlgd_offset;
9590
9591 /* Function Body */
9592 ia = (*iordre + 1) << 1;
9593
9594 if (ia == 0) {
9595 mmtrpj0_(ncofmx, ndimen, ncoeff, epsi3d, &crvlgd[crvlgd_offset], &
9596 ycvmax[1], errmax, ncfnew);
9597 } else if (ia == 2) {
9598 mmtrpj2_(ncofmx, ndimen, ncoeff, epsi3d, &crvlgd[crvlgd_offset], &
9599 ycvmax[1], errmax, ncfnew);
9600 } else if (ia == 4) {
9601 mmtrpj4_(ncofmx, ndimen, ncoeff, epsi3d, &crvlgd[crvlgd_offset], &
9602 ycvmax[1], errmax, ncfnew);
9603 } else {
9604 mmtrpj6_(ncofmx, ndimen, ncoeff, epsi3d, &crvlgd[crvlgd_offset], &
9605 ycvmax[1], errmax, ncfnew);
9606 }
9607
0d969553 9608/* ------------------------ End -----------------------------------------
7fd59977 9609*/
9610
9611 return 0;
9612} /* mmtrpjj_ */
9613
9614//=======================================================================
9615//function : AdvApp2Var_MathBase::mmunivt_
9616//purpose :
9617//=======================================================================
9618 int AdvApp2Var_MathBase::mmunivt_(integer *ndimen,
9619 doublereal *vector,
9620 doublereal *vecnrm,
9621 doublereal *epsiln,
9622 integer *iercod)
9623{
9624
1ef32e96 9625 doublereal c_b2 = 10.;
7fd59977 9626
9627 /* System generated locals */
9628 integer i__1;
9629 doublereal d__1;
9630
9631 /* Local variables */
1d47d8d0 9632 integer nchif, iunit = 1, izero;
1ef32e96
RL
9633 doublereal vnorm;
9634 integer ii;
9635 doublereal bid;
9636 doublereal eps0;
7fd59977 9637
9638
9639
9640
9641/* ***********************************************************************
9642 */
9643
0d969553 9644/* FUNCTION : */
7fd59977 9645/* ---------- */
0d969553
Y
9646/* CALCULATE THE NORMAL VECTOR BASING ON ANY VECTOR */
9647/* WITH PRECISION GIVEN BY THE USER. */
7fd59977 9648
0d969553 9649/* KEYWORDS : */
7fd59977 9650/* ----------- */
0d969553 9651/* ALL, MATH_ACCES :: */
7fd59977 9652/* VECTEUR&, NORMALISATION, &VECTEUR */
9653
0d969553 9654/* INPUT ARGUMENTS : */
7fd59977 9655/* ------------------ */
0d969553
Y
9656/* NDIMEN : DIMENSION OF THE SPACE */
9657/* VECTOR : VECTOR TO BE NORMED */
9658/* EPSILN : EPSILON BELOW WHICH IT IS CONSIDERED THAT THE */
9659/* NORM OF THE VECTOR IS NULL. IF EPSILN<=0, A DEFAULT VALUE */
9660/* IS IMPOSED (10.D-17 ON VAX). */
7fd59977 9661
0d969553 9662/* OUTPUT ARGUMENTS : */
7fd59977 9663/* ------------------- */
0d969553
Y
9664/* VECNRM : NORMED VECTOR */
9665/* IERCOD 101 : THE VECTOR IS NULL UP TO EPSILN. */
7fd59977 9666/* 0 : OK. */
9667
0d969553 9668/* COMMONS USED : */
7fd59977 9669/* ---------------- */
9670
0d969553 9671/* REFERENCES CALLED : */
7fd59977 9672/* ----------------------- */
9673
0d969553 9674/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 9675/* ----------------------------------- */
0d969553
Y
9676/* VECTOR and VECNRM can be identic. */
9677
258ff83b 9678/* The norm of vector is calculated and each component is divided by */
0d969553
Y
9679/* this norm. After this it is checked if all componentes of the */
9680/* vector except for one cost 0 with machine precision. In */
9681/* this case the quasi-null components are set to 0.D0. */
7fd59977 9682/* > */
9683/* ***********************************************************************
9684 */
9685
9686
9687 /* Parameter adjustments */
9688 --vecnrm;
9689 --vector;
9690
9691 /* Function Body */
9692 *iercod = 0;
9693
0d969553 9694/* -------- Precision by default : zero machine 10.D-17 on Vax ------
7fd59977 9695*/
9696
9697 AdvApp2Var_SysBase::maovsr8_(&nchif);
9698 if (*epsiln <= 0.) {
9699 i__1 = -nchif;
9700 eps0 = AdvApp2Var_MathBase::pow__di(&c_b2, &i__1);
9701 } else {
9702 eps0 = *epsiln;
9703 }
9704
0d969553 9705/* ------------------------- Calculation of the norm --------------------
7fd59977 9706*/
9707
9708 vnorm = AdvApp2Var_MathBase::mzsnorm_(ndimen, &vector[1]);
9709 if (vnorm <= eps0) {
fadcea2c 9710 AdvApp2Var_SysBase::mvriraz_(ndimen, &vecnrm[1]);
7fd59977 9711 *iercod = 101;
9712 goto L9999;
9713 }
9714
0d969553 9715/* ---------------------- Calculation of the vector norm ---------------
7fd59977 9716*/
9717
9718 izero = 0;
9719 i__1 = (-nchif - 1) / 2;
9720 eps0 = AdvApp2Var_MathBase::pow__di(&c_b2, &i__1);
9721 i__1 = *ndimen;
9722 for (ii = 1; ii <= i__1; ++ii) {
9723 vecnrm[ii] = vector[ii] / vnorm;
41194117 9724 if ((d__1 = vecnrm[ii], advapp_abs(d__1)) <= eps0) {
7fd59977 9725 ++izero;
9726 } else {
9727 iunit = ii;
9728 }
9729/* L20: */
9730 }
9731
0d969553 9732/* ------ Case when all coordinates except for one are almost null ----
7fd59977 9733*/
0d969553 9734/* ------------- then one of coordinates costs 1.D0 or -1.D0 --------
7fd59977 9735*/
9736
9737 if (izero == *ndimen - 1) {
9738 bid = vecnrm[iunit];
9739 i__1 = *ndimen;
9740 for (ii = 1; ii <= i__1; ++ii) {
9741 vecnrm[ii] = 0.;
9742/* L30: */
9743 }
9744 if (bid > 0.) {
9745 vecnrm[iunit] = 1.;
9746 } else {
9747 vecnrm[iunit] = -1.;
9748 }
9749 }
9750
9751/* -------------------------------- The end -----------------------------
9752*/
9753
9754L9999:
9755 return 0;
9756} /* mmunivt_ */
9757
9758//=======================================================================
9759//function : AdvApp2Var_MathBase::mmveps3_
9760//purpose :
9761//=======================================================================
9762 int AdvApp2Var_MathBase::mmveps3_(doublereal *eps03)
9763{
9764 /* Initialized data */
9765
9766 static char nomprg[8+1] = "MMEPS1 ";
9767
1ef32e96 9768 integer ibb;
7fd59977 9769
9770
9771
9772/************************************************************************
9773*******/
9774
0d969553 9775/* FUNCTION : */
7fd59977 9776/* ---------- */
0d969553 9777/* Extraction of EPS1 from COMMON MPRCSN. */
7fd59977 9778
0d969553 9779/* KEYWORDS : */
7fd59977 9780/* ----------- */
9781/* MPRCSN,PRECISON,EPS3. */
9782
0d969553 9783/* INPUT ARGUMENTS : */
7fd59977 9784/* ------------------ */
9785/* Humm. */
9786
0d969553 9787/* OUTPUT ARGUMENTS : */
7fd59977 9788/* ------------------- */
0d969553
Y
9789/* EPS3 : space zero of the denominator (10**-9) */
9790/* EPS3 should value 10**-15 */
7fd59977 9791
0d969553 9792/* COMMONS USED : */
7fd59977 9793/* ---------------- */
9794
0d969553 9795/* REFERENCES CALLED : */
7fd59977 9796/* ----------------------- */
9797
0d969553 9798/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 9799/* ----------------------------------- */
9800
7fd59977 9801/* > */
9802/* ***********************************************************************
9803 */
9804
9805
9806
9807/* ***********************************************************************
9808 */
9809
0d969553 9810/* FUNCTION : */
7fd59977 9811/* ---------- */
0d969553
Y
9812/* GIVES TOLERANCES OF NULLITY IN STRIM */
9813/* AND LIMITS OF ITERATIVE PROCESSES */
7fd59977 9814
0d969553 9815/* GENERAL CONTEXT, MODIFIABLE BY THE UTILISER */
7fd59977 9816
0d969553 9817/* KEYWORDS : */
7fd59977 9818/* ----------- */
0d969553 9819/* PARAMETER , TOLERANCE */
7fd59977 9820
0d969553 9821/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 9822/* ----------------------------------- */
0d969553
Y
9823/* INITIALISATION : PROFILE , **VIA MPRFTX** AT INPUT IN STRIM*/
9824/* LOADING OF DEFAULT VALUES OF THE PROFILE IN MPRFTX AT INPUT*/
9825/* IN STRIM. THEY ARE PRESERVED IN THE LOCAL VARIABLES OF MPRFTX */
7fd59977 9826
0d969553
Y
9827/* RESET DEFAULT VALUES : MDFINT */
9828/* MODIFICATION INTERACTIVE BY THE USER : MDBINT */
7fd59977 9829
0d969553 9830/* ACCESS FUNCTION : MMEPS1 ... EPS1 */
7fd59977 9831/* MEPSPB ... EPS3,EPS4 */
9832/* MEPSLN ... EPS2, NITERM , NITERR */
9833/* MEPSNR ... EPS2 , NITERM */
9834/* MITERR ... NITERR */
9835
7fd59977 9836/* > */
9837/* ***********************************************************************
9838 */
9839
0d969553
Y
9840/* NITERM : MAX NB OF ITERATIONS */
9841/* NITERR : NB OF RAPID ITERATIONS */
9842/* EPS1 : TOLERANCE OF 3D NULL DISTANCE */
9843/* EPS2 : TOLERANCE OF ZERO PARAMETRIC DISTANCE */
9844/* EPS3 : TOLERANCE TO AVOID DIVISION BY 0.. */
9845/* EPS4 : TOLERANCE ANGULAR */
7fd59977 9846
9847
9848
9849/* ***********************************************************************
9850 */
9851
9852 ibb = AdvApp2Var_SysBase::mnfndeb_();
9853 if (ibb >= 5) {
9854 AdvApp2Var_SysBase::mgenmsg_(nomprg, 6L);
9855 }
9856
9857 *eps03 = mmprcsn_.eps3;
9858
9859 return 0;
9860} /* mmveps3_ */
9861
9862//=======================================================================
9863//function : AdvApp2Var_MathBase::mmvncol_
9864//purpose :
9865//=======================================================================
9866 int AdvApp2Var_MathBase::mmvncol_(integer *ndimen,
9867 doublereal *vecin,
9868 doublereal *vecout,
9869 integer *iercod)
9870
9871{
9872 /* System generated locals */
9873 integer i__1;
9874
9875 /* Local variables */
1ef32e96
RL
9876 logical ldbg;
9877 integer d__;
9878 doublereal vaux1[3], vaux2[3];
9879 logical colin;
9880 doublereal valaux;
9881 integer aux;
7fd59977 9882
9883/* ***********************************************************************
9884 */
9885
0d969553 9886/* FUNCTION : */
7fd59977 9887/* ---------- */
0d969553 9888/* CALCULATE A VECTOR NON-COLINEAR TO A GIVEN NON-NULL VECTOR */
7fd59977 9889
0d969553 9890/* KEYWORDS : */
7fd59977 9891/* ----------- */
0d969553 9892/* PUBLIC, VECTOR, FREE */
7fd59977 9893
0d969553 9894/* INPUT ARGUMENTS : */
7fd59977 9895/* -------------------- */
0d969553
Y
9896/* ndimen : dimension of the space */
9897/* vecin : input vector */
7fd59977 9898
0d969553 9899/* OUTPUT ARGUMENTS : */
7fd59977 9900/* --------------------- */
9901
0d969553
Y
9902/* vecout : vector non colinear to vecin */
9903
9904/* COMMONS USED : */
7fd59977 9905/* ------------------ */
9906
9907
0d969553 9908/* REFERENCES CALLED : */
7fd59977 9909/* --------------------- */
9910
9911
0d969553 9912/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 9913/* ----------------------------------- */
7fd59977 9914/* > */
9915/* ***********************************************************************
9916 */
9917/* DECLARATIONS */
9918/* ***********************************************************************
9919 */
9920
9921
9922
9923/* ***********************************************************************
9924 */
9925/* INITIALISATIONS */
9926/* ***********************************************************************
9927 */
9928
9929 /* Parameter adjustments */
9930 --vecout;
9931 --vecin;
9932
9933 /* Function Body */
9934 ldbg = AdvApp2Var_SysBase::mnfndeb_() >= 2;
9935 if (ldbg) {
9936 AdvApp2Var_SysBase::mgenmsg_("MMVNCOL", 7L);
9937 }
9938 *iercod = 0;
9939
9940/* ***********************************************************************
9941 */
0d969553 9942/* PROCESSING */
7fd59977 9943/* ***********************************************************************
9944 */
9945
9946 if (*ndimen <= 1 || *ndimen > 3) {
9947 goto L9101;
9948 }
7fd59977 9949 d__ = 1;
9950 aux = 0;
9951 while(d__ <= *ndimen) {
9952 if (vecin[d__] == 0.) {
9953 ++aux;
9954 }
9955 ++d__;
9956 }
9957 if (aux == *ndimen) {
9958 goto L9101;
9959 }
9960
9961
9962 for (d__ = 1; d__ <= 3; ++d__) {
9963 vaux1[d__ - 1] = 0.;
9964 }
9965 i__1 = *ndimen;
9966 for (d__ = 1; d__ <= i__1; ++d__) {
9967 vaux1[d__ - 1] = vecin[d__];
9968 vaux2[d__ - 1] = vecin[d__];
9969 }
9970 colin = TRUE_;
9971 d__ = 0;
9972 while(colin) {
9973 ++d__;
9974 if (d__ > 3) {
9975 goto L9101;
9976 }
9977 vaux2[d__ - 1] += 1;
9978 valaux = vaux1[1] * vaux2[2] - vaux1[2] * vaux2[1];
9979 if (valaux == 0.) {
9980 valaux = vaux1[2] * vaux2[0] - vaux1[0] * vaux2[2];
9981 if (valaux == 0.) {
9982 valaux = vaux1[0] * vaux2[1] - vaux1[1] * vaux2[0];
9983 if (valaux != 0.) {
9984 colin = FALSE_;
9985 }
9986 } else {
9987 colin = FALSE_;
9988 }
9989 } else {
9990 colin = FALSE_;
9991 }
9992 }
9993 if (colin) {
9994 goto L9101;
9995 }
9996 i__1 = *ndimen;
9997 for (d__ = 1; d__ <= i__1; ++d__) {
9998 vecout[d__] = vaux2[d__ - 1];
9999 }
10000
10001 goto L9999;
10002
10003/* ***********************************************************************
10004 */
0d969553 10005/* ERROR PROCESSING */
7fd59977 10006/* ***********************************************************************
10007 */
10008
10009
10010L9101:
10011 *iercod = 1;
10012 goto L9999;
10013
10014
10015/* ***********************************************************************
10016 */
0d969553 10017/* RETURN CALLING PROGRAM */
7fd59977 10018/* ***********************************************************************
10019 */
10020
10021L9999:
10022
10023
10024 AdvApp2Var_SysBase::maermsg_("MMVNCOL", iercod, 7L);
10025 if (ldbg) {
10026 AdvApp2Var_SysBase::mgsomsg_("MMVNCOL", 7L);
10027 }
10028 return 0 ;
10029} /* mmvncol_ */
10030
10031//=======================================================================
10032//function : AdvApp2Var_MathBase::mmwprcs_
10033//purpose :
10034//=======================================================================
10035void AdvApp2Var_MathBase::mmwprcs_(doublereal *epsil1,
10036 doublereal *epsil2,
10037 doublereal *epsil3,
10038 doublereal *epsil4,
10039 integer *niter1,
10040 integer *niter2)
10041
10042{
10043
10044
10045/* ***********************************************************************
10046 */
10047
0d969553 10048/* FUNCTION : */
7fd59977 10049/* ---------- */
0d969553 10050/* ACCESS IN WRITING FOR COMMON MPRCSN */
7fd59977 10051
0d969553 10052/* KEYWORDS : */
7fd59977 10053/* ----------- */
0d969553 10054/* WRITING */
7fd59977 10055
0d969553 10056/* INPUT ARGUMENTS : */
7fd59977 10057/* -------------------- */
0d969553
Y
10058/* EPSIL1 : TOLERANCE OF 3D NULL DISTANCE */
10059/* EPSIL2 : TOLERANCE OF PARAMETRIC NULL DISTANCE */
10060/* EPSIL3 : TOLERANCE TO AVOID DIVISION BY 0.. */
10061/* EPSIL4 : ANGULAR TOLERANCE */
10062/* NITER1 : MAX NB OF ITERATIONS */
10063/* NITER2 : NB OF RAPID ITERATIONS */
10064
10065/* OUTPUT ARGUMENTS : */
7fd59977 10066/* --------------------- */
0d969553 10067/* NONE */
7fd59977 10068
0d969553 10069/* COMMONS USED : */
7fd59977 10070/* ------------------ */
10071
10072
0d969553 10073/* REFERENCES CALLED : */
7fd59977 10074/* --------------------- */
10075
10076
0d969553 10077/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 10078/* ----------------------------------- */
10079
7fd59977 10080/* > */
10081/* ***********************************************************************
10082 */
10083/* DECLARATIONS */
10084/* ***********************************************************************
10085 */
10086
10087
10088/* ***********************************************************************
10089 */
0d969553 10090/* INITIALIZATIONS */
7fd59977 10091/* ***********************************************************************
10092 */
10093
10094/* ***********************************************************************
10095 */
0d969553 10096/* PROCESSING */
7fd59977 10097/* ***********************************************************************
10098 */
10099
10100/* ***********************************************************************
10101 */
10102
0d969553 10103/* FUNCTION : */
7fd59977 10104/* ---------- */
0d969553
Y
10105/* GIVES TOLERANCES OF NULLITY IN STRIM */
10106/* AND LIMITS OF ITERATIVE PROCESSES */
7fd59977 10107
0d969553 10108/* GENERAL CONTEXT, MODIFIABLE BY THE UTILISER */
7fd59977 10109
0d969553 10110/* KEYWORDS : */
7fd59977 10111/* ----------- */
0d969553 10112/* PARAMETER , TOLERANCE */
7fd59977 10113
0d969553 10114/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 10115/* ----------------------------------- */
0d969553
Y
10116/* INITIALISATION : PROFILE , **VIA MPRFTX** AT INPUT IN STRIM*/
10117/* LOADING OF DEFAULT VALUES OF THE PROFILE IN MPRFTX AT INPUT*/
10118/* IN STRIM. THEY ARE PRESERVED IN THE LOCAL VARIABLES OF MPRFTX */
7fd59977 10119
0d969553
Y
10120/* RESET DEFAULT VALUES : MDFINT */
10121/* MODIFICATION INTERACTIVE BY THE USER : MDBINT */
7fd59977 10122
0d969553 10123/* ACCESS FUNCTION : MMEPS1 ... EPS1 */
7fd59977 10124/* MEPSPB ... EPS3,EPS4 */
10125/* MEPSLN ... EPS2, NITERM , NITERR */
10126/* MEPSNR ... EPS2 , NITERM */
10127/* MITERR ... NITERR */
10128
7fd59977 10129/* > */
10130/* ***********************************************************************
10131 */
10132
0d969553
Y
10133/* NITERM : MAX NB OF ITERATIONS */
10134/* NITERR : NB OF RAPID ITERATIONS */
10135/* EPS1 : TOLERANCE OF 3D NULL DISTANCE */
10136/* EPS2 : TOLERANCE OF ZERO PARAMETRIC DISTANCE */
10137/* EPS3 : TOLERANCE TO AVOID DIVISION BY 0.. */
10138/* EPS4 : TOLERANCE ANGULAR */
7fd59977 10139
10140
10141/* ***********************************************************************
10142 */
10143 mmprcsn_.eps1 = *epsil1;
10144 mmprcsn_.eps2 = *epsil2;
10145 mmprcsn_.eps3 = *epsil3;
10146 mmprcsn_.eps4 = *epsil4;
10147 mmprcsn_.niterm = *niter1;
10148 mmprcsn_.niterr = *niter2;
10149 return ;
10150} /* mmwprcs_ */
10151
10152
10153//=======================================================================
10154//function : AdvApp2Var_MathBase::pow__di
10155//purpose :
10156//=======================================================================
10157 doublereal AdvApp2Var_MathBase::pow__di (doublereal *x,
10158 integer *n)
10159{
7fd59977 10160 doublereal result ;
10161 integer absolute ;
10162 result = 1.0e0 ;
10163 if ( *n > 0 ) {absolute = *n;}
10164 else {absolute = -*n;}
10165 /* System generated locals */
a7f510bf 10166 for(integer ii = 0 ; ii < absolute ; ii++) {
7fd59977 10167 result *= *x ;
10168 }
10169 if (*n < 0) {
10170 result = 1.0e0 / result ;
10171 }
10172 return result ;
10173}
10174
10175
10176/* **********************************************************************
10177*/
10178
0d969553 10179/* FUNCTION : */
7fd59977 10180/* ---------- */
0d969553 10181/* Calculate integer function power not obligatory in the most efficient way ;
7fd59977 10182*/
10183
0d969553 10184/* KEYWORDS : */
7fd59977 10185/* ----------- */
0d969553 10186/* POWER */
7fd59977 10187
0d969553 10188/* INPUT ARGUMENTS : */
7fd59977 10189/* ------------------ */
0d969553
Y
10190/* X : argument of X**N */
10191/* N : power */
7fd59977 10192
0d969553 10193/* OUTPUT ARGUMENTS : */
7fd59977 10194/* ------------------- */
0d969553 10195/* return X**N */
7fd59977 10196
0d969553 10197/* COMMONS USED : */
7fd59977 10198/* ---------------- */
10199
0d969553 10200/* REFERENCES CALLED : */
7fd59977 10201/* ----------------------- */
10202
0d969553 10203/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 10204/* ----------------------------------- */
10205
7fd59977 10206/* > */
10207/* ***********************************************************************/
10208
10209//=======================================================================
10210//function : pow__ii
10211//purpose :
10212//=======================================================================
10213integer pow__ii(integer *x,
10214 integer *n)
10215
10216{
7fd59977 10217 integer result ;
10218 integer absolute ;
10219 result = 1 ;
10220 if ( *n > 0 ) {absolute = *n;}
10221 else {absolute = -*n;}
10222 /* System generated locals */
a7f510bf 10223 for(integer ii = 0 ; ii < absolute ; ii++) {
7fd59977 10224 result *= *x ;
10225 }
10226 if (*n < 0) {
10227 result = 1 / result ;
10228 }
10229 return result ;
10230}
10231
10232
0d969553
Y
10233/* **********************************************************************
10234*/
7fd59977 10235/* **********************************************************************
10236*/
10237
0d969553 10238/* FUNCTION : */
7fd59977 10239/* ---------- */
0d969553 10240/* Calculate integer function power not obligatory in the most efficient way ;
7fd59977 10241*/
10242
0d969553 10243/* KEYWORDS : */
7fd59977 10244/* ----------- */
0d969553 10245/* POWER */
7fd59977 10246
0d969553 10247/* INPUT ARGUMENTS : */
7fd59977 10248/* ------------------ */
0d969553
Y
10249/* X : argument of X**N */
10250/* N : power */
7fd59977 10251
0d969553 10252/* OUTPUT ARGUMENTS : */
7fd59977 10253/* ------------------- */
0d969553 10254/* return X**N */
7fd59977 10255
0d969553 10256/* COMMONS USED : */
7fd59977 10257/* ---------------- */
10258
0d969553 10259/* REFERENCES CALLED : */
7fd59977 10260/* ----------------------- */
10261
0d969553 10262/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 10263/* ----------------------------------- */
10264
7fd59977 10265/* > */
10266/* ***********************************************************************/
10267
10268//=======================================================================
10269//function : AdvApp2Var_MathBase::msc_
10270//purpose :
10271//=======================================================================
10272 doublereal AdvApp2Var_MathBase::msc_(integer *ndimen,
10273 doublereal *vecte1,
10274 doublereal *vecte2)
10275
10276{
10277 /* System generated locals */
10278 integer i__1;
10279 doublereal ret_val;
10280
10281 /* Local variables */
1ef32e96
RL
10282 integer i__;
10283 doublereal x;
7fd59977 10284
10285
10286
10287/************************************************************************
10288*******/
10289
0d969553 10290/* FUNCTION : */
7fd59977 10291/* ---------- */
0d969553
Y
10292/* Calculate the scalar product of 2 vectors in the space */
10293/* of dimension NDIMEN. */
7fd59977 10294
0d969553 10295/* KEYWORDS : */
7fd59977 10296/* ----------- */
0d969553 10297/* PRODUCT MSCALAIRE. */
7fd59977 10298
0d969553 10299/* INPUT ARGUMENTS : */
7fd59977 10300/* ------------------ */
0d969553
Y
10301/* NDIMEN : Dimension of the space. */
10302/* VECTE1,VECTE2: Vectors. */
7fd59977 10303
0d969553 10304/* OUTPUT ARGUMENTS : */
7fd59977 10305/* ------------------- */
10306
0d969553 10307/* COMMONS USED : */
7fd59977 10308/* ---------------- */
10309
0d969553 10310/* REFERENCES CALLED : */
7fd59977 10311/* ----------------------- */
10312
0d969553 10313/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 10314/* ----------------------------------- */
10315
7fd59977 10316/* > */
10317/* ***********************************************************************
10318 */
10319
10320
10321/* PRODUIT MSCALAIRE */
10322 /* Parameter adjustments */
10323 --vecte2;
10324 --vecte1;
10325
10326 /* Function Body */
10327 x = 0.;
10328
10329 i__1 = *ndimen;
10330 for (i__ = 1; i__ <= i__1; ++i__) {
10331 x += vecte1[i__] * vecte2[i__];
10332/* L100: */
10333 }
10334 ret_val = x;
10335
10336/* ----------------------------------- THE END --------------------------
10337*/
10338
10339 return ret_val;
10340} /* msc_ */
10341
10342//=======================================================================
10343//function : mvcvin2_
10344//purpose :
10345//=======================================================================
10346int mvcvin2_(integer *ncoeff,
10347 doublereal *crvold,
10348 doublereal *crvnew,
10349 integer *iercod)
10350
10351{
10352 /* System generated locals */
10353 integer i__1, i__2;
10354
10355 /* Local variables */
1ef32e96
RL
10356 integer m1jm1, ncfm1, j, k;
10357 doublereal bid;
10358 doublereal cij1, cij2;
7fd59977 10359
10360
10361
10362/************************************************************************
10363*******/
10364
10365/* FONCTION : */
10366/* ---------- */
0d969553 10367/* INVERSION OF THE PARAMETERS ON CURVE 2D. */
7fd59977 10368
0d969553 10369/* KEYWORDS : */
7fd59977 10370/* ----------- */
0d969553 10371/* CURVE,2D,INVERSION,PARAMETER. */
7fd59977 10372
0d969553 10373/* INPUT ARGUMENTS : */
7fd59977 10374/* ------------------ */
0d969553
Y
10375/* NCOEFF : NB OF COEFF OF THE CURVE. */
10376/* CRVOLD : CURVE OF ORIGIN */
7fd59977 10377
0d969553 10378/* OUTPUT ARGUMENTS : */
7fd59977 10379/* ------------------- */
0d969553 10380/* CRVNEW : THE RESULTING CURVE AFTER CHANGE OF T BY 1-T */
7fd59977 10381/* IERCOD : 0 OK, */
0d969553 10382/* 10 NB OF COEFF NULL OR TOO GREAT. */
7fd59977 10383
0d969553 10384/* COMMONS USED : */
7fd59977 10385/* ---------------- */
10386/* MCCNP */
10387
0d969553 10388/* REFERENCES CALLED : */
7fd59977 10389/* ---------------------- */
10390/* Neant */
0d969553 10391/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 10392/* ----------------------------------- */
0d969553
Y
10393/* THE FOLLOWING CALL IS ABSOLUTELY LEGAL : */
10394/* CALL MVCVIN2(NCOEFF,CURVE,CURVE,IERCOD), THE TABLE CURVE */
10395/* BECOMES INPUT AND OUTPUT ARGUMENT (RBD). */
10396/* BECAUSE OF MCCNP, THE NB OF COEFF OF THE CURVE IS LIMITED TO */
7fd59977 10397/* NDGCNP+1 = 61. */
10398
7fd59977 10399/* > */
10400/* ***********************************************************************
10401 */
10402
10403
10404/* **********************************************************************
10405*/
10406
0d969553 10407/* FUNCTION : */
7fd59977 10408/* ---------- */
0d969553 10409/* Serves to provide coefficients of the binome (triangle of Pascal). */
7fd59977 10410
0d969553 10411/* KEYWORDS : */
7fd59977 10412/* ----------- */
0d969553 10413/* Coeff of binome from 0 to 60. read only . init par block data */
7fd59977 10414
0d969553 10415/* DEMSCRIPTION/NOTES/LIMITATIONS : */
7fd59977 10416/* ----------------------------------- */
0d969553
Y
10417/* The coefficients of the binome form a triangular matrix. */
10418/* This matrix is completed in table CNP by transposition. */
10419/* So: CNP(I,J) = CNP(J,I) for I and J = 0, ..., 60. */
10420
10421/* Initialization is done by block-data MMLLL09.RES, */
10422/* created by program MQINICNP.FOR (see the team (AC) ). */
7fd59977 10423
7fd59977 10424
7fd59977 10425/* > */
10426/* **********************************************************************
10427*/
10428
10429
10430
10431/* ***********************************************************************
10432 */
10433
10434 /* Parameter adjustments */
10435 crvnew -= 3;
10436 crvold -= 3;
10437
10438 /* Function Body */
10439 if (*ncoeff < 1 || *ncoeff - 1 > 60) {
10440 *iercod = 10;
10441 goto L9999;
10442 }
10443 *iercod = 0;
10444
10445
0d969553 10446/* CONSTANT TERM OF THE NEW CURVE */
7fd59977 10447
10448 cij1 = crvold[3];
10449 cij2 = crvold[4];
10450 i__1 = *ncoeff;
10451 for (k = 2; k <= i__1; ++k) {
10452 cij1 += crvold[(k << 1) + 1];
10453 cij2 += crvold[(k << 1) + 2];
10454 }
10455 crvnew[3] = cij1;
10456 crvnew[4] = cij2;
10457 if (*ncoeff == 1) {
10458 goto L9999;
10459 }
10460
0d969553 10461/* INTERMEDIARY POWERS OF THE PARAMETER */
7fd59977 10462
10463 ncfm1 = *ncoeff - 1;
10464 m1jm1 = 1;
10465 i__1 = ncfm1;
10466 for (j = 2; j <= i__1; ++j) {
10467 m1jm1 = -m1jm1;
10468 cij1 = crvold[(j << 1) + 1];
10469 cij2 = crvold[(j << 1) + 2];
10470 i__2 = *ncoeff;
10471 for (k = j + 1; k <= i__2; ++k) {
10472 bid = mmcmcnp_.cnp[k - 1 + (j - 1) * 61];
10473 cij1 += crvold[(k << 1) + 1] * bid;
10474 cij2 += crvold[(k << 1) + 2] * bid;
10475 }
10476 crvnew[(j << 1) + 1] = cij1 * m1jm1;
10477 crvnew[(j << 1) + 2] = cij2 * m1jm1;
10478 }
10479
0d969553 10480/* TERM OF THE HIGHEST DEGREE */
7fd59977 10481
10482 crvnew[(*ncoeff << 1) + 1] = -crvold[(*ncoeff << 1) + 1] * m1jm1;
10483 crvnew[(*ncoeff << 1) + 2] = -crvold[(*ncoeff << 1) + 2] * m1jm1;
10484
10485L9999:
10486 if (*iercod > 0) {
10487 AdvApp2Var_SysBase::maermsg_("MVCVIN2", iercod, 7L);
10488 }
10489 return 0 ;
10490} /* mvcvin2_ */
10491
10492//=======================================================================
10493//function : mvcvinv_
10494//purpose :
10495//=======================================================================
10496int mvcvinv_(integer *ncoeff,
10497 doublereal *crvold,
10498 doublereal *crvnew,
10499 integer *iercod)
10500
10501{
10502 /* System generated locals */
10503 integer i__1, i__2;
10504
10505 /* Local variables */
1ef32e96
RL
10506 integer m1jm1, ncfm1, j, k;
10507 doublereal bid;
7fd59977 10508 //extern /* Subroutine */ int maermsg_();
1ef32e96 10509 doublereal cij1, cij2, cij3;
7fd59977 10510
10511
10512/* **********************************************************************
10513*/
10514
0d969553 10515/* FUNCTION : */
7fd59977 10516/* ---------- */
0d969553
Y
10517/* INVERSION OF THE PARAMETER ON A CURBE 3D (I.E. INVERSION */
10518/* OF THE DIRECTION OF PARSING). */
7fd59977 10519
0d969553 10520/* KEYWORDS : */
7fd59977 10521/* ----------- */
0d969553 10522/* CURVE,INVERSION,PARAMETER. */
7fd59977 10523
0d969553 10524/* INPUT ARGUMENTS : */
7fd59977 10525/* ------------------ */
0d969553
Y
10526/* NCOEFF : NB OF COEFF OF THE CURVE. */
10527/* CRVOLD : CURVE OF ORIGIN */
7fd59977 10528
0d969553 10529/* OUTPUT ARGUMENTS : */
7fd59977 10530/* ------------------- */
0d969553 10531/* CRVNEW : RESULTING CURVE AFTER CHANGE OF T INTO 1-T */
7fd59977 10532/* IERCOD : 0 OK, */
0d969553 10533/* 10 NB OF COEFF NULL OR TOO GREAT. */
7fd59977 10534
0d969553 10535/* COMMONS USED : */
7fd59977 10536/* ---------------- */
10537/* MCCNP */
10538
0d969553 10539/* REFERENCES CALLED : */
7fd59977 10540/* ---------------------- */
10541/* Neant */
0d969553 10542/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 10543/* ----------------------------------- */
0d969553
Y
10544/* THE FOLLOWING CALL IS ABSOLUTELY LEGAL : */
10545/* CALL MVCVINV(NCOEFF,CURVE,CURVE,IERCOD), TABLE CURVE */
10546/* BECOMES INPUT AND OUTPUT ARGUMENT (RBD). */
10547/* THE NUMBER OF COEFF OF THE CURVE IS LIMITED TO NDGCNP+1 = 61 */
10548/* BECAUSE OF USE OF COMMON MCCNP. */
7fd59977 10549/* > */
10550/* ***********************************************************************
10551 */
10552
10553/* **********************************************************************
10554*/
10555
0d969553 10556/* FUNCTION : */
7fd59977 10557/* ---------- */
0d969553 10558/* Serves to provide the binomial coefficients (triangle of Pascal). */
7fd59977 10559
0d969553 10560/* KEYWORDS : */
7fd59977 10561/* ----------- */
0d969553 10562/* Binomial Coeff from 0 to 60. read only . init par block data */
7fd59977 10563
0d969553 10564/* DEMSCRIPTION/NOTES/LIMITATIONS : */
7fd59977 10565/* ----------------------------------- */
0d969553
Y
10566/* The binomial coefficients form a triangular matrix. */
10567/* This matrix is completed in table CNP by its transposition. */
10568/* So: CNP(I,J) = CNP(J,I) for I and J = 0, ..., 60. */
7fd59977 10569
0d969553
Y
10570/* Initialisation is done by block-data MMLLL09.RES, */
10571/* created by program MQINICNP.FOR (see the team (AC) ). */
7fd59977 10572/* > */
10573/* **********************************************************************
10574*/
10575
10576
10577
10578/* ***********************************************************************
10579 */
10580
10581 /* Parameter adjustments */
10582 crvnew -= 4;
10583 crvold -= 4;
10584
10585 /* Function Body */
10586 if (*ncoeff < 1 || *ncoeff - 1 > 60) {
10587 *iercod = 10;
10588 goto L9999;
10589 }
10590 *iercod = 0;
10591
0d969553 10592/* CONSTANT TERM OF THE NEW CURVE */
7fd59977 10593
10594 cij1 = crvold[4];
10595 cij2 = crvold[5];
10596 cij3 = crvold[6];
10597 i__1 = *ncoeff;
10598 for (k = 2; k <= i__1; ++k) {
10599 cij1 += crvold[k * 3 + 1];
10600 cij2 += crvold[k * 3 + 2];
10601 cij3 += crvold[k * 3 + 3];
10602/* L30: */
10603 }
10604 crvnew[4] = cij1;
10605 crvnew[5] = cij2;
10606 crvnew[6] = cij3;
10607 if (*ncoeff == 1) {
10608 goto L9999;
10609 }
10610
0d969553 10611/* INTERMEDIARY POWER OF THE PARAMETER */
7fd59977 10612
10613 ncfm1 = *ncoeff - 1;
10614 m1jm1 = 1;
10615 i__1 = ncfm1;
10616 for (j = 2; j <= i__1; ++j) {
10617 m1jm1 = -m1jm1;
10618 cij1 = crvold[j * 3 + 1];
10619 cij2 = crvold[j * 3 + 2];
10620 cij3 = crvold[j * 3 + 3];
10621 i__2 = *ncoeff;
10622 for (k = j + 1; k <= i__2; ++k) {
10623 bid = mmcmcnp_.cnp[k - 1 + (j - 1) * 61];
10624 cij1 += crvold[k * 3 + 1] * bid;
10625 cij2 += crvold[k * 3 + 2] * bid;
10626 cij3 += crvold[k * 3 + 3] * bid;
10627/* L40: */
10628 }
10629 crvnew[j * 3 + 1] = cij1 * m1jm1;
10630 crvnew[j * 3 + 2] = cij2 * m1jm1;
10631 crvnew[j * 3 + 3] = cij3 * m1jm1;
10632/* L50: */
10633 }
10634
0d969553 10635 /* TERM OF THE HIGHEST DEGREE */
7fd59977 10636
10637 crvnew[*ncoeff * 3 + 1] = -crvold[*ncoeff * 3 + 1] * m1jm1;
10638 crvnew[*ncoeff * 3 + 2] = -crvold[*ncoeff * 3 + 2] * m1jm1;
10639 crvnew[*ncoeff * 3 + 3] = -crvold[*ncoeff * 3 + 3] * m1jm1;
10640
10641L9999:
10642 AdvApp2Var_SysBase::maermsg_("MVCVINV", iercod, 7L);
10643 return 0;
10644} /* mvcvinv_ */
10645
10646//=======================================================================
10647//function : mvgaus0_
10648//purpose :
10649//=======================================================================
10650int mvgaus0_(integer *kindic,
10651 doublereal *urootl,
10652 doublereal *hiltab,
10653 integer *nbrval,
10654 integer *iercod)
10655
10656{
10657 /* System generated locals */
10658 integer i__1;
10659
10660 /* Local variables */
1ef32e96
RL
10661 doublereal tamp[40];
10662 integer ndegl, kg, ii;
7fd59977 10663
10664/* **********************************************************************
10665*/
10666
0d969553 10667/* FUNCTION : */
7fd59977 10668/* -------- */
0d969553
Y
10669/* Loading of a degree gives roots of LEGENDRE polynom */
10670/* DEFINED on [-1,1] and weights of Gauss quadrature formulas */
10671/* (based on corresponding LAGRANGIAN interpolators). */
10672/* The symmetry relative to 0 is used between [-1,0] and [0,1]. */
7fd59977 10673
0d969553 10674/* KEYWORDS : */
7fd59977 10675/* --------- */
0d969553 10676/* . VOLUMIC, LEGENDRE, LAGRANGE, GAUSS */
7fd59977 10677
0d969553 10678/* INPUT ARGUMENTSE : */
7fd59977 10679/* ------------------ */
10680
0d969553
Y
10681/* KINDIC : Takes values from 1 to 10 depending of the degree */
10682/* of the used polynom. */
10683/* The degree of the polynom is equal to 4 k, i.e. 4, 8, */
10684/* 12, 16, 20, 24, 28, 32, 36 and 40. */
7fd59977 10685
0d969553 10686/* OUTPUT ARGUMENTS : */
7fd59977 10687/* ------------------- */
10688
0d969553
Y
10689/* UROOTL : Roots of LEGENDRE polynom in domain [1,0] */
10690/* given in decreasing order. For domain [-1,0], it is */
10691/* necessary to take the opposite values. */
10692/* HILTAB : LAGRANGE interpolators associated to roots. For */
10693/* opposed roots, interpolatorsare equal. */
10694/* NBRVAL : Nb of coefficients. Is equal to the half of degree */
10695/* depending on the symmetry (i.e. 2*KINDIC). */
7fd59977 10696
0d969553 10697/* IERCOD : Error code: */
7fd59977 10698/* < 0 ==> Attention - Warning */
0d969553
Y
10699/* =-1 ==> Value of false KINDIC. NBRVAL is forced to 20 */
10700/* (order 40) */
10701/* = 0 ==> Everything is OK */
7fd59977 10702
0d969553 10703/* COMMON USED : */
7fd59977 10704/* ---------------- */
10705
0d969553 10706/* REFERENCES CALLED : */
7fd59977 10707/* ------------------- */
10708
0d969553 10709/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 10710/* --------------------------------- */
0d969553
Y
10711/* If KINDIC is not correct (i.e < 1 or > 10), the degree is set */
10712/* to 40 directly (ATTENTION to overload - to avoid it, */
10713/* preview UROOTL and HILTAB dimensioned at least to 20). */
7fd59977 10714
258ff83b 10715/* The value of coefficients was calculated with quadruple precision */
0d969553
Y
10716/* by JJM with help of GD. */
10717/* Checking of roots was done by GD. */
7fd59977 10718
0d969553 10719/* See detailed explications on the listing */
7fd59977 10720/* > */
10721/* **********************************************************************
10722*/
10723
10724
10725/* ------------------------------------ */
0d969553 10726/* ****** Test validity of KINDIC ** */
7fd59977 10727/* ------------------------------------ */
10728
10729 /* Parameter adjustments */
10730 --hiltab;
10731 --urootl;
10732
10733 /* Function Body */
10734 *iercod = 0;
10735 kg = *kindic;
10736 if (kg < 1 || kg > 10) {
10737 kg = 10;
10738 *iercod = -1;
10739 }
10740 *nbrval = kg << 1;
10741 ndegl = *nbrval << 1;
10742
10743/* ----------------------------------------------------------------------
10744*/
0d969553 10745/* ****** Load NBRVAL positive roots depending on the degree **
7fd59977 10746*/
10747/* ----------------------------------------------------------------------
10748*/
0d969553 10749/* ATTENTION : Sign minus (-) in the loop is intentional. */
7fd59977 10750
10751 mmextrl_(&ndegl, tamp);
10752 i__1 = *nbrval;
10753 for (ii = 1; ii <= i__1; ++ii) {
10754 urootl[ii] = -tamp[ii - 1];
10755/* L100: */
10756 }
10757
10758/* ------------------------------------------------------------------- */
0d969553 10759/* ****** Loading of NBRVAL Gauss weight depending on the degree ** */
7fd59977 10760/* ------------------------------------------------------------------- */
10761
10762 mmexthi_(&ndegl, tamp);
10763 i__1 = *nbrval;
10764 for (ii = 1; ii <= i__1; ++ii) {
10765 hiltab[ii] = tamp[ii - 1];
10766/* L200: */
10767 }
10768
10769/* ------------------------------- */
0d969553 10770/* ****** End of sub-program ** */
7fd59977 10771/* ------------------------------- */
10772
10773 return 0;
10774} /* mvgaus0_ */
10775
10776//=======================================================================
10777//function : mvpscr2_
10778//purpose :
10779//=======================================================================
10780int mvpscr2_(integer *ncoeff,
10781 doublereal *curve2,
10782 doublereal *tparam,
10783 doublereal *pntcrb)
10784{
10785 /* System generated locals */
10786 integer i__1;
10787
10788 /* Local variables */
1ef32e96
RL
10789 integer ndeg, kk;
10790 doublereal xxx, yyy;
7fd59977 10791
10792
10793
10794/* **********************************************************************
10795*/
10796
0d969553 10797/* FUNCTION : */
7fd59977 10798/* ---------- */
0d969553 10799/* POSITIONING ON CURVE (NCF,2) IN SPACE OF DIMENSION 2. */
7fd59977 10800
0d969553 10801/* KEYWORDS : */
7fd59977 10802/* ----------- */
10803/* TOUS,MATH_ACCES:: COURBE&,POSITIONNEMENT,&POINT. */
10804
0d969553 10805/* INPUT ARGUMENTS : */
7fd59977 10806/* ------------------ */
0d969553
Y
10807/* NCOEFF : NUMBER OF COEFFICIENTS OF THE CURVE */
10808/* CURVE2 : EQUATION OF CURVE 2D */
10809/* TPARAM : VALUE OF PARAMETER AT GIVEN POINT */
7fd59977 10810
0d969553 10811/* OUTPUT ARGUMENTS : */
7fd59977 10812/* ------------------- */
0d969553
Y
10813/* PNTCRB : COORDINATES OF POINT CORRESPONDING TO PARAMETER */
10814/* TPARAM ON CURVE 2D CURVE2. */
7fd59977 10815
0d969553 10816/* COMMONS USED : */
7fd59977 10817/* ---------------- */
10818
0d969553 10819/* REFERENCES CALLED : */
7fd59977 10820/* ---------------------- */
10821
0d969553 10822/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 10823/* ----------------------------------- */
0d969553 10824/* MSCHEMA OF HORNER. */
7fd59977 10825
7fd59977 10826/* > */
10827/* **********************************************************************
10828*/
10829
10830
0d969553 10831/* -------- INITIALIZATIONS AND PROCESSING OF PARTICULAR CASES ----------
7fd59977 10832*/
10833
0d969553 10834/* ---> Cas when NCOEFF > 1 (case STANDARD). */
7fd59977 10835 /* Parameter adjustments */
10836 --pntcrb;
10837 curve2 -= 3;
10838
10839 /* Function Body */
10840 if (*ncoeff >= 2) {
10841 goto L1000;
10842 }
0d969553 10843/* ---> Case when NCOEFF <= 1. */
7fd59977 10844 if (*ncoeff <= 0) {
10845 pntcrb[1] = 0.;
10846 pntcrb[2] = 0.;
10847 goto L9999;
10848 } else if (*ncoeff == 1) {
10849 pntcrb[1] = curve2[3];
10850 pntcrb[2] = curve2[4];
10851 goto L9999;
10852 }
10853
0d969553 10854/* -------------------- MSCHEMA OF HORNER (PARTICULAR CASE) --------------
7fd59977 10855 */
10856
10857L1000:
10858
10859 if (*tparam == 1.) {
10860 xxx = 0.;
10861 yyy = 0.;
10862 i__1 = *ncoeff;
10863 for (kk = 1; kk <= i__1; ++kk) {
10864 xxx += curve2[(kk << 1) + 1];
10865 yyy += curve2[(kk << 1) + 2];
10866/* L100: */
10867 }
10868 goto L5000;
10869 } else if (*tparam == 0.) {
10870 pntcrb[1] = curve2[3];
10871 pntcrb[2] = curve2[4];
10872 goto L9999;
10873 }
10874
0d969553 10875/* ---------------------------- MSCHEMA OF HORNER ------------------------
7fd59977 10876 */
0d969553 10877/* ---> TPARAM is different from 1.D0 and 0.D0. */
7fd59977 10878
10879 ndeg = *ncoeff - 1;
10880 xxx = curve2[(*ncoeff << 1) + 1];
10881 yyy = curve2[(*ncoeff << 1) + 2];
10882 for (kk = ndeg; kk >= 1; --kk) {
10883 xxx = xxx * *tparam + curve2[(kk << 1) + 1];
10884 yyy = yyy * *tparam + curve2[(kk << 1) + 2];
10885/* L200: */
10886 }
10887 goto L5000;
10888
0d969553 10889/* ------------------------ RECOVER THE CALCULATED POINT ---------------
7fd59977 10890*/
10891
10892L5000:
10893 pntcrb[1] = xxx;
10894 pntcrb[2] = yyy;
10895
10896/* ------------------------------ THE END -------------------------------
10897*/
10898
10899L9999:
10900 return 0;
10901} /* mvpscr2_ */
10902
10903//=======================================================================
10904//function : mvpscr3_
10905//purpose :
10906//=======================================================================
10907int mvpscr3_(integer *ncoeff,
10908 doublereal *curve3,
10909 doublereal *tparam,
10910 doublereal *pntcrb)
10911
10912{
10913 /* System generated locals */
10914 integer i__1;
10915
10916 /* Local variables */
1ef32e96
RL
10917 integer ndeg, kk;
10918 doublereal xxx, yyy, zzz;
7fd59977 10919
10920
10921
10922/* **********************************************************************
10923*/
10924
0d969553 10925/* FUNCTION : */
7fd59977 10926/* ---------- */
0d969553 10927/* POSITIONING ON A CURVE (3,NCF) IN THE SPACE OF DIMENSION 3. */
7fd59977 10928
0d969553 10929/* KEYWORDS : */
7fd59977 10930/* ----------- */
10931/* TOUS, MATH_ACCES:: COURBE&,POSITIONNEMENT,&POINT. */
10932
0d969553 10933/* INPUT ARGUMENTS : */
7fd59977 10934/* ------------------ */
0d969553
Y
10935/* NCOEFF : NB OF COEFFICIENTS OF THE CURVE */
10936/* CURVE3 : EQUATION OF CURVE 3D */
10937/* TPARAM : VALUE OF THE PARAMETER AT THE GIVEN POINT */
7fd59977 10938
0d969553 10939/* OUTPUT ARGUMENTS : */
7fd59977 10940/* ------------------- */
0d969553
Y
10941/* PNTCRB : COORDINATES OF THE POINT CORRESPONDING TO PARAMETER */
10942/* TPARAM ON CURVE 3D CURVE3. */
7fd59977 10943
0d969553 10944/* COMMONS USED : */
7fd59977 10945/* ---------------- */
10946
0d969553 10947/* REFERENCES CALLED : */
7fd59977 10948/* ---------------------- */
10949/* Neant */
10950
0d969553 10951/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 10952/* ----------------------------------- */
0d969553 10953/* MSCHEMA OF HORNER. */
7fd59977 10954/* > */
10955/* **********************************************************************
10956*/
10957/* DECLARATIONS */
10958/* **********************************************************************
10959*/
10960
10961
0d969553 10962/* -------- INITIALISATIONS AND PROCESSING OF PARTICULAR CASES ----------
7fd59977 10963*/
10964
0d969553 10965/* ---> Case when NCOEFF > 1 (cas STANDARD). */
7fd59977 10966 /* Parameter adjustments */
10967 --pntcrb;
10968 curve3 -= 4;
10969
10970 /* Function Body */
10971 if (*ncoeff >= 2) {
10972 goto L1000;
10973 }
0d969553 10974/* ---> Case when NCOEFF <= 1. */
7fd59977 10975 if (*ncoeff <= 0) {
10976 pntcrb[1] = 0.;
10977 pntcrb[2] = 0.;
10978 pntcrb[3] = 0.;
10979 goto L9999;
10980 } else if (*ncoeff == 1) {
10981 pntcrb[1] = curve3[4];
10982 pntcrb[2] = curve3[5];
10983 pntcrb[3] = curve3[6];
10984 goto L9999;
10985 }
10986
0d969553 10987/* -------------------- MSCHEMA OF HORNER (PARTICULAR CASE) --------------
7fd59977 10988 */
10989
10990L1000:
10991
10992 if (*tparam == 1.) {
10993 xxx = 0.;
10994 yyy = 0.;
10995 zzz = 0.;
10996 i__1 = *ncoeff;
10997 for (kk = 1; kk <= i__1; ++kk) {
10998 xxx += curve3[kk * 3 + 1];
10999 yyy += curve3[kk * 3 + 2];
11000 zzz += curve3[kk * 3 + 3];
11001/* L100: */
11002 }
11003 goto L5000;
11004 } else if (*tparam == 0.) {
11005 pntcrb[1] = curve3[4];
11006 pntcrb[2] = curve3[5];
11007 pntcrb[3] = curve3[6];
11008 goto L9999;
11009 }
11010
0d969553 11011/* ---------------------------- MSCHEMA OF HORNER ------------------------
7fd59977 11012 */
0d969553 11013/* ---> Here TPARAM is different from 1.D0 and 0.D0. */
7fd59977 11014
11015 ndeg = *ncoeff - 1;
11016 xxx = curve3[*ncoeff * 3 + 1];
11017 yyy = curve3[*ncoeff * 3 + 2];
11018 zzz = curve3[*ncoeff * 3 + 3];
11019 for (kk = ndeg; kk >= 1; --kk) {
11020 xxx = xxx * *tparam + curve3[kk * 3 + 1];
11021 yyy = yyy * *tparam + curve3[kk * 3 + 2];
11022 zzz = zzz * *tparam + curve3[kk * 3 + 3];
11023/* L200: */
11024 }
11025 goto L5000;
11026
0d969553 11027/* ------------------------ RETURN THE CALCULATED POINT ------------------
7fd59977 11028*/
11029
11030L5000:
11031 pntcrb[1] = xxx;
11032 pntcrb[2] = yyy;
11033 pntcrb[3] = zzz;
11034
11035/* ------------------------------ THE END -------------------------------
11036*/
11037
11038L9999:
11039 return 0;
11040} /* mvpscr3_ */
11041
11042//=======================================================================
11043//function : AdvApp2Var_MathBase::mvsheld_
11044//purpose :
11045//=======================================================================
11046 int AdvApp2Var_MathBase::mvsheld_(integer *n,
11047 integer *is,
11048 doublereal *dtab,
11049 integer *icle)
11050
11051{
11052 /* System generated locals */
11053 integer dtab_dim1, dtab_offset, i__1, i__2;
11054
11055 /* Local variables */
1ef32e96
RL
11056 integer incr;
11057 doublereal dsave;
11058 integer i3, i4, i5, incrp1;
7fd59977 11059
11060
11061/************************************************************************
11062*******/
11063
0d969553 11064/* FUNCTION : */
7fd59977 11065/* ---------- */
0d969553
Y
11066/* PARSING OF COLUMNS OF TABLE OF REAL*8 BY SHELL METHOD*/
11067/* (IN INCREASING ORDER) */
7fd59977 11068
0d969553 11069/* KEYWORDS : */
7fd59977 11070/* ----------- */
0d969553 11071/* POINT-ENTRY, PARSING, SHELL */
7fd59977 11072
0d969553 11073/* INPUT ARGUMENTS : */
7fd59977 11074/* ------------------ */
0d969553
Y
11075/* N : NUMBER OF COLUMNS OF THE TABLE */
11076/* IS : NUMBER OF LINE OF THE TABLE */
11077/* DTAB : TABLE OF REAL*8 TO BE PARSED */
11078/* ICLE : POSITION OF THE KEY ON THE COLUMN */
7fd59977 11079
0d969553 11080/* OUTPUT ARGUMENTS : */
7fd59977 11081/* ------------------- */
0d969553 11082/* DTAB : PARSED TABLE */
7fd59977 11083
0d969553 11084/* COMMONS USED : */
7fd59977 11085/* ---------------- */
11086
11087
0d969553 11088/* REFERENCES CALLED : */
7fd59977 11089/* ---------------------- */
11090/* Neant */
11091
0d969553 11092/* DESCRIPTION/NOTES/LIMITATIONS : */
7fd59977 11093/* ----------------------------------- */
0d969553
Y
11094/* CLASSIC SHELL METHOD : PARSING BY SERIES */
11095/* Declaration DTAB(IS, 1) corresponds to DTAB(IS, *) */
7fd59977 11096/* > */
11097/* ***********************************************************************
11098 */
11099
11100
11101 /* Parameter adjustments */
11102 dtab_dim1 = *is;
11103 dtab_offset = dtab_dim1 + 1;
11104 dtab -= dtab_offset;
11105
11106 /* Function Body */
11107 if (*n <= 1) {
11108 goto L9900;
11109 }
11110/* ------------------------ */
11111
0d969553
Y
11112/* INITIALIZATION OF THE SEQUENCE OF INCREMENTS */
11113/* FIND THE GREATEST INCREMENT SO THAT INCR < N/9 */
7fd59977 11114
11115 incr = 1;
11116L1001:
11117 if (incr >= *n / 9) {
11118 goto L1002;
11119 }
11120/* ----------------------------- */
11121 incr = incr * 3 + 1;
11122 goto L1001;
11123
0d969553
Y
11124/* LOOP ON INCREMENTS TILL INCR = 1 */
11125/* PARSING BY SERIES DISTANT FROM INCR */
7fd59977 11126
11127L1002:
11128 incrp1 = incr + 1;
11129/* ----------------- */
11130 i__1 = *n;
11131 for (i3 = incrp1; i3 <= i__1; ++i3) {
11132/* ---------------------- */
11133
0d969553 11134/* SET ELEMENT I3 AT ITS PLACE IN THE SERIES */
7fd59977 11135
11136 i4 = i3 - incr;
11137L1004:
11138 if (i4 < 1) {
11139 goto L1003;
11140 }
11141/* ------------------------- */
11142 if (dtab[*icle + i4 * dtab_dim1] <= dtab[*icle + (i4 + incr) *
11143 dtab_dim1]) {
11144 goto L1003;
11145 }
11146
11147 i__2 = *is;
11148 for (i5 = 1; i5 <= i__2; ++i5) {
11149/* ------------------ */
11150 dsave = dtab[i5 + i4 * dtab_dim1];
11151 dtab[i5 + i4 * dtab_dim1] = dtab[i5 + (i4 + incr) * dtab_dim1];
11152 dtab[i5 + (i4 + incr) * dtab_dim1] = dsave;
11153 }
11154/* -------- */
11155 i4 -= incr;
11156 goto L1004;
11157
11158L1003:
11159 ;
11160 }
11161/* -------- */
11162
0d969553 11163/* PASSAGE TO THE NEXT INCREMENT */
7fd59977 11164
11165 incr /= 3;
11166 if (incr >= 1) {
11167 goto L1002;
11168 }
11169
11170L9900:
11171 return 0 ;
11172} /* mvsheld_ */
11173
11174//=======================================================================
11175//function : AdvApp2Var_MathBase::mzsnorm_
11176//purpose :
11177//=======================================================================
11178 doublereal AdvApp2Var_MathBase::mzsnorm_(integer *ndimen,
11179 doublereal *vecteu)
11180
11181{
11182 /* System generated locals */
11183 integer i__1;
11184 doublereal ret_val, d__1, d__2;
11185
11186 /* Local variables */
1ef32e96
RL
11187 doublereal xsom;
11188 integer i__, irmax;
7fd59977 11189
11190
11191
11192/* ***********************************************************************
11193 */
11194
0d969553 11195/* FUNCTION : */
7fd59977 11196/* ---------- */
0d969553 11197/* SERVES to calculate the euclidian norm of a vector : */
7fd59977 11198/* ____________________________ */
11199/* Z = V V(1)**2 + V(2)**2 + ... */
11200
0d969553 11201/* KEYWORDS : */
7fd59977 11202/* ----------- */
11203/* SURMFACIQUE, */
11204
0d969553 11205/* INPUT ARGUMENTS : */
7fd59977 11206/* ------------------ */
0d969553
Y
11207/* NDIMEN : Dimension of the vector */
11208/* VECTEU : vector of dimension NDIMEN */
7fd59977 11209
0d969553 11210/* OUTPUT ARGUMENTS : */
7fd59977 11211/* ------------------- */
0d969553 11212/* MZSNORM : Value of the euclidian norm of vector VECTEU */
7fd59977 11213
0d969553 11214/* COMMONS USED : */
7fd59977 11215/* ---------------- */
11216
11217/* .Neant. */
11218
0d969553 11219/* REFERENCES CALLED : */
7fd59977 11220/* ---------------------- */
11221/* Type Name */
11222/* R*8 ABS R*8 SQRT */
11223
0d969553 11224/* DESCRIPTION/NOTESS/LIMITATIONS : */
7fd59977 11225/* ----------------------------------- */
0d969553
Y
11226/* To limit the risks of overflow, */
11227/* the term of the strongest absolute value is factorized : */
7fd59977 11228/* _______________________ */
11229/* Z = !V(1)! * V 1 + (V(2)/V(1))**2 + ... */
11230
7fd59977 11231/* > */
11232/* ***********************************************************************
11233 */
11234/* DECLARATIONS */
11235/* ***********************************************************************
11236 */
11237
11238
11239/* ***********************************************************************
11240 */
0d969553 11241/* PROCESSING */
7fd59977 11242/* ***********************************************************************
11243 */
11244
0d969553 11245/* ___ Find the strongest absolute value term */
7fd59977 11246
11247 /* Parameter adjustments */
11248 --vecteu;
11249
11250 /* Function Body */
11251 irmax = 1;
11252 i__1 = *ndimen;
11253 for (i__ = 2; i__ <= i__1; ++i__) {
41194117 11254 if ((d__1 = vecteu[irmax], advapp_abs(d__1)) < (d__2 = vecteu[i__], advapp_abs(d__2)
7fd59977 11255 )) {
11256 irmax = i__;
11257 }
11258/* L100: */
11259 }
11260
0d969553 11261/* ___ Calculate the norme */
7fd59977 11262
41194117 11263 if ((d__1 = vecteu[irmax], advapp_abs(d__1)) < 1.) {
7fd59977 11264 xsom = 0.;
11265 i__1 = *ndimen;
11266 for (i__ = 1; i__ <= i__1; ++i__) {
11267/* Computing 2nd power */
11268 d__1 = vecteu[i__];
11269 xsom += d__1 * d__1;
11270/* L200: */
11271 }
11272 ret_val = sqrt(xsom);
11273 } else {
11274 xsom = 0.;
11275 i__1 = *ndimen;
11276 for (i__ = 1; i__ <= i__1; ++i__) {
11277 if (i__ == irmax) {
11278 xsom += 1.;
11279 } else {
11280/* Computing 2nd power */
11281 d__1 = vecteu[i__] / vecteu[irmax];
11282 xsom += d__1 * d__1;
11283 }
11284/* L300: */
11285 }
41194117 11286 ret_val = (d__1 = vecteu[irmax], advapp_abs(d__1)) * sqrt(xsom);
7fd59977 11287 }
11288
11289/* ***********************************************************************
11290 */
0d969553 11291/* RETURN CALLING PROGRAM */
7fd59977 11292/* ***********************************************************************
11293 */
11294
11295 return ret_val;
11296} /* mzsnorm_ */
11297