27char op_primr_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/op_primr.C,v 1.10 2014/10/13 08:53:26 j_novak Exp $" ;
80void _primr_pas_prevu(
const Tbl&,
int bin,
const Tbl&, Tbl&,
int&, Tbl& ) {
82 cout <<
"Unexpected basis in primr : basis = " << hex << bin << endl ;
89void _primr_r_cheb(
const Tbl& tin,
int bin,
const Tbl& valm1, Tbl& tout,
90 int& bout, Tbl& valp1) {
92 assert(tin.dim == tout.dim) ;
98 int nr = tin.get_dim(0) ;
99 int nt = tin.get_dim(1) ;
100 int np = tin.get_dim(2) - 2 ;
101 int borne_phi = np + 1 ;
102 if (np == 1) borne_phi = 1 ;
106 if ((tin.get_etat() == ETATZERO)||(nr == 1)) {
107 if (valm1.get_etat() == ETATZERO) {
108 tout.set_etat_zero() ;
109 valp1.set_etat_zero() ;
113 assert(valm1.get_etat() == ETATQCQ) ;
114 tout.set_etat_qcq() ;
115 valp1.set_etat_qcq() ;
116 double* xco = tout.t ;
117 for (
int k=0 ; k< borne_phi ; k++) {
122 for (
int j=0 ; j<nt ; j++) {
123 xco[0] = valm1(k,j) ;
124 for (
int i=1; i<nr; i++) xco[i] = 0 ;
125 valp1.set(k,j) = xco[0] ;
137 assert(tin.get_etat() == ETATQCQ ) ;
139 valp1.annule_hard() ;
141 const double* xci = tin.t ;
142 double* xco = tout.t ;
144 for (
int k=0 ; k< borne_phi ; k++) {
150 for (
int j=0 ; j<nt ; j++) {
152 xco[1] = xci[0] - 0.5 * xci[2] ;
154 for (
int i=2; i<nr-2; i++) {
155 xco[i] = (xci[i-1] - xci[i+1]) /
double(2*i) ;
158 xco[nr-2] = xci[nr-3] / double(2*nr - 4) ;
159 xco[nr-1] = xci[nr-2] / double(2*nr - 2) ;
163 double som = - xco[1] ;
164 for (
int i=2; i<nr; i+=2) som += xco[i] ;
165 for (
int i=3; i<nr; i+=2) som -= xco[i] ;
166 xco[0] = valm1(k,j) - som ;
170 for (
int i=1; i<nr; i++) som += xco[i] ;
171 valp1.set(k,j) = som ;
185void _primr_r_chebp(
const Tbl& tin,
int bin,
const Tbl&, Tbl& tout,
186 int& bout, Tbl& valp1) {
188 assert(tin.dim == tout.dim) ;
191 int base_t = bin &
MSQ_T ;
192 int base_p = bin &
MSQ_P ;
193 bout = base_p | base_t |
R_CHEBI ;
196 int nr = tin.get_dim(0) ;
197 int nt = tin.get_dim(1) ;
198 int np = tin.get_dim(2) - 2 ;
199 int borne_phi = np + 1 ;
200 if (np == 1) borne_phi = 1 ;
204 if (tin.get_etat() == ETATZERO) {
205 tout.set_etat_zero() ;
206 valp1.set_etat_zero() ;
213 assert(tin.get_etat() == ETATQCQ ) ;
215 valp1.annule_hard() ;
217 const double* xci = tin.t ;
218 double* xco = tout.t ;
220 for (
int k=0 ; k< borne_phi ; k++) {
226 for (
int j=0 ; j<nt ; j++) {
228 xco[0] = xci[0] - 0.5*xci[1] ;
230 for (
int i=1; i<nr-2; i++) {
231 xco[i] = (xci[i] - xci[i+1]) /
double(4*i+2) ;
234 xco[nr-2] = xci[nr-2] / double(4*nr - 6) ;
238 double som = xco[0] ;
239 for (
int i=1; i<nr; i++) som += xco[i] ;
240 valp1.set(k,j) = som ;
253void _primr_r_chebi(
const Tbl& tin,
int bin,
const Tbl& val0, Tbl& tout,
254 int& bout, Tbl& valp1) {
256 assert(tin.dim == tout.dim) ;
259 int base_t = bin &
MSQ_T ;
260 int base_p = bin &
MSQ_P ;
261 bout = base_p | base_t |
R_CHEBP ;
264 int nr = tin.get_dim(0) ;
265 int nt = tin.get_dim(1) ;
266 int np = tin.get_dim(2) - 2 ;
267 int borne_phi = np + 1 ;
268 if (np == 1) borne_phi = 1 ;
273 if (tin.get_etat() == ETATZERO) {
274 if (val0.get_etat() == ETATZERO) {
275 tout.set_etat_zero() ;
276 valp1.set_etat_zero() ;
280 assert(val0.get_etat() == ETATQCQ) ;
282 valp1.annule_hard() ;
283 double* xco = tout.t ;
284 for (
int k=0 ; k< borne_phi ; k++) {
289 for (
int j=0 ; j<nt ; j++) {
291 for (
int i=1; i<nr; i++) xco[i] = 0 ;
292 valp1.set(k,j) = xco[0] ;
304 assert(tin.get_etat() == ETATQCQ ) ;
306 valp1.annule_hard() ;
308 const double* xci = tin.t ;
309 double* xco = tout.t ;
311 for (
int k=0 ; k< borne_phi ; k++) {
317 for (
int j=0 ; j<nt ; j++) {
319 for (
int i=1; i<nr-1; i++) {
320 xco[i] = (xci[i-1] - xci[i]) /
double(4*i) ;
323 xco[nr-1] = xci[nr-2] / double(4*nr - 4) ;
327 double som = - xco[1] ;
328 for (
int i=2; i<nr; i+=2) som += xco[i] ;
329 for (
int i=3; i<nr; i+=2) som -= xco[i] ;
330 xco[0] = val0(k,j) - som ;
334 for (
int i=1; i<nr; i++) som += xco[i] ;
335 valp1.set(k,j) = som ;
349void _primr_r_chebpim_p(
const Tbl& tin,
int bin,
const Tbl& val0, Tbl& tout,
350 int& bout, Tbl& valp1) {
352 assert(tin.dim == tout.dim) ;
355 int base_t = bin &
MSQ_T ;
356 int base_p = bin &
MSQ_P ;
360 int nr = tin.get_dim(0) ;
361 int nt = tin.get_dim(1) ;
362 int np = tin.get_dim(2) - 2 ;
363 int borne_phi = np + 1 ;
364 if (np == 1) borne_phi = 1 ;
369 if (tin.get_etat() == ETATZERO) {
370 if (val0.get_etat() == ETATZERO) {
371 tout.set_etat_zero() ;
372 valp1.set_etat_zero() ;
376 assert(val0.get_etat() == ETATQCQ) ;
378 valp1.annule_hard() ;
379 double* xco = tout.t ;
382 for (
int k=0 ; k<borne_phi ; k += 4) {
383 int auxiliaire = (k==np) ? 1 : 2 ;
384 for (
int kmod=0 ; kmod<auxiliaire ; kmod++) {
385 if ((k==0) && (kmod == 1)) {
389 for (
int j=0 ; j<nt ; j++) {
390 assert( val0(k+kmod,j) ==
double(0) ) ;
391 for (
int i=0; i<nr; i++) xco[i] = 0 ;
392 valp1.set(k+kmod,j) = 0. ;
401 xco = tout.t + 2*nr*nt ;
402 for (
int k=2 ; k<borne_phi ; k += 4) {
403 int auxiliaire = (k==np) ? 1 : 2 ;
404 for (
int kmod=0 ; kmod<auxiliaire ; kmod++) {
405 for (
int j=0 ; j<nt ; j++) {
406 xco[0] = val0(k+kmod,j) ;
407 for (
int i=1; i<nr; i++) xco[i] = 0 ;
408 valp1.set(k+kmod,j) = xco[0] ;
421 assert(tin.get_etat() == ETATQCQ ) ;
423 valp1.annule_hard() ;
425 const double* xci = tin.t ;
426 double* xco = tout.t ;
430 for (
int k=0 ; k<borne_phi ; k += 4) {
431 int auxiliaire = (k==np) ? 1 : 2 ;
432 for (
int kmod=0 ; kmod<auxiliaire ; kmod++) {
433 if ((k==0) && (kmod == 1)) {
438 for (
int j=0 ; j<nt ; j++) {
439 xco[0] = xci[0] - 0.5*xci[1] ;
441 for (
int i=1; i<nr-2; i++) {
442 xco[i] = (xci[i] - xci[i+1]) /
double(4*i+2) ;
445 xco[nr-2] = xci[nr-2] / double(4*nr - 6) ;
449 double som = xco[0] ;
450 for (
int i=1; i<nr; i++) som += xco[i] ;
451 valp1.set(k+kmod,j) = som ;
465 xci = tin.t + 2*nr*nt ;
466 xco = tout.t + 2*nr*nt ;
467 for (
int k=2 ; k<borne_phi ; k += 4) {
468 int auxiliaire = (k==np) ? 1 : 2 ;
469 for (
int kmod=0 ; kmod<auxiliaire ; kmod++) {
470 for (
int j=0 ; j<nt ; j++) {
472 for (
int i=1; i<nr-1; i++) {
473 xco[i] = (xci[i-1] - xci[i]) /
double(4*i) ;
476 xco[nr-1] = xci[nr-2] / double(4*nr - 4) ;
480 double som = - xco[1] ;
481 for (
int i=2; i<nr; i+=2) som += xco[i] ;
482 for (
int i=3; i<nr; i+=2) som -= xco[i] ;
483 xco[0] = val0(k+kmod,j) - som ;
487 for (
int i=1; i<nr; i++) som += xco[i] ;
488 valp1.set(k+kmod,j) = som ;
505void _primr_r_chebpim_i(
const Tbl& tin,
int bin,
const Tbl& val0, Tbl& tout,
506 int& bout, Tbl& valp1) {
508 assert(tin.dim == tout.dim) ;
511 int base_t = bin &
MSQ_T ;
512 int base_p = bin &
MSQ_P ;
516 int nr = tin.get_dim(0) ;
517 int nt = tin.get_dim(1) ;
518 int np = tin.get_dim(2) - 2 ;
519 int borne_phi = np + 1 ;
520 if (np == 1) borne_phi = 1 ;
524 if (tin.get_etat() == ETATZERO) {
525 if (val0.get_etat() == ETATZERO) {
526 tout.set_etat_zero() ;
527 valp1.set_etat_zero() ;
531 assert(val0.get_etat() == ETATQCQ) ;
533 valp1.annule_hard() ;
534 double* xco = tout.t ;
537 for (
int k=0 ; k<borne_phi ; k += 4) {
538 int auxiliaire = (k==np) ? 1 : 2 ;
539 for (
int kmod=0 ; kmod<auxiliaire ; kmod++) {
540 if ((k==0) && (kmod == 1)) {
544 for (
int j=0 ; j<nt ; j++) {
545 xco[0] = val0(k+kmod,j) ;
546 for (
int i=1; i<nr; i++) xco[i] = 0 ;
547 valp1.set(k+kmod,j) = xco[0] ;
556 xco = tout.t + 2*nr*nt ;
557 for (
int k=2 ; k<borne_phi ; k += 4) {
558 int auxiliaire = (k==np) ? 1 : 2 ;
559 for (
int kmod=0 ; kmod<auxiliaire ; kmod++) {
560 for (
int j=0 ; j<nt ; j++) {
561 assert( val0(k+kmod,j) ==
double(0) ) ;
562 for (
int i=0; i<nr; i++) xco[i] = 0 ;
563 valp1.set(k+kmod,j) = 0. ;
576 assert(tin.get_etat() == ETATQCQ ) ;
578 valp1.annule_hard() ;
580 const double* xci = tin.t ;
581 double* xco = tout.t ;
585 for (
int k=0 ; k<borne_phi ; k += 4) {
586 int auxiliaire = (k==np) ? 1 : 2 ;
587 for (
int kmod=0 ; kmod<auxiliaire ; kmod++) {
588 if ((k==0) && (kmod == 1)) {
593 for (
int j=0 ; j<nt ; j++) {
595 for (
int i=1; i<nr-1; i++) {
596 xco[i] = (xci[i-1] - xci[i]) /
double(4*i) ;
599 xco[nr-1] = xci[nr-2] / double(4*nr - 4) ;
603 double som = - xco[1] ;
604 for (
int i=2; i<nr; i+=2) som += xco[i] ;
605 for (
int i=3; i<nr; i+=2) som -= xco[i] ;
606 xco[0] = val0(k+kmod,j) - som ;
610 for (
int i=1; i<nr; i++) som += xco[i] ;
611 valp1.set(k+kmod,j) = som ;
624 xci = tin.t + 2*nr*nt ;
625 xco = tout.t + 2*nr*nt ;
626 for (
int k=2 ; k<borne_phi ; k += 4) {
627 int auxiliaire = (k==np) ? 1 : 2 ;
628 for (
int kmod=0 ; kmod<auxiliaire ; kmod++) {
630 for (
int j=0 ; j<nt ; j++) {
631 xco[0] = xci[0] - 0.5*xci[1] ;
633 for (
int i=1; i<nr-2; i++) {
634 xco[i] = (xci[i] - xci[i+1]) /
double(4*i+2) ;
637 xco[nr-2] = xci[nr-2] / double(4*nr - 6) ;
641 double som = xco[0] ;
642 for (
int i=1; i<nr; i++) som += xco[i] ;
643 valp1.set(k+kmod,j) = som ;
659void _primr_r_chebpi_p(
const Tbl& tin,
int bin,
const Tbl& val0, Tbl& tout,
660 int& bout, Tbl& valp1) {
662 assert(tin.dim == tout.dim) ;
665 int base_t = bin &
MSQ_T ;
666 int base_p = bin &
MSQ_P ;
670 int nr = tin.get_dim(0) ;
671 int nt = tin.get_dim(1) ;
672 int np = tin.get_dim(2) - 2 ;
673 int borne_phi = np + 1 ;
674 if (np == 1) borne_phi = 1 ;
679 if (tin.get_etat() == ETATZERO) {
680 if (val0.get_etat() == ETATZERO) {
681 tout.set_etat_zero() ;
682 valp1.set_etat_zero() ;
686 assert(val0.get_etat() == ETATQCQ) ;
688 valp1.annule_hard() ;
689 double* xco = tout.t ;
690 for (
int k=0 ; k< borne_phi ; k++) {
695 for (
int j=0 ; j<nt ; j++) {
698 for (
int i=0; i<nr; i++) xco[i] = 0 ;
699 valp1.set(k,j) = 0. ;
702 for (
int i=1; i<nr; i++) xco[i] = 0 ;
703 valp1.set(k,j) = xco[0] ;
716 assert(tin.get_etat() == ETATQCQ ) ;
718 valp1.annule_hard() ;
720 const double* xci = tin.t ;
721 double* xco = tout.t ;
723 for (
int k=0 ; k< borne_phi ; k++) {
729 for (
int j=0 ; j<nt ; j++) {
733 xco[0] = xci[0] - 0.5*xci[1] ;
735 for (
int i=1; i<nr-2; i++) {
736 xco[i] = (xci[i] - xci[i+1]) /
double(4*i+2) ;
739 xco[nr-2] = xci[nr-2] / double(4*nr - 6) ;
743 double som = xco[0] ;
744 for (
int i=1; i<nr; i++) som += xco[i] ;
745 valp1.set(k,j) = som ;
747 for (
int i=1; i<nr-1; i++) {
748 xco[i] = (xci[i-1] - xci[i]) /
double(4*i) ;
751 xco[nr-1] = xci[nr-2] / double(4*nr - 4) ;
755 double som = - xco[1] ;
756 for (
int i=2; i<nr; i+=2) som += xco[i] ;
757 for (
int i=3; i<nr; i+=2) som -= xco[i] ;
758 xco[0] = val0(k,j) - som ;
762 for (
int i=1; i<nr; i++) som += xco[i] ;
763 valp1.set(k,j) = som ;
774void _primr_r_chebpi_i(
const Tbl& tin,
int bin,
const Tbl& val0, Tbl& tout,
775 int& bout, Tbl& valp1) {
777 assert(tin.dim == tout.dim) ;
780 int base_t = bin &
MSQ_T ;
781 int base_p = bin &
MSQ_P ;
785 int nr = tin.get_dim(0) ;
786 int nt = tin.get_dim(1) ;
787 int np = tin.get_dim(2) - 2 ;
788 int borne_phi = np + 1 ;
789 if (np == 1) borne_phi = 1 ;
794 if (tin.get_etat() == ETATZERO) {
795 if (val0.get_etat() == ETATZERO) {
796 tout.set_etat_zero() ;
797 valp1.set_etat_zero() ;
801 assert(val0.get_etat() == ETATQCQ) ;
803 valp1.annule_hard() ;
804 double* xco = tout.t ;
805 for (
int k=0 ; k< borne_phi ; k++) {
810 for (
int j=0 ; j<nt ; j++) {
813 for (
int i=0; i<nr; i++) xco[i] = 0 ;
814 valp1.set(k,j) = 0. ;
817 for (
int i=1; i<nr; i++) xco[i] = 0 ;
818 valp1.set(k,j) = xco[0] ;
831 assert(tin.get_etat() == ETATQCQ ) ;
833 valp1.annule_hard() ;
835 const double* xci = tin.t ;
836 double* xco = tout.t ;
838 for (
int k=0 ; k< borne_phi ; k++) {
844 for (
int j=0 ; j<nt ; j++) {
848 xco[0] = xci[0] - 0.5*xci[1] ;
850 for (
int i=1; i<nr-2; i++) {
851 xco[i] = (xci[i] - xci[i+1]) /
double(4*i+2) ;
854 xco[nr-2] = xci[nr-2] / double(4*nr - 6) ;
858 double som = xco[0] ;
859 for (
int i=1; i<nr; i++) som += xco[i] ;
860 valp1.set(k,j) = som ;
862 for (
int i=1; i<nr-1; i++) {
863 xco[i] = (xci[i-1] - xci[i]) /
double(4*i) ;
866 xco[nr-1] = xci[nr-2] / double(4*nr - 4) ;
870 double som = - xco[1] ;
871 for (
int i=2; i<nr; i+=2) som += xco[i] ;
872 for (
int i=3; i<nr; i+=2) som -= xco[i] ;
873 xco[0] = val0(k,j) - som ;
877 for (
int i=1; i<nr; i++) som += xco[i] ;
878 valp1.set(k,j) = som ;
891void _primr_r_jaco02(
const Tbl& tin,
int bin,
const Tbl& valm1, Tbl& tout,
892 int& bout, Tbl& valp1) {
894 assert(tin.dim == tout.dim) ;
900 int nr = tin.get_dim(0) ;
901 int nt = tin.get_dim(1) ;
902 int np = tin.get_dim(2) - 2 ;
903 int borne_phi = np + 1 ;
904 if (np == 1) borne_phi = 1 ;
908 if ((tin.get_etat() == ETATZERO)||(nr == 1)) {
909 if (valm1.get_etat() == ETATZERO) {
910 tout.set_etat_zero() ;
911 valp1.set_etat_zero() ;
915 assert(valm1.get_etat() == ETATQCQ) ;
916 tout.set_etat_qcq() ;
917 valp1.set_etat_qcq() ;
918 double* xco = tout.t ;
919 for (
int k=0 ; k< borne_phi ; k++) {
924 for (
int j=0 ; j<nt ; j++) {
925 xco[0] = valm1(k,j) ;
926 for (
int i=1; i<nr; i++) xco[i] = 0 ;
927 valp1.set(k,j) = xco[0] ;
939 assert(tin.get_etat() == ETATQCQ ) ;
941 valp1.annule_hard() ;
943 const double* xci = tin.t ;
944 double* xco = tout.t ;
946 for (
int k=0 ; k< borne_phi ; k++) {
952 for (
int j=0 ; j<nt ; j++) {
954 for (
int i=1; i<nr-1; i++) {
955 xco[i] = (i+2)/
double((i+1)*(2*i+1))*xci[i-1] - xci[i]/double((i+1)*(i+2)) - (i+1)/
double((i+2)*(2*i+5))*xci[i+1] ;
957 xco[nr-1] = (nr+1)/
double((nr)*(2*nr-1))*xci[nr-2] - xci[nr-1]/double((nr)*(nr+1));
962 double som = -3*xco[1] ;
963 for (
int i=2; i<nr; i++) {
964 int signe = (i%2 == 0 ? 1 : -1) ;
965 som += xco[i]*signe*(i+1)*(i+2)/double(2) ;
967 xco[0] = valm1(k,j) - som ;
971 for (
int i=1; i<nr; i++) som += xco[i] ;
972 valp1.set(k,j) = som ;
#define R_CHEBI
base de Cheb. impaire (rare) seulement
#define R_CHEBPIM_I
Cheb. pair-impair suivant m, impair pour m=0.
#define R_CHEBPI_I
Cheb. pair-impair suivant l impair pour l=0.
#define R_CHEBPIM_P
Cheb. pair-impair suivant m, pair pour m=0.
#define MSQ_T
Extraction de l'info sur Theta.
#define R_CHEBP
base de Cheb. paire (rare) seulement
#define MSQ_P
Extraction de l'info sur Phi.
#define R_CHEBPI_P
Cheb. pair-impair suivant l pair pour l=0.