mathematical
Mathematical tools for Python 📐 🐍 🛠️
Includes tools for calculating mean, median and standard deviation of rows in data frames, detection of outliers, and statistical calculations
Docs |
|
---|---|
Tests |
|
PyPI |
|
Anaconda |
|
Activity |
|
QA |
|
Other |
Installation
python3 -m pip install mathematical --user
First add the required channels
conda config --add channels https://conda.anaconda.org/conda-forge
conda config --add channels https://conda.anaconda.org/domdfcoding
Then install
conda install mathematical
python3 -m pip install git+https://github.com/domdfcoding/mathematical@master --user
Contents
mathematical.data_frames
Mathematical operations for Data Frames
.
Data:
Type hint for the |
Functions:
|
Count the number of occurrences of a non-NaN value in the specified columns of a |
|
Compile the values for the specified columns in each row into a list. |
|
Calculate the difference between values in the two columns for each row of a |
|
Calculate the relative difference between values in the two columns for each row of a |
|
Calculate the logarithm of the values in each row for the specified columns of a |
|
Calculate the standard deviation of the log10 values in each row for the specified columns of a |
|
Calculate the mean of each row for the specified columns of a |
|
Calculate the median of each row for the specified columns of a |
|
Identify outliers in each row. |
|
Returns the value of the specified column as a percentage of the given total. |
|
Calculate the standard deviation of each row for the specified columns of a |
|
Set the display options for numpy and pandas. |
-
ColumnLabelList
Type hint for the
column_label_list
parameter in thedf_*()
functions.
-
df_count
(row, column_label_list=None)[source] Count the number of occurrences of a non-NaN value in the specified columns of a
data frame
.Do not call this function directly; use it with
df.apply()
instead:data_frame["Count"] = data_frame.apply( func=df_count, args=[["Bob", "Alice"]], axis=1, )
-
df_data_points
(row, column_label_list)[source] Compile the values for the specified columns in each row into a list.
Do not call this function directly; use it with
df.apply()
instead:data_frame["Data Points"] = data_frame.apply( func=df_data_points, args=[["Bob", "Alice"]], axis=1, )
-
df_delta
(row, left_column, right_column)[source] Calculate the difference between values in the two columns for each row of a
data frame
.Do not call this function directly; use it with
df.apply()
instead:data_frame["Delta"] = data_frame.apply( func=df_delta, args=["Bob", "Alice"], axis=1, )
- Parameters
- Return type
- Returns
The difference between
left_column
andright_column
.
New in version 0.4.0.
-
df_delta_relative
(row, left_column, right_column)[source] Calculate the relative difference between values in the two columns for each row of a
data frame
:(left - right) / right
Do not call this function directly; use it with
df.apply()
instead:data_frame["Rel. Delta"] = data_frame.apply( func=df_delta_relative, args=["Bob", "Alice"], axis=1, )
- Parameters
- Return type
- Returns
The relative difference between
left_column
andright_column
.
New in version 0.4.0.
-
df_log
(row, column_label_list, base=10)[source] Calculate the logarithm of the values in each row for the specified columns of a
data frame
.Do not call this function directly; use it with
df.apply()
instead:data_frame["Bob Log10"] = data_frame.apply( func=df_log, args=[["Bob"], 10], axis=1, )
-
df_log_stdev
(row, column_label_list=None)[source] Calculate the standard deviation of the log10 values in each row for the specified columns of a
data frame
.Do not call this function directly; use it with
df.apply()
instead:data_frame["Log Stdev"] = data_frame.apply( func=df_log_stdev, args=[["Bob", "Alice"]], axis=1, )
-
df_mean
(row, column_label_list=None)[source] Calculate the mean of each row for the specified columns of a
data frame
.Do not call this function directly; use it with
df.apply()
instead:data_frame["Mean"] = data_frame.apply( func=df_mean, args=[["Bob", "Alice"]], axis=1, )
-
df_median
(row, column_label_list=None)[source] Calculate the median of each row for the specified columns of a
data frame
.Do not call this function directly; use it with
df.apply()
instead:data_frame["Median"] = data_frame.apply( func=df_median, args=[["Bob", "Alice"]], axis=1, )
-
df_outliers
(row, column_label_list=None, outlier_mode=1)[source] Identify outliers in each row.
This function only returns the list of outliers (if any). If you want the list of values without the outliers see the functions in
mathematical.outliers
.Do not call this function directly; use it with
df.apply()
instead:data_frame["Outliers"] = data_frame.apply( func=df_outliers, args=[["Bob", "Alice"]], axis=1, )
- Parameters
The supported outlier modes are:
1
or :py:data`mathematical.data_frames.MAD` – Use the Median Absolute Deviation2
or :py:data`mathematical.data_frames.QUARTILES` – Treat values more than3×
the inter-quartile range away from the upper or lower quartile as outliers.3
or :py:data`mathematical.data_frames.STDEV2` – Treat values more thanrng × stdev
away from mean as outliers
- Return type
- Returns
The outliers.
-
df_percentage
(row, column_label, total)[source] Returns the value of the specified column as a percentage of the given total.
The total is usually the sum of the specified column.
Do not call this function directly; use it with
df.apply()
instead:data_frame["Bob Percentage"] = data_frame.apply( func=df_percentage, args=[13, "Bob"], axis=1, )
-
df_stdev
(row, column_label_list=None)[source] Calculate the standard deviation of each row for the specified columns of a
data frame
.Do not call this function directly; use it with
df.apply()
instead:data_frame["Stdev"] = data_frame.apply( func=df_stdev, args=[["Bob", "Alice"]], axis=1, )
-
set_display_options
(desired_width=300, max_columns=15, max_rows=20)[source] Set the display options for numpy and pandas.
- Parameters
desired_width (
int
) – The desired maximum output width, in characters. Default300
.max_columns (
int
) – The maximum number of columns to display in apandas.DataFrame
. Default15
.max_rows (
int
) – The maximum number of rows to display in apandas.DataFrame
. Default20
.
New in version 0.3.0.
mathematical.linear_regression
Functions for performing linear regression.
Data:
Type hint for arguments that take either a sequence of floats or a numpy array. |
Functions:
|
Calculate coefficients of a linear regression y = a * x + b. |
|
Calculate coefficients of a linear regression y = a * x + b. |
-
ArrayLike_Float
Type hint for arguments that take either a sequence of floats or a numpy array.
-
linear_regression_perpendicular
(x, y=None)[source] Calculate coefficients of a linear regression y = a * x + b. The fit minimizes perpendicular distances between the points and the line.
- Parameters
If y is omitted, x must be a 2-D array of shape (N, 2).
-
linear_regression_vertical
(x, y=None, a=None, b=None)[source] Calculate coefficients of a linear regression y = a * x + b. The fit minimizes vertical distances between the points and the line.
- Parameters
If y is omitted, x must be a 2-D array of shape (N, 2).
mathematical.outliers
Outlier detection functions.
Functions:
|
Identifies outlier values using the Median Absolute Deviation. |
|
Identifies outlier values that are more than |
|
Identifies outlier values using the IBM SPSS method. |
|
Identifies outlier values that are greater than |
|
Identifies outlier values that are greater than |
-
mad_outliers
(dataset, strip_zero=True, threshold=3)[source] Identifies outlier values using the Median Absolute Deviation.
- Parameters
dataset (
Sequence
)threshold (
int
) –The multiple of MAD above which values are considered to be outliers. Default
3
.Leys et al. (2013) make the following recommendations:
In univariate statistics, the Median Absolute Deviation is the most robust dispersion/scale measure in presence of outliers, and hence we strongly recommend the median plus or minus 2.5 times the MAD method for outlier detection.
The threshold should be justified and the justification should clearly state that other concerns than cherry-picking degrees of freedom guided the selection. By default, we suggest a threshold of 2.5 as a reasonable choice.
We encourage researchers to report information about outliers, namely: the number of outliers removed and their value (or at least the distance between outliers and the selected threshold)
- Return type
- Returns
A list of the outlier values, and the remaining data points.
-
quartile_outliers
(dataset, strip_zero=True)[source] Identifies outlier values that are more than
3×
the inter-quartile range from the upper or lower quartile.
-
spss_outliers
(dataset, strip_zero=True, mode='all')[source] Identifies outlier values using the IBM SPSS method.
Outlier values are more than
1.5 × IQR
fromQ1
orQ3
.“Extreme values” are more than
3 × IQR
fromQ1
orQ3
.
mathematical.stats
Functions for calculating statistics.
Functions:
|
Compute the absolute deviations from the median of the data along the given axis. |
|
Compute the absolute deviation from the median of each point in the data along the given axis, given in terms of the MAD. |
|
Calculates and returns Cohen’s effect size index d. |
|
Application of Durlak’s bias correction to the Hedge’s g statistic. |
|
Calculates and returns Hedge’s g-Statistic. |
|
Interpret Cohen’s d or Hedge’s g values using Table 1 from https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3444174/ |
|
Calculate the interquartile range, excluding NaN, strings, boolean values, and zeros. |
|
Calculate the mean, excluding NaN, strings, boolean values, and zeros. |
|
Compute the median absolute deviation of the data along the given axis. |
|
Calculate the median, excluding NaN, strings, boolean values, and zeros. |
|
Calculate the given percentile, excluding NaN, strings, boolean values, and zeros. |
|
Returns the pooled standard deviation. |
|
Calculate the standard deviation, excluding NaN, strings, boolean values, and zeros. |
|
Returns whether |
-
absolute_deviation
(x, axis=0, center=<function median>, nan_policy='propagate')[source] Compute the absolute deviations from the median of the data along the given axis.
- Parameters
x (array_like) – Input array or object that can be converted to an array.
axis (
Optional
[int
]) – Axis along which the range is computed. If None, compute the MAD over the entire array. Default0
.center (
Callable
) – A function that will return the central value. The default is to use numpy.median. Any user defined function used will need to have the function signaturefunc(arr, axis)
. Default<function median at 0x7f234bd32a70>
.nan_policy (
Literal
['propagate'
,'raise'
,'omit'
]) – Defines how to handle when input contains nan. ‘propagate’ returns nan, ‘raise’ throws an error, ‘omit’ performs the calculations ignoring nan values. Default'propagate'
.
- Returns
If
axis=None
, a scalar is returned. If the input contains integers or floats of smaller precision thannumpy.float64
, then the output data-type isnumpy.float64
. Otherwise, the output data-type is the same as that of the input.- Return type
scalar or ndarray
- Overloads
absolute_deviation
(x, axis:None
, center = …, nan_policy = … ) ->float
absolute_deviation
(x, axis:int
= …, center = …, nan_policy = … ) ->ndarray
Note
The center argument only affects the calculation of the central value around which the MAD is calculated. That is, passing in
center=numpy.mean
will calculate the MAD around the mean - it will not calculate the mean absolute deviation.
-
absolute_deviation_from_median
(x, axis=0, center=<function median>, nan_policy='propagate')[source] Compute the absolute deviation from the median of each point in the data along the given axis, given in terms of the MAD.
- Parameters
x (array_like) – Input array or object that can be converted to an array.
axis (
Optional
[int
]) – Axis along which the range is computed. If None, compute the MAD over the entire array. Default0
.center (
Callable
) – A function that will return the central value. The default is to use numpy.median. Any user defined function used will need to have the function signaturefunc(arr, axis)
. Default<function median at 0x7f234bd32a70>
.nan_policy (
Literal
['propagate'
,'raise'
,'omit'
]) – Defines how to handle when input contains nan. ‘propagate’ returns nan, ‘raise’ throws an error, ‘omit’ performs the calculations ignoring nan values. Default'propagate'
.
- Returns
If
axis=None
, a scalar is returned. If the input contains integers or floats of smaller precision thannumpy.float64
, then the output data-type isnumpy.float64
. Otherwise, the output data-type is the same as that of the input.- Return type
scalar or ndarray
- Overloads
absolute_deviation_from_median
(x, axis:None
, center = …, nan_policy = … ) ->float
absolute_deviation_from_median
(x, axis:int
= …, center = …, nan_policy = … ) ->ndarray
Note
The center argument only affects the calculation of the central value around which the MAD is calculated. That is, passing in
center=numpy.mean
will calculate the MAD around the mean - it will not calculate the mean absolute deviation.
-
d_cohen
(sample1, sample2, which=1, tail=1, pooled=False)[source] Calculates and returns Cohen’s effect size index d.
See also
Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd Edition). Hillsdale, NJ: Lawrence Erlbaum Associates
-
g_durlak_bias
(g, n)[source] Application of Durlak’s bias correction to the Hedge’s g statistic.
n = n1+n2
- Parameters
- Return type
-
g_hedge
(sample1, sample2)[source] Calculates and returns Hedge’s g-Statistic.
Formula from https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/hedgeg.htm
-
interpret_d
(d_or_g)[source] Interpret Cohen’s d or Hedge’s g values using Table 1 from https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3444174/
-
iqr_none
(dataset)[source] Calculate the interquartile range, excluding NaN, strings, boolean values, and zeros.
-
median_absolute_deviation
(x, axis=0, center=<function median>, scale=1.4826, nan_policy='propagate')[source] Compute the median absolute deviation of the data along the given axis. The median absolute deviation (MAD, 1) computes the median over the absolute deviations from the median. It is a measure of dispersion similar to the standard deviation, but is more robust to outliers 2. The MAD of an empty array is
numpy.nan
.- Parameters
x (array_like) – Input array or object that can be converted to an array.
axis (
Optional
[int
]) – Axis along which the range is computed. If None, compute the MAD over the entire array. Default0
.center (
Callable
) – A function that will return the central value. The default is to use numpy.median. Any user defined function used will need to have the function signaturefunc(arr, axis)
. Default<function median at 0x7f234bd32a70>
.scale (
float
) – The scaling factor applied to the MAD. The default scale (1.4826) ensures consistency with the standard deviation for normally distributed data. Default1.4826
.nan_policy (
Literal
['propagate'
,'raise'
,'omit'
]) – Defines how to handle when input contains nan. ‘propagate’ returns nan, ‘raise’ throws an error, ‘omit’ performs the calculations ignoring nan values. Default'propagate'
.
- Returns
If
axis=None
, a scalar is returned. If the input contains integers or floats of smaller precision thannumpy.float64
, then the output data-type isnumpy.float64
. Otherwise, the output data-type is the same as that of the input.- Return type
scalar or ndarray
- Overloads
median_absolute_deviation
(x, axis:None
, center = …, scale = …, nan_policy = … ) ->float
median_absolute_deviation
(x, axis:int
= …, center = …, scale = …, nan_policy = … ) ->ndarray
Note
The center argument only affects the calculation of the central value around which the MAD is calculated. That is, passing in
center=numpy.mean
will calculate the MAD around the mean - it will not calculate the mean absolute deviation.References
- 1
“Median absolute deviation” https://en.wikipedia.org/wiki/Median_absolute_deviation
- 2
“Robust measures of scale” https://en.wikipedia.org/wiki/Robust_measures_of_scale
Examples
When comparing the behavior of median_absolute_deviation with
numpy.std
, the latter is affected when we change a single value of an array to have an outlier value while the MAD hardly changes:>>> import scipy.stats >>> import mathematical.stats >>> x = scipy.stats.norm.rvs(size=100, scale=1, random_state=123456) >>> x.std() 0.9973906394005013 >>> mathematical.stats.median_absolute_deviation(x) 1.2280762773108278 >>> x[0] = 345.6 >>> x.std() 34.42304872314415 >>> mathematical.stats.median_absolute_deviation(x) 1.2340335571164334 Axis handling example: >>> x = numpy.array([[10, 7, 4], [3, 2, 1]]) >>> x array([[10, 7, 4], [ 3, 2, 1],]) >>> mathematical.stats.median_absolute_deviation(x) array([5.1891, 3.7065, 2.2239]) >>> mathematical.stats.median_absolute_deviation(x, axis=None) 2.9652
-
median_none
(dataset)[source] Calculate the median, excluding NaN, strings, boolean values, and zeros.
-
percentile_none
(dataset, percentage)[source] Calculate the given percentile, excluding NaN, strings, boolean values, and zeros.
-
pooled_sd
(sample1, sample2, weighted=False)[source] Returns the pooled standard deviation.
- Parameters
- Return type
mathematical.utils
Utilities for mathematical operations.
Classes:
|
Returns a range of floating-point numbers. |
Functions:
|
Concatenate multiple CSV files together and return a |
|
Returns the GCD (HCF) of |
|
Returns the GCD (HCF) of a list of numbers using Euclid’s Algorithm. |
|
Returns the GCD for an array of numbers using Euclid’s Algorithm. |
|
Returns the GCD (HCF) of |
|
Returns the GCD (HCF) of a list of numbers using Euclid’s Algorithm. |
|
Integer divsions which rounds toward zero. |
|
Checks whether a float is an integer value. |
|
Returns the LCM of a list of numbers using Euclid’s Algorithm. |
Returns the natural logarithm of |
|
|
Returns the magnitude of the given value. |
|
Returns the modular inverse of |
|
Returns the mean of the given sequence, ignoring |
|
Returns the relative standard deviation of the given sequence, ignoring |
|
Returns the standard deviation of the given sequence, ignoring |
|
Remove zero values from the given list. |
Checks whether a value can be converted to an |
|
|
Retuns the Roman numeral represtation of the given value. |
|
Round a value to the specified number format, e.g. |
|
Remove booleans from a list. |
Remove |
|
|
Remove |
|
Remove strings from a list. |
-
class
FRange
(stop: float)[source] -
class
FRange
(start: float, stop: float, step: float = '...') -
Returns a range of floating-point numbers.
The arguments to the range constructor may be integers or floats.
- Parameters
- Raises
ValueError – If step is zero, or if any value is larger than 1×10 14.
New in version 0.2.0.
Methods:
__contains__
(o)Returns whether
o
is in the range.__delattr__
(key)Implement
delattr(self, name)
.__eq__
(other)Return
self == other
.__getitem__
(item)Returns the value in the range at index
item
.__iter__
()Iterates over values in the range.
__len__
()Returns the number of values in the range.
__repr__
()Return a string representation of the
FRange
.Returns
reversed(self)
.__setattr__
(key, value)Implement
setattr(self, name)
.count
(value)Returns
1
if the value is within the range,0
otherwise.index
(value)Returns the index of
value
in the range.Attributes:
The value of the
start
parameter (or0.0
if the parameter was not supplied)The value of the
step
parameter (or1.0
if the parameter was not supplied)The value of the
stop
parameter-
__delattr__
(key)[source] Implement
delattr(self, name)
.
-
__getitem__
(item)[source] Returns the value in the range at index
item
.- Parameters
item
- Overloads
__getitem__
(i:int
) ->int
__getitem__
(s:slice
) ->FRange
-
__reversed__
()[source] Returns
reversed(self)
.
-
__setattr__
(key, value)[source] Implement
setattr(self, name)
.
-
index
(value)[source] Returns the index of
value
in the range.- Parameters
value (
float
)- Raises
ValueError – if the value is not in the range.
- Return type
-
concatenate_csv
(*files, outfile=None)[source] Concatenate multiple CSV files together and return a
pandas.DataFrame
representing the output.- Parameters
- Return type
- Returns
A
pandas.DataFrame
containing the concatenated CSV data.
New in version 0.3.0.
-
gcd_array
(array)[source] Returns the GCD for an array of numbers using Euclid’s Algorithm.
Based on https://www.geeksforgeeks.org/python-program-for-gcd-of-more-than-two-or-array-numbers/
- Parameters
array
- Return type
-
hcf
(a, b) Returns the GCD (HCF) of
a
andb
using Euclid’s Algorithm.
-
hcf2
(numbers) Returns the GCD (HCF) of a list of numbers using Euclid’s Algorithm.
-
intdiv
(p, q)[source] Integer divsions which rounds toward zero.
Examples >>> intdiv(3, 2) 1 >>> intdiv(-3, 2) -1 >>> -3 // 2 -2
- Return type
-
isint
(num)[source] Checks whether a float is an integer value.
Note
This function only works with floating-point numbers
-
magnitude
(x)[source] Returns the magnitude of the given value.
- Parameters
x (
float
) – Numerical value to find the magnitude of.
Changed in version 0.2.0: Now returns the absolute magnitude of negative numbers.
- Return type
-
mod_inverse
(a, m)[source] Returns the modular inverse of
a % m
, which is the numberx
such thata × x % m = 1
.
-
nanmean
(ls, dtype=<class 'float'>)[source] Returns the mean of the given sequence, ignoring
None
andnumpy.nan
values etc.Similar to numpy.nanmean except it handles
None
.
-
nanrsd
(ls, dtype=<class 'float'>)[source] Returns the relative standard deviation of the given sequence, ignoring
None
andnumpy.nan
values etc.
-
nanstd
(ls, dtype=<class 'float'>)[source] Returns the standard deviation of the given sequence, ignoring
None
andnumpy.nan
values etc.Similar to numpy.nanstd except it handles
None
.
-
roman
(num)[source] Retuns the Roman numeral represtation of the given value.
Examples:
>>> roman(4) 'IV' >>> roman(17) 'XVII'
- Return type
-
rounders
(val_to_round, round_format)[source] Round a value to the specified number format, e.g.
"0.000"
for three decimal places.
Contributing
mathematical
uses tox to automate testing and packaging,
and pre-commit to maintain code quality.
Install pre-commit
with pip
and install the git hook:
python -m pip install pre-commit
pre-commit install
Coding style
formate is used for code formatting.
It can be run manually via pre-commit
:
pre-commit run formate -a
Or, to run the complete autoformatting suite:
pre-commit run -a
Automated tests
Tests are run with tox
and pytest
.
To run tests for a specific Python version, such as Python 3.6:
tox -e py36
To run tests for all Python versions, simply run:
tox
Build documentation locally
The documentation is powered by Sphinx. A local copy of the documentation can be built with tox
:
tox -e docs
Downloading source code
The mathematical
source code is available on GitHub,
and can be accessed from the following URL: https://github.com/domdfcoding/mathematical
If you have git
installed, you can clone the repository with the following command:
git clone https://github.com/domdfcoding/mathematical
Cloning into 'mathematical'...
remote: Enumerating objects: 47, done.
remote: Counting objects: 100% (47/47), done.
remote: Compressing objects: 100% (41/41), done.
remote: Total 173 (delta 16), reused 17 (delta 6), pack-reused 126
Receiving objects: 100% (173/173), 126.56 KiB | 678.00 KiB/s, done.
Resolving deltas: 100% (66/66), done.

Downloading a ‘zip’ file of the source code
Building from source
The recommended way to build mathematical
is to use tox:
tox -e build
The source and wheel distributions will be in the directory dist
.
If you wish, you may also use pep517.build or another PEP 517-compatible build tool.
License
mathematical
is licensed under the GNU Lesser General Public License v3.0
Permissions of this copyleft license are conditioned on making available complete source code of licensed works and modifications under the same license or the GNU GPLv3. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. However, a larger work using the licensed work through interfaces provided by the licensed work may be distributed under different terms and without source code for the larger work.
Permissions | Conditions | Limitations |
---|---|---|
|
|
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
View the Function Index or browse the Source Code.