V3FIT
legendre_to_power.f
1  SUBROUTINE legendre_to_power(n, a_inv, b_inv, tc, ac)
2  USE stel_kinds
3  IMPLICIT NONE
4 !-----------------------------------------------
5 ! D u m m y A r g u m e n t s
6 !-----------------------------------------------
7  INTEGER, INTENT(IN):: n
8  REAL(rprec), DIMENSION(0:n), INTENT(IN):: tc
9  REAL(rprec), DIMENSION(0:n), INTENT(OUT):: ac
10  REAL(rprec), DIMENSION(0:n,0:n), INTENT(IN):: a_inv, b_inv
11 !---------------------------------------------------------------------
12  INTEGER:: i, j, k
13 !---------------------------------------------------------------------
14 ! Given the following notation:
15 !
16 ! AC == (ac(1), ...ac(n))==> vector of coefficients for
17 ! power series in [0,1]
18 ! TC == (tc(1), ...tc(n))==> vector of coefficients for
19 ! Legendre series in [-1,1]
20 ! THEN:
21 ! AC = TC* A_INV * B_INV
22 !----------------------------------------------------------------------
23  DO i = 0, n
24  ac(i) = 0
25  DO j= 0, n
26  DO k = 0, n
27  ac(i) = ac(i) + tc(j) * a_inv(j,k) * b_inv(k,i)
28  ENDDO
29  ENDDO
30  ENDDO
31 
32  END SUBROUTINE legendre_to_power