ProSHADE  0.6.5 (NOV 2018)
Protein Shape Descriptors and Symmetry Detection
ProSHADE_legendre.h File Reference

This file contains all the functions related to computing the Gauss-Legendre integration variables. More...

#include <iostream>
#include <cmath>
#include <vector>
#include <rvapi_interface.h>

Go to the source code of this file.

Namespaces

 ProSHADE_legendre
 This namespace contains the functions related to the Gauss-Legendre integration variables.
 

Functions

void ProSHADE_internal_legendre::getPolyAtZero (unsigned int order, double *polyValue, double *deriValue)
 This function obtains the Legendre polynomial values and its derivative at zero for any positive integer order polynomial. More...
 
double ProSHADE_internal_legendre::advancePolyValue (double from, double to, double valAtFrom, unsigned int noSteps)
 This function finds the next value of the polynomial. More...
 
double ProSHADE_internal_legendre::evaluateSeries (double *series, double target, unsigned int terms)
 This function evaluates the Taylor expansion. More...
 
void ProSHADE_internal_legendre::getFirstEvenRoot (double polyAtZero, unsigned int order, double *abscAtZero, double *weighAtZero)
 This function finds the first root for Legendre polynomials of odd order. More...
 
void ProSHADE_internal_legendre::completeLegendreSeries (unsigned int order, std::vector< double > *abscissa, std::vector< double > *weights)
 This function completes the Legendre polynomial series assuming you have obtained the first values. More...
 
void ProSHADE_internal_legendre::getLegendreAbscAndWeights (unsigned int order, std::vector< double > *abscissa, std::vector< double > *weights, ProSHADE::ProSHADE_settings *settings)
 This function takes everytging together and computes the abscissas and weights for the Gauss-Legendre integration given only the order. More...
 

Detailed Description

This file contains functions required to compute the Gauss-Legendre integration variables such as the abscissas and the weights for any integer order of integration. This code was adapted from John Burkardt's web. It is build around finding the zeroes of the Legendre polynomial of given order, expending the series and then finding the roots. These can then be used to obtain the values of interest - abscissas and weights.

This file is part of the ProSHADE library for calculating shape descriptors and symmetry operators of protein structures. This is a prototype code, which is by no means complete or fully tested. Its use is at your own risk only. There is no quarantee that the results are correct.

Code adapted from: John Burkardt (http://people.sc.fsu.edu/~jburkardt/cpp_src/legendre_rule_fast/legendre_rule_fast.html)

Author
Michal Tykac
Garib N. Murshudov
Version
0.6.5
Date
NOV 2018

Definition in file ProSHADE_legendre.h.

Function Documentation

§ advancePolyValue()

double ProSHADE_internal_legendre::advancePolyValue ( double  from,
double  to,
double  valAtFrom,
unsigned int  noSteps 
)
inline

Given the previous value of the polynomial, the distance to proceed and the number of steps to take, this function finds the next value of the polynomial using Taylor series.

Parameters
[in]fromCurrent polynomial position.
[in]toPolynomial position to move to.
[in]valAtFromThe current value of the polynomial at the <from> position.
[in]noStepsNumber of steps in which to reach the <to> position.
[out]XThe polynomial value at the <to> position.
Warning
This is an internal function which should not be used by the user.

Definition at line 95 of file ProSHADE_legendre.h.

§ completeLegendreSeries()

void ProSHADE_internal_legendre::completeLegendreSeries ( unsigned int  order,
std::vector< double > *  abscissa,
std::vector< double > *  weights 
)
inline

Given that the polynomial value at zero is known, this function will complete the Legendre polynomial and with it the absicassas and weights for the Gauss-Legendre integration using the other functions defined above.

Parameters
[in]orderThe positive integer value of the polynomial order.
[in]abscissaPointer to a vector of abscissas containing the first value.
[in]weightsPointer to a vector of weights containing the first value.
Warning
This is an internal function which should not be used by the user.

Definition at line 239 of file ProSHADE_legendre.h.

§ evaluateSeries()

double ProSHADE_internal_legendre::evaluateSeries ( double *  series,
double  target,
unsigned int  terms 
)
inline

This function takes the series array, the target value and the cap on Taylor expansion and proceeds to evaluate the series. The main use of this is to evaluate the series twice, one where the series evaluation 'overshoots' and once where it 'undershoots' and taking value in between those, thus adding accuracy.

Parameters
[in]seriesPointer to array with the series values.
[in]targetThe target location on the series value.
[in]termsThe Taylor expansion cap.
[out]XThe value of the series at the target location.
Warning
This is an internal function which should not be used by the user.

Definition at line 144 of file ProSHADE_legendre.h.

§ getFirstEvenRoot()

void ProSHADE_internal_legendre::getFirstEvenRoot ( double  polyAtZero,
unsigned int  order,
double *  abscAtZero,
double *  weighAtZero 
)
inline

The Legendre polynomials with odd order have zero as the first root, but the even oder polenomials have different value and this function serves the purpose of finding this value (i.e. the first root of the polynomial if the order is even).

Parameters
[in]polyAtZeroThe value of the polynomial at zero.
[in]orderThe positive integer value of the polynomial order.
[in]abscAtZeroPointer to variable storing the abscissa value at zero.
[in]weightAtZeroPointer to variable storing the weight value at zero.
Warning
This is an internal function which should not be used by the user.

Definition at line 176 of file ProSHADE_legendre.h.

§ getLegendreAbscAndWeights()

void ProSHADE_internal_legendre::getLegendreAbscAndWeights ( unsigned int  order,
std::vector< double > *  abscissa,
std::vector< double > *  weights,
ProSHADE::ProSHADE_settings settings 
)
inline

For the comfort of usage, this function takes everything together and computes the abscissas and weights for the Gauss-Legendre integration by first finding the polynomial value at zero, then finding the root and completing the series.

Parameters
[in]orderThe positive integer value of the polynomial order required.
[in]abscissaPointer to a vector where abscissas will be saved.
[in]weightsPointer to a vector where weights will be saved.
[in]settingsProSHADE_settings container with infotmation about HTML reporting.
Warning
This is an internal function which should not be used by the user.

Definition at line 337 of file ProSHADE_legendre.h.

§ getPolyAtZero()

void ProSHADE_internal_legendre::getPolyAtZero ( unsigned int  order,
double *  polyValue,
double *  deriValue 
)
inline

This function takes the positive integer order of the Legendre polynomial and uses the recursive properties of the polynomials to work up to the order, computing the value at zero and its derivative for all lesser orders. It then returns the final values.

Parameters
[in]orderPositive integer order of the Legendre polynomial which value at zero we want.
[in]polyValuePointer to variable which will store the resulting polynomial value at zero.
[in]deriValuePointer to variable which will store the derivative of the zero value.
Warning
This is an internal function which should not be used by the user.

Definition at line 55 of file ProSHADE_legendre.h.