Skip to main content

LagrangeCoeff

Returns the coefficients for lagrange polynomial.

This function returns the coefficient of basis functions.

pn(x,y)=a=0pb=0qca,bxaybp_{n}(x,y) = \sum_{a=0}^{p}\sum_{b=0}^{q}{c_{a,b}x^{a}y^{b}}

This routine returns the coefficients, ca,bc_{a,b}.

For example, for Lagrange polynomial of order 2, on equidistance grid, we have following coefficients of Monomials basis:

coeff:

Basisl1l_1l2l_2l3l_3l4l_4l5l_5l6l_6l7l_7l8l_8l9l_9
11000000001
xx000000.50-0.5-0
x2x^200-0000.500.5-1
yy0000-0.500.50-0
xyxy0.25-0.250.25-0.250000-0
x2yx^2 y-0.25-0.250.250.250.5-0-0.50-0
y2y^200000.500.50-1
xy2xy^2-0.250.250.25-0.250-0.500.5-0
x2y2x^2 y^20.250.250.250.25-0.5-0.5-0.5-0.51

Interface 1

INTERFACE
MODULE FUNCTION LagrangeCoeff_Quadrangle(order, i, xij) RESULT(ans)
INTEGER(I4B), INTENT(IN) :: order
!! order of polynomial
INTEGER(I4B), INTENT(IN) :: i
!! ith coefficients for lagrange polynomial
REAL(DFP), INTENT(IN) :: xij(:, :)
!! points in xij format, size(xij,2)
REAL(DFP) :: ans(SIZE(xij, 2))
!! coefficients
END FUNCTION LagrangeCoeff_Quadrangle
END INTERFACE
order

Order of Lagrange polynomial.

Interface 2

INTERFACE
MODULE FUNCTION LagrangeCoeff_Quadrangle(order, i, v, isVandermonde) &
& RESULT(ans)
INTEGER(I4B), INTENT(IN) :: order
!! order of polynomial, it should be SIZE(v,2)-1
INTEGER(I4B), INTENT(IN) :: i
!! coefficient for ith lagrange polynomial
REAL(DFP), INTENT(IN) :: v(:, :)
!! vandermonde matrix size should be (order+1,order+1)
LOGICAL(LGT), INTENT(IN) :: isVandermonde
!! This is just to resolve interface issue
REAL(DFP) :: ans(SIZE(v, 1))
!! coefficients
END FUNCTION LagrangeCoeff_Quadrangle
END INTERFACE

Interface 3

INTERFACE
MODULE FUNCTION LagrangeCoeff_Quadrangle(order, i, v, ipiv) RESULT(ans)
INTEGER(I4B), INTENT(IN) :: order
!! order of polynomial, it should be SIZE(x,2)-1
INTEGER(I4B), INTENT(IN) :: i
!! ith coefficients for lagrange polynomial
REAL(DFP), INTENT(INOUT) :: v(:, :)
!! LU decomposition of vandermonde matrix
INTEGER(I4B), INTENT(IN) :: ipiv(:)
!! inverse pivoting mapping, compes from LU decomposition
REAL(DFP) :: ans(SIZE(v, 1))
!! coefficients
END FUNCTION LagrangeCoeff_Quadrangle
END INTERFACE

Interface 4

INTERFACE LagrangeCoeff_Quadrangle
MODULE FUNCTION LagrangeCoeff_Quadrangle4(order, xij, basisType, &
& refQuadrangle, alpha, beta, lambda) RESULT(ans)
INTEGER(I4B), INTENT(IN) :: order
!! order of polynomial
REAL(DFP), INTENT(IN) :: xij(:, :)
!! points in xij format, size(xij,2)
INTEGER(I4B), OPTIONAL, INTENT(IN) :: basisType
!! Monomials
!! Jacobi
!! Legendre
!! Chebyshev
!! Ultraspherical
!! Heirarchical
CHARACTER(*), OPTIONAL, INTENT(IN) :: refQuadrangle
!! UNIT
!! BIUNIT
REAL(DFP), OPTIONAL, INTENT(IN) :: alpha
!! This parameter is needed when basisType is Jacobi
REAL(DFP), OPTIONAL, INTENT(IN) :: beta
!! This parameter is needed when basisType is Jacobi
REAL(DFP), OPTIONAL, INTENT(IN) :: lambda
!! This parameter is needed when basisType is Ultraspherical
REAL(DFP) :: ans(SIZE(xij, 2), SIZE(xij, 2))
!! coefficients
END FUNCTION LagrangeCoeff_Quadrangle4
END INTERFACE LagrangeCoeff_Quadrangle
order

order of polynomial

xij

interpolation points for Lagrange polynomials. The number of rows of xij should be 2 or 3. The number of columns of xij should be equal to the total number of degrees of freedom.

basisType
  • Monomials
  • Jacobi
  • Legendre
  • Chebyshev
  • Ultraspherical
  • Heirarchical
refQuadrangle

Reference Quadrangle can be UNIT or BIUNIT.

alpha, beta, lambda
  • alpha and beta are needed when basisType is Jacobi
  • lambda is needed when basisType is Ultraspherical

Interface 5

INTERFACE LagrangeCoeff_Quadrangle
MODULE FUNCTION LagrangeCoeff_Quadrangle5( &
& p, &
& q, &
& xij, &
& basisType1, &
& basisType2, &
& refQuadrangle, &
& alpha1, &
& beta1, &
& lambda1, &
& alpha2, &
& beta2, &
& lambda2) RESULT(ans)
INTEGER(I4B), INTENT(IN) :: p
!! order of polynomial in x direction
INTEGER(I4B), INTENT(IN) :: q
!! order of polynomial in y direction
REAL(DFP), INTENT(IN) :: xij(:, :)
!! points in xij format, size(xij,2)
INTEGER(I4B), INTENT(IN) :: basisType1
!! basisType in x direction
!! Monomials
!! Jacobi
!! Legendre
!! Chebyshev
!! Ultraspherical
!! Heirarchical
INTEGER(I4B), INTENT(IN) :: basisType2
!! basisType in y direction
!! Monomials
!! Jacobi
!! Legendre
!! Chebyshev
!! Ultraspherical
!! Heirarchical
CHARACTER(*), OPTIONAL, INTENT(IN) :: refQuadrangle
!! UNIT
!! BIUNIT
REAL(DFP), OPTIONAL, INTENT(IN) :: alpha1
!! This parameter is needed when basisType is Jacobi
REAL(DFP), OPTIONAL, INTENT(IN) :: beta1
!! This parameter is needed when basisType is Jacobi
REAL(DFP), OPTIONAL, INTENT(IN) :: lambda1
!! This parameter is needed when basisType is Ultraspherical
REAL(DFP), OPTIONAL, INTENT(IN) :: alpha2
!! This parameter is needed when basisType is Jacobi
REAL(DFP), OPTIONAL, INTENT(IN) :: beta2
!! This parameter is needed when basisType is Jacobi
REAL(DFP), OPTIONAL, INTENT(IN) :: lambda2
!! This parameter is needed when basisType is Ultraspherical
REAL(DFP) :: ans(SIZE(xij, 2), SIZE(xij, 2))
!! coefficients
END FUNCTION LagrangeCoeff_Quadrangle5
END INTERFACE LagrangeCoeff_Quadrangle
p, q, r

order of polynomial in x, y and z direction.

xij

interpolation points for Lagrange polynomials. The number of rows of xij should be 2 or 3. The number of columns of xij should be equal to the total number of degrees of freedom.

basisType1, basisType2

Basis type in x and y direction. They can take following values:

  • Monomials
  • Jacobi
  • Legendre
  • Chebyshev
  • Ultraspherical
  • Heirarchical
refQuadrangle

Reference Quadrangle can be UNIT or BIUNIT.

alpha1, beta1, lambda1
  • alpha1 and beta1 are needed when basisType1 is Jacobi
  • lambda1 is needed when basisType1 is Ultraspherical
alpha2, beta2, lambda2
  • alpha2 and beta2 are needed when basisType2 is Jacobi
  • lambda2 is needed when basisType2 is Ultraspherical