Skip to content

Commit 9b2a8b1

Browse files
committed
chore: clean-up descriptions and style
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent a77644a commit 9b2a8b1

File tree

4 files changed

+19
-23
lines changed

4 files changed

+19
-23
lines changed

lib/node_modules/@stdlib/math/base/special/gammainc/include/stdlib/math/base/special/gammainc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extern "C" {
2929
#endif
3030

3131
/**
32-
* Computes the incomplete gamma function. The upper tail is calculated via the modified Lentz's method for computing continued fractions, the lower tail using a power expansion.
32+
* Computes the incomplete gamma function.
3333
*/
3434
double stdlib_base_gammainc( const double x, const double a, const bool regularized, const bool upper );
3535

lib/node_modules/@stdlib/math/base/special/gammainc/lib/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,11 @@ var upperGammaFraction = require( './upper_gamma_fraction.js' );
6262
// MAIN //
6363

6464
/**
65-
* Computes the regularized incomplete gamma function. The upper tail is calculated via the modified Lentz's method for computing continued fractions, the lower tail using a power expansion.
65+
* Computes the regularized incomplete gamma function.
6666
*
6767
* ## Notes
6868
*
69+
* - The upper tail is calculated via the modified Lentz's method for computing continued fractions, the lower tail using a power expansion.
6970
* - When `a >= FLOAT64_MAX_NTH_FACTORIAL` and computing the non-normalized incomplete gamma, result is rather hard to compute unless we use logs. There are really two options a) if `x` is a long way from `a` in value then we can reliably use methods 2 and 4 below in logarithmic form and go straight to the result. Otherwise we let the regularized gamma take the strain (the result is unlikely to underflow in the central region anyway) and combine with `lgamma` in the hopes that we get a finite result.
7071
*
7172
* @param {NonNegativeNumber} x - function parameter

lib/node_modules/@stdlib/math/base/special/gammainc/lib/native.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var addon = require( './../src/addon.node' );
2626
// MAIN //
2727

2828
/**
29-
* Computes the incomplete gamma function. The upper tail is calculated via the modified Lentz's method for computing continued fractions, the lower tail using a power expansion.
29+
* Computes the incomplete gamma function.
3030
*
3131
* @private
3232
* @param {NonNegativeNumber} x - function parameter

lib/node_modules/@stdlib/math/base/special/gammainc/src/main.c

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ static double lowerGammaSeries( const double a, const double z, const double ini
409409
}
410410

411411
/**
412-
* Calculates normalized Q when a is an integer.
412+
* Calculates normalized `Q` when `a` is an integer.
413413
*
414414
* @param a function parameter
415415
* @param x function parameter
@@ -435,7 +435,7 @@ static double finiteGammaQ( const double a, const double x ) {
435435
}
436436

437437
/**
438-
* Calculates normalized Q when a is a half-integer.
438+
* Calculates normalized `Q` when `a` is a half-integer.
439439
*
440440
* @param a function parameter
441441
* @param x function parameter
@@ -489,7 +489,7 @@ static double regularisedGammaPrefix( const double a, const double z ) {
489489
// Use logs, so should be free of cancellation errors:
490490
return stdlib_base_exp( ( a * stdlib_base_ln(z) ) - z - stdlib_base_gammaln( a ) );
491491
}
492-
// No danger of overflow as gamma(a) < 1/a for small a, so direct calculation:
492+
// No danger of overflow as `gamma(a) < 1/a` for small `a`, so direct calculation:
493493
return stdlib_base_pow( z, a ) * stdlib_base_exp( -z ) / stdlib_base_gamma( a );
494494
}
495495
if ( stdlib_base_abs(d*d*a) <= 100.0 && a > 150.0 ) {
@@ -513,8 +513,7 @@ static double regularisedGammaPrefix( const double a, const double z ) {
513513
// Compute square root of the result and then square it:
514514
sq = stdlib_base_pow( z / agh, a / 2.0 ) * stdlib_base_exp( amz / 2.0 );
515515
prefix = sq * sq;
516-
}
517-
else if (
516+
} else if (
518517
stdlib_base_min(alz, amz)/4.0 > MIN_LN &&
519518
stdlib_base_max(alz, amz)/4.0 < MAX_LN &&
520519
z > a
@@ -523,19 +522,15 @@ static double regularisedGammaPrefix( const double a, const double z ) {
523522
sq = stdlib_base_pow( z / agh, a / 4.0 ) * stdlib_base_exp( amz / 4.0 );
524523
prefix = sq * sq;
525524
prefix *= prefix;
526-
}
527-
else if (
525+
} else if (
528526
amza > MIN_LN &&
529527
amza < MAX_LN
530528
) {
531529
prefix = stdlib_base_pow( (z * stdlib_base_exp(amza)) / agh, a );
532-
}
533-
else {
530+
} else {
534531
prefix = stdlib_base_exp( alz + amz );
535532
}
536-
}
537-
else
538-
{
533+
} else {
539534
prefix = stdlib_base_pow( z / agh, a ) * stdlib_base_exp( amz );
540535
}
541536
}
@@ -560,8 +555,7 @@ static double fullIGammaPrefix( const double a, const double z ) {
560555
prefix = stdlib_base_pow( z, a ) * stdlib_base_exp( -z );
561556
} else if ( a >= 1.0 ) {
562557
prefix = stdlib_base_pow( z / stdlib_base_exp(z/a), a );
563-
}
564-
else {
558+
} else {
565559
prefix = stdlib_base_exp( alz - z );
566560
}
567561
}
@@ -717,7 +711,7 @@ static double tgammaILargeX( const double a, const double x ) {
717711
}
718712

719713
/**
720-
* Evaluates a polynomial using double-precision floating-point arithmetic.
714+
* Evaluates a polynomial.
721715
*
722716
* ## Notes
723717
*
@@ -797,7 +791,7 @@ static double igammaTemmeLarge( const double a, const double x ) {
797791
* @param upper boolean indicating if the function should return the upper tail of the incomplete gamma function
798792
* @return function value
799793
*/
800-
double igammaFinal( const double a, const double x, const bool regularized, const bool upper ) {
794+
static double igammaFinal( const double a, const double x, const bool regularized, const bool upper ) {
801795
bool optimisedInvert;
802796
int32_t evalMethod;
803797
double initValue;
@@ -829,7 +823,7 @@ double igammaFinal( const double a, const double x, const bool regularized, cons
829823
invert = !invert;
830824
evalMethod = 0;
831825
} else if ( isHalfInt && x > 0.2 ) {
832-
// Calculate Q via finite sum for half integer a:
826+
// Calculate Q via finite sum for half integer `a`:
833827
invert = !invert;
834828
evalMethod = 1;
835829
} else if ( x < SQRT_EPS && a > 1.0 ) {
@@ -957,14 +951,14 @@ double igammaFinal( const double a, const double x, const bool regularized, cons
957951
}
958952
break;
959953
case 6:
960-
// Since x is so small that P is necessarily very small too, use http://functions.wolfram.com/GammaBetaErf/GammaRegularized/06/01/05/01/01/
954+
// Since `x` is so small that P is necessarily very small too, use http://functions.wolfram.com/GammaBetaErf/GammaRegularized/06/01/05/01/01/
961955
result = ( regularized ) ?
962956
stdlib_base_pow(x, a) / stdlib_base_gamma( a + 1.0 ) :
963957
stdlib_base_pow( x, a ) / a;
964958
result *= 1.0 - ( a * x / ( a + 1.0 ) );
965959
break;
966960
case 7:
967-
// x is large, so compute Q:
961+
// `x` is large, so compute Q:
968962
result = ( regularized ) ?
969963
regularisedGammaPrefix( a, x ) :
970964
fullIGammaPrefix( a, x );
@@ -985,10 +979,11 @@ double igammaFinal( const double a, const double x, const bool regularized, cons
985979
}
986980

987981
/**
988-
* Computes the incomplete gamma function. The upper tail is calculated via the modified Lentz's method for computing continued fractions, the lower tail using a power expansion.
982+
* Computes the incomplete gamma function.
989983
*
990984
* ## Notes
991985
*
986+
* - The upper tail is calculated via the modified Lentz's method for computing continued fractions, the lower tail using a power expansion.
992987
* - When `a >= FLOAT64_MAX_NTH_FACTORIAL` and computing the non-normalized incomplete gamma, result is rather hard to compute unless we use logs. There are really two options a) if `x` is a long way from `a` in value then we can reliably use methods 2 and 4 below in logarithmic form and go straight to the result. Otherwise we let the regularized gamma take the strain (the result is unlikely to underflow in the central region anyway) and combine with `lgamma` in the hopes that we get a finite result.
993988
*
994989
* @param x function parameter

0 commit comments

Comments
 (0)