This file implements Gauss-Jacobi quadrature related functions. More...
#include <math.h>#include <stdlib.h>#include <stdio.h>#include <gsl/gsl_math.h>#include <gsl/gsl_errno.h>#include <gsl/gsl_sf_gamma.h>#include "jacobi.h"#include <gsl/gsl_sf_result.h>Defines | |
| #define | EPS 300*GSL_DBL_EPSILON |
| Admissible convergence error. | |
Functions | |
| int | jac_zeros_gj (double *z, const int Q, double alpha, double beta) |
| Calculates the Gauss-Jacobi quadrature points. | |
| int | jac_weights_gj (double *z, double *w, const int Q, const double alpha, const double beta, double *ws) |
| Calculates the Gauss-Jacobi quadrature weights. | |
| int | jac_diffmat_gj (double *z, double *D, const int Q, double alpha, double beta, double *ws) |
| Calculates the Gauss-Jacobi Derivative matrix. | |
| double | jac_lagrange_gj (int i, double zz, int Q, double *z, double alpha, double beta) |
| Calculates the Lagrange polynomials through Gauss-Jacobi Quadratures. | |
| int | jac_zeros_glj (double *z, const int Q, double alpha, double beta) |
| Calculates the Gauss-Lobatto-Jacobi quadrature points. | |
| int | jac_weights_glj (double *z, double *w, const int Q, double alpha, double beta, double *ws) |
| Calculates the Gauss-Lobatto-Jacobi quadrature weights. | |
| int | jac_diffmat_glj (double *z, double *D, const int Q, double alpha, double beta, double *ws) |
| Calculates the Gauss-Lobatto-Jacobi Derivative matrix. | |
| double | jac_lagrange_glj (int i, double zz, int Q, double *z, double alpha, double beta) |
| Calculates the Lagrange polynomials through Gauss-Lobatto-Jacobi Quadratures. | |
| int | jac_zeros_grjm (double *z, const int Q, double alpha, double beta) |
| Calculates the Gauss-Radau-Jacobi quadrature points (point -1 included). | |
| int | jac_weights_grjm (double *z, double *w, const int Q, double alpha, double beta, double *ws) |
| Calculates the Gauss-Radau-Jacobi quadrature weights (point -1 included). | |
| int | jac_diffmat_grjm (double *z, double *D, const int Q, double alpha, double beta, double *ws) |
| Calculates the Gauss-Radau-Jacobi Derivative matrix (point -1 included). | |
| double | jac_lagrange_grjm (int i, double zz, int Q, double *z, double alpha, double beta) |
| Calculates the Lagrange polynomials through Gauss-Radau-Jacobi Quadratures (point -1 included). | |
| int | jac_zeros_grjp (double *z, const int Q, double alpha, double beta) |
| Calculates the Gauss-Radau-Jacobi quadrature points (point +1 included). | |
| int | jac_weights_grjp (double *z, double *w, const int Q, double alpha, double beta, double *ws) |
| Calculates the Gauss-Radau-Jacobi quadrature weights (point +1 included). | |
| int | jac_diffmat_grjp (double *z, double *D, const int Q, double alpha, double beta, double *ws) |
| Calculates the Gauss-Radau-Jacobi Derivative matrix (point +1 included). | |
| double | jac_lagrange_grjp (int i, double zz, int Q, double *z, double alpha, double beta) |
| Calculates the Lagrange polynomials through Gauss-Radau-Jacobi Quadratures (point +1 included). | |
| int | jac_interpmat_gj (double *imat, double *zp, int np, double *z, int Q, double alpha, double beta) |
| Calculates the interpolation matrix for GJ quadrature. | |
| int | jac_interpmat_glj (double *imat, double *zp, int np, double *z, int Q, double alpha, double beta) |
| Calculates the interpolation matrix for GLJ quadrature. | |
| int | jac_interpmat_grjm (double *imat, double *zp, int np, double *z, int Q, double alpha, double beta) |
| Calculates the interpolation matrix for GRJM quadrature. | |
| int | jac_interpmat_grjp (double *imat, double *zp, int np, double *z, int Q, double alpha, double beta) |
| Calculates the interpolation matrix for GRJP quadrature. | |
This file implements Gauss-Jacobi quadrature related functions.
This library implements 4 types of quadrature
| int jac_diffmat_gj | ( | double * | z, | |
| double * | D, | |||
| const int | Q, | |||
| double | alpha, | |||
| double | beta, | |||
| double * | ws | |||
| ) |
Calculates the Gauss-Jacobi Derivative matrix.
Calculates the derivative matrix for Gauss-Jacobi quadrature. The matrix should be preallocated, using a vector with Q*Q doubles This function calculates
| z | Quadrature nodes. | |
| D | Derivative matrix, a vector with Q*Q doubles | |
| Q | Number of quadrature nodes | |
| alpha | parameter of Jacobi polynomial | |
| beta | parameter of Jacobi polynomial | |
| ws | Workspace with at least 3*Q doubles. If it is null, the memory will be allocated with malloc and at the end released. |
References jac_djacobi_array().
Referenced by jac_quadrature_zwd().
| int jac_diffmat_glj | ( | double * | z, | |
| double * | D, | |||
| const int | Q, | |||
| double | alpha, | |||
| double | beta, | |||
| double * | ws | |||
| ) |
Calculates the Gauss-Lobatto-Jacobi Derivative matrix.
Calculates the derivative matrix for Gauss-Lobatto-Jacobi quadrature. The matrix should be preallocated, using a vector with Q*Q doubles This function calculates
| z | Quadrature nodes | |
| D | Derivative matrix, a vector with Q*Q doubles | |
| Q | Number of quadrature nodes | |
| alpha | parameter of Jacobi polynomial | |
| beta | parameter of Jacobi polynomial | |
| ws | Workspace with 3*Q doubles. If it is null, the memory will be allocated with malloc |
References jac_djacobi_array().
Referenced by jac_quadrature_zwd().
| int jac_diffmat_grjm | ( | double * | z, | |
| double * | D, | |||
| const int | Q, | |||
| double | alpha, | |||
| double | beta, | |||
| double * | ws | |||
| ) |
Calculates the Gauss-Radau-Jacobi Derivative matrix (point -1 included).
Calculates the derivative matrix for Gauss-Radau-Jacobi quadrature including the end point -1. The matrix should be preallocated, using a vector with Q*Q doubles This function calculates
| z | Quadrature nodes | |
| D | Derivative matrix, a vector with Q*Q doubles | |
| Q | Number of quadrature nodes | |
| alpha | parameter of Jacobi polynomial | |
| beta | parameter of Jacobi polynomial | |
| ws | Workspace with 3*Q doubles. If it is null, the memory will be allocated with malloc |
References jac_djacobi_array().
Referenced by jac_quadrature_zwd().
| int jac_diffmat_grjp | ( | double * | z, | |
| double * | D, | |||
| const int | Q, | |||
| double | alpha, | |||
| double | beta, | |||
| double * | ws | |||
| ) |
Calculates the Gauss-Radau-Jacobi Derivative matrix (point +1 included).
Calculates the derivative matrix for Gauss-Radau-Jacobi quadrature including the end point +1. The matrix should be preallocated, using a vector with Q*Q doubles This function calculates
| z | Quadrature nodes | |
| D | Derivative matrix, a vector with Q*Q doubles | |
| Q | Number of quadrature nodes | |
| alpha | parameter of Jacobi polynomial | |
| beta | parameter of Jacobi polynomial | |
| ws | Workspace with 3*Q doubles. If it is null, the memory will be allocated with malloc |
References jac_djacobi_array().
Referenced by jac_quadrature_zwd().
| int jac_interpmat_gj | ( | double * | imat, | |
| double * | zp, | |||
| int | np, | |||
| double * | z, | |||
| int | Q, | |||
| double | alpha, | |||
| double | beta | |||
| ) |
Calculates the interpolation matrix for GJ quadrature.
This function calculates the interpolation matrix for Gauss-Jacobi quadrature. The interpolation matrix is simply the value of the Lagrange polynomials for each point where the function should be interpolated, for each Lagrange polynomial:
| imat | A vector np*Q long that will store the interpolation matrix | |
| zp | The points where the function should be interpolated | |
| np | Number of points where the function should be interpolated | |
| z | Quadrature points | |
| Q | Number of quadrature points | |
| alpha | parameter of Jacobi polynomial | |
| beta | parameter of Jacobi polynomial |
References jac_lagrange_gj().
Referenced by jac_interpmat_alloc().
| int jac_interpmat_glj | ( | double * | imat, | |
| double * | zp, | |||
| int | np, | |||
| double * | z, | |||
| int | Q, | |||
| double | alpha, | |||
| double | beta | |||
| ) |
Calculates the interpolation matrix for GLJ quadrature.
This function calculates the interpolation matrix for Gauss-Lobatto-Jacobi quadrature. The interpolation matrix is simply the value of the Lagrange polynomials for each point where the function should be interpolated, for each Lagrange polynomial:
| imat | A vector np*Q long that will store the interpolation matrix | |
| zp | The points where the function should be interpolated | |
| np | Number of points where the function should be interpolated | |
| z | Quadrature points | |
| Q | Number of quadrature points | |
| alpha | parameter of Jacobi polynomial | |
| beta | parameter of Jacobi polynomial |
References jac_lagrange_glj().
Referenced by jac_interpmat_alloc().
| int jac_interpmat_grjm | ( | double * | imat, | |
| double * | zp, | |||
| int | np, | |||
| double * | z, | |||
| int | Q, | |||
| double | alpha, | |||
| double | beta | |||
| ) |
Calculates the interpolation matrix for GRJM quadrature.
This function calculates the interpolation matrix for Gauss-Radau-Jacobi (including end point -1) quadrature. The interpolation matrix is simply the value of the Lagrange polynomials for each point where the function should be interpolated, for each Lagrange polynomial:
| imat | A vector np*Q long that will store the interpolation matrix | |
| zp | The points where the function should be interpolated | |
| np | Number of points where the function should be interpolated | |
| z | Quadrature points | |
| Q | Number of quadrature points | |
| alpha | parameter of Jacobi polynomial | |
| beta | parameter of Jacobi polynomial |
References jac_lagrange_grjm().
Referenced by jac_interpmat_alloc().
| int jac_interpmat_grjp | ( | double * | imat, | |
| double * | zp, | |||
| int | np, | |||
| double * | z, | |||
| int | Q, | |||
| double | alpha, | |||
| double | beta | |||
| ) |
Calculates the interpolation matrix for GRJP quadrature.
This function calculates the interpolation matrix for Gauss-Radau-Jacobi (including end point +1) quadrature. The interpolation matrix is simply the value of the Lagrange polynomials for each point where the function should be interpolated, for each Lagrange polynomial:
| imat | A vector np*Q long that will store the interpolation matrix | |
| zp | The points where the function should be interpolated | |
| np | Number of points where the function should be interpolated | |
| z | Quadrature points | |
| Q | Number of quadrature points | |
| alpha | parameter of Jacobi polynomial | |
| beta | parameter of Jacobi polynomial |
References jac_lagrange_grjp().
Referenced by jac_interpmat_alloc().
| double jac_lagrange_gj | ( | int | i, | |
| double | zz, | |||
| int | Q, | |||
| double * | z, | |||
| double | alpha, | |||
| double | beta | |||
| ) |
Calculates the Lagrange polynomials through Gauss-Jacobi Quadratures.
This function calculates the ith Gauss-Jacobi lagrange interpolants at a point zz:
| i | The reference node of the Lagrange polynomial | |
| zz | The point where the Lagrange polynomial should be calculated | |
| Q | Number of quadrature nodes | |
| z | The quadrature nodes | |
| alpha | parameter of Jacobi polynomial | |
| beta | parameter of Jacobi polynomial |
References EPS, jac_djacobi(), and jac_jacobi().
Referenced by jac_interpmat_gj().
| double jac_lagrange_glj | ( | int | i, | |
| double | zz, | |||
| int | Q, | |||
| double * | z, | |||
| double | alpha, | |||
| double | beta | |||
| ) |
Calculates the Lagrange polynomials through Gauss-Lobatto-Jacobi Quadratures.
This function calculates the ith Gauss-Lobatto-Jacobi lagrange interpolants at a point zz:
| i | The reference node of the Lagrange polynomial | |
| zz | The point where the Lagrange polynomial should be calculated | |
| Q | Number of quadrature nodes | |
| z | The quadrature nodes | |
| alpha | parameter of Jacobi polynomial | |
| beta | parameter of Jacobi polynomial |
References EPS, jac_djacobi(), and jac_jacobi().
Referenced by jac_interpmat_glj().
| double jac_lagrange_grjm | ( | int | i, | |
| double | zz, | |||
| int | Q, | |||
| double * | z, | |||
| double | alpha, | |||
| double | beta | |||
| ) |
Calculates the Lagrange polynomials through Gauss-Radau-Jacobi Quadratures (point -1 included).
This function calculates the ith Gauss-Radau-Jacobi (including end point -1) Lagrange interpolants at a point zz:
| i | The reference node of the Lagrange polynomial | |
| zz | The point where the Lagrange polynomial should be calculated | |
| Q | Number of quadrature nodes | |
| z | The quadrature nodes | |
| alpha | parameter of Jacobi polynomial | |
| beta | parameter of Jacobi polynomial |
References EPS, jac_djacobi(), and jac_jacobi().
Referenced by jac_interpmat_grjm().
| double jac_lagrange_grjp | ( | int | i, | |
| double | zz, | |||
| int | Q, | |||
| double * | z, | |||
| double | alpha, | |||
| double | beta | |||
| ) |
Calculates the Lagrange polynomials through Gauss-Radau-Jacobi Quadratures (point +1 included).
This function calculates the ith Gauss-Radau-Jacobi (including end point +1) Lagrange interpolants at a point zz:
| i | The reference node of the Lagrange polynomial | |
| zz | The point where the Lagrange polynomial should be calculated | |
| Q | Number of quadrature nodes | |
| z | The quadrature nodes | |
| alpha | parameter of Jacobi polynomial | |
| beta | parameter of Jacobi polynomial |
References EPS, jac_djacobi(), and jac_jacobi().
Referenced by jac_interpmat_grjp().
| int jac_weights_gj | ( | double * | z, | |
| double * | w, | |||
| const int | Q, | |||
| const double | alpha, | |||
| const double | beta, | |||
| double * | ws | |||
| ) |
Calculates the Gauss-Jacobi quadrature weights.
Calculates the Quadrature weights for Gauss-Jacobi integration.
| z | Quadrature nodes | |
| w | Array containing the quadrature weights | |
| Q | Number of quadrature nodes | |
| alpha | parameter of Jacobi polynomial | |
| beta | parameter of Jacobi polynomial | |
| ws | Workspace with room for 2*Q doubles. If it is null, the memory will be allocated with malloc and at the end released |
References jac_djacobi_array().
Referenced by GaussJacobiRule(), and jac_quadrature_zwd().
| int jac_weights_glj | ( | double * | z, | |
| double * | w, | |||
| const int | Q, | |||
| double | alpha, | |||
| double | beta, | |||
| double * | ws | |||
| ) |
Calculates the Gauss-Lobatto-Jacobi quadrature weights.
Calculates the Quadrature weights for Gauss-Lobatto-Jacobi integration.
| z | Quadrature nodes | |
| w | Array containing the quadrature weights | |
| Q | Number of quadrature nodes | |
| alpha | parameter of Jacobi polynomial | |
| beta | parameter of Jacobi polynomial | |
| ws | Workspace with 2*Q doubles. If it is null, the memory will be allocated with malloc |
References jac_jacobi_array().
Referenced by jac_quadrature_zwd().
| int jac_weights_grjm | ( | double * | z, | |
| double * | w, | |||
| const int | Q, | |||
| double | alpha, | |||
| double | beta, | |||
| double * | ws | |||
| ) |
Calculates the Gauss-Radau-Jacobi quadrature weights (point -1 included).
Calculates the Quadrature weights for Gauss-Radau-Jacobi quadrature including point -1
| z | Quadrature nodes | |
| w | Array containing the quadrature weights | |
| Q | Number of quadrature nodes | |
| alpha | parameter of Jacobi polynomial | |
| beta | parameter of Jacobi polynomial | |
| ws | Workspace with 2*Q doubles. If it is null, the memory will be allocated with malloc and at the ens released |
References jac_jacobi_array().
Referenced by jac_quadrature_zwd().
| int jac_weights_grjp | ( | double * | z, | |
| double * | w, | |||
| const int | Q, | |||
| double | alpha, | |||
| double | beta, | |||
| double * | ws | |||
| ) |
Calculates the Gauss-Radau-Jacobi quadrature weights (point +1 included).
Calculates the Quadrature weights for Gauss-Radau-Jacobi quadrature including point +1
| z | Quadrature nodes | |
| w | Array containing the quadrature weights | |
| Q | Number of quadrature nodes | |
| alpha | parameter of Jacobi polynomial | |
| beta | parameter of Jacobi polynomial | |
| ws | Workspace with 2*Q doubles. If it is null, the memory will be allocated with malloc |
References jac_jacobi_array().
Referenced by jac_quadrature_zwd().
| int jac_zeros_gj | ( | double * | z, | |
| const int | Q, | |||
| double | alpha, | |||
| double | beta | |||
| ) |
Calculates the Gauss-Jacobi quadrature points.
Finds the zeros of Gauss-Jacobi quadrature
It computes the following equation
| z | A double pointer to an array used to store the values of the zeros | |
| Q | Number of quadrature points | |
| alpha | parameter of Jacobi polynomial | |
| beta | parameter of Jacobi polynomial |
References jac_jacobi_zeros().
Referenced by GaussJacobiRule(), and jac_quadrature_zwd().
| int jac_zeros_glj | ( | double * | z, | |
| const int | Q, | |||
| double | alpha, | |||
| double | beta | |||
| ) |
Calculates the Gauss-Lobatto-Jacobi quadrature points.
Finds the zeros of Gauss-Lobatto-Jacobi quadrature
This quadrature includes the endpoints (-1, 1). The other quadrature nodes are given by the zeros of
| z | A double pointer to an array used to store the values of the zeros | |
| Q | Number of quadrature points | |
| alpha | parameter of Jacobi polynomial | |
| beta | parameter of Jacobi polynomial |
References jac_jacobi_zeros().
Referenced by jac_quadrature_zwd().
| int jac_zeros_grjm | ( | double * | z, | |
| const int | Q, | |||
| double | alpha, | |||
| double | beta | |||
| ) |
Calculates the Gauss-Radau-Jacobi quadrature points (point -1 included).
Finds the zeros of Gauss-Radau-Jacobi quadrature
This quadrature includes the endpoint -1. The other quadrature nodes are given by the zeros of
| z | A double pointer to an array used to store the values of the zeros | |
| Q | Number of quadrature points | |
| alpha | parameter of Jacobi polynomial | |
| beta | parameter of Jacobi polynomial |
References jac_jacobi_zeros().
Referenced by jac_quadrature_zwd().
| int jac_zeros_grjp | ( | double * | z, | |
| const int | Q, | |||
| double | alpha, | |||
| double | beta | |||
| ) |
Calculates the Gauss-Radau-Jacobi quadrature points (point +1 included).
Finds the zeros of Gauss-Radau-Jacobi quadrature
This quadrature includes the endpoint 1. The other quadrature nodes are given by the zeros of
| z | A double pointer to an array used to store the values of the zeros | |
| Q | Number of quadrature points | |
| alpha | parameter of Jacobi polynomial | |
| beta | parameter of Jacobi polynomial |
References jac_jacobi_zeros().
Referenced by jac_quadrature_zwd().
1.6.3