Commit a9a32369 authored by André Anjos's avatar André Anjos 💬
Browse files

Merge branch '1-bob-math-linsolve-parameter-documentation-in-inconsistent-order' into 'master'

Resolve "bob.math.linsolve parameter documentation in inconsistent order"

Closes #1

See merge request !13
parents 50d5c18e b326caef
Pipeline #10483 passed with stages
in 12 minutes and 30 seconds
...@@ -252,7 +252,7 @@ void bob::math::LPInteriorPoint::centeringV(const blitz::Array<double,2>& A, ...@@ -252,7 +252,7 @@ void bob::math::LPInteriorPoint::centeringV(const blitz::Array<double,2>& A,
// 2) Update the big system and solve it // 2) Update the big system and solve it
updateLargeSystem( x, 1., m); updateLargeSystem( x, 1., m);
bob::math::linsolve( m_cache_A_large, m_cache_x_large, m_cache_b_large); bob::math::linsolve( m_cache_A_large, m_cache_b_large, m_cache_x_large);
// 4) Find alpha and update x, lamda and mu // 4) Find alpha and update x, lamda and mu
double alpha=1.; double alpha=1.;
...@@ -406,7 +406,7 @@ void bob::math::LPInteriorPointShortstep::solve(const blitz::Array<double,2>& A, ...@@ -406,7 +406,7 @@ void bob::math::LPInteriorPointShortstep::solve(const blitz::Array<double,2>& A,
// 2) Update the big system and solve it // 2) Update the big system and solve it
updateLargeSystem( x, sigma, m); updateLargeSystem( x, sigma, m);
bob::math::linsolve( m_cache_A_large, m_cache_x_large, m_cache_b_large); bob::math::linsolve( m_cache_A_large, m_cache_b_large, m_cache_x_large);
// 3) Update x, lamda and mu // 3) Update x, lamda and mu
m_lambda += m_cache_x_large( r_m+n); m_lambda += m_cache_x_large( r_m+n);
...@@ -527,7 +527,7 @@ void bob::math::LPInteriorPointPredictorCorrector::solve(const blitz::Array<doub ...@@ -527,7 +527,7 @@ void bob::math::LPInteriorPointPredictorCorrector::solve(const blitz::Array<doub
// 2) Update the big system and solve it // 2) Update the big system and solve it
updateLargeSystem( x, 0., m); updateLargeSystem( x, 0., m);
bob::math::linsolve( m_cache_A_large, m_cache_x_large, m_cache_b_large); bob::math::linsolve( m_cache_A_large, m_cache_b_large, m_cache_x_large);
// 3) alpha=1 // 3) alpha=1
double alpha = 1.; double alpha = 1.;
...@@ -560,7 +560,7 @@ void bob::math::LPInteriorPointPredictorCorrector::solve(const blitz::Array<doub ...@@ -560,7 +560,7 @@ void bob::math::LPInteriorPointPredictorCorrector::solve(const blitz::Array<doub
// 7) Update the big system and solve it // 7) Update the big system and solve it
updateLargeSystem( x, 1., m); updateLargeSystem( x, 1., m);
bob::math::linsolve( m_cache_A_large, m_cache_x_large, m_cache_b_large); bob::math::linsolve( m_cache_A_large, m_cache_b_large, m_cache_x_large);
// 8) Update x // 8) Update x
m_lambda += m_cache_x_large(r_m+n); m_lambda += m_cache_x_large(r_m+n);
...@@ -690,7 +690,7 @@ void bob::math::LPInteriorPointLongstep::solve(const blitz::Array<double,2>& A, ...@@ -690,7 +690,7 @@ void bob::math::LPInteriorPointLongstep::solve(const blitz::Array<double,2>& A,
// 2) Update the big system and solve it // 2) Update the big system and solve it
updateLargeSystem(x, m_sigma, m); updateLargeSystem(x, m_sigma, m);
bob::math::linsolve(m_cache_A_large, m_cache_x_large, m_cache_b_large); bob::math::linsolve(m_cache_A_large, m_cache_b_large, m_cache_x_large);
// 3) alpha=1 // 3) alpha=1
double alpha = 1.; double alpha = 1.;
...@@ -737,4 +737,3 @@ void bob::math::LPInteriorPointLongstep::solve(const blitz::Array<double,2>& A, ...@@ -737,4 +737,3 @@ void bob::math::LPInteriorPointLongstep::solve(const blitz::Array<double,2>& A,
// Launch the long step algorithm // Launch the long step algorithm
solve(A, b, c, x, m_lambda, m_mu); solve(A, b, c, x, m_lambda, m_mu);
} }
...@@ -22,8 +22,8 @@ extern "C" void dgesv_( const int *N, const int *NRHS, double *A, ...@@ -22,8 +22,8 @@ extern "C" void dgesv_( const int *N, const int *NRHS, double *A,
extern "C" void dposv_( const char* uplo, const int *N, const int *NRHS, extern "C" void dposv_( const char* uplo, const int *N, const int *NRHS,
double *A, const int *lda, double *B, const int *ldb, int *info); double *A, const int *lda, double *B, const int *ldb, int *info);
void bob::math::linsolve(const blitz::Array<double,2>& A, blitz::Array<double,1>& x, void bob::math::linsolve(const blitz::Array<double,2>& A,
const blitz::Array<double,1>& b) const blitz::Array<double,1>& b, blitz::Array<double,1>& x)
{ {
// Check x and b // Check x and b
bob::core::array::assertZeroBase(x); bob::core::array::assertZeroBase(x);
...@@ -35,11 +35,11 @@ void bob::math::linsolve(const blitz::Array<double,2>& A, blitz::Array<double,1> ...@@ -35,11 +35,11 @@ void bob::math::linsolve(const blitz::Array<double,2>& A, blitz::Array<double,1>
bob::core::array::assertSameDimensionLength(A.extent(0), A.extent(1)); bob::core::array::assertSameDimensionLength(A.extent(0), A.extent(1));
bob::core::array::assertSameDimensionLength(A.extent(1), b.extent(0)); bob::core::array::assertSameDimensionLength(A.extent(1), b.extent(0));
bob::math::linsolve_(A, x, b); bob::math::linsolve_(A, b, x);
} }
void bob::math::linsolve_(const blitz::Array<double,2>& A, blitz::Array<double,1>& x, void bob::math::linsolve_(const blitz::Array<double,2>& A,
const blitz::Array<double,1>& b) const blitz::Array<double,1>& b, blitz::Array<double,1>& x)
{ {
// Defines dimensionality variables // Defines dimensionality variables
const int N = A.extent(0); const int N = A.extent(0);
...@@ -82,8 +82,8 @@ void bob::math::linsolve_(const blitz::Array<double,2>& A, blitz::Array<double,1 ...@@ -82,8 +82,8 @@ void bob::math::linsolve_(const blitz::Array<double,2>& A, blitz::Array<double,1
} }
void bob::math::linsolve(const blitz::Array<double,2>& A, blitz::Array<double,2>& X, void bob::math::linsolve(const blitz::Array<double,2>& A,
const blitz::Array<double,2>& B) const blitz::Array<double,2>& B, blitz::Array<double,2>& X)
{ {
// Checks dimensionality and zero base // Checks dimensionality and zero base
bob::core::array::assertZeroBase(A); bob::core::array::assertZeroBase(A);
...@@ -94,12 +94,13 @@ void bob::math::linsolve(const blitz::Array<double,2>& A, blitz::Array<double,2> ...@@ -94,12 +94,13 @@ void bob::math::linsolve(const blitz::Array<double,2>& A, blitz::Array<double,2>
bob::core::array::assertSameDimensionLength(A.extent(0), B.extent(0)); bob::core::array::assertSameDimensionLength(A.extent(0), B.extent(0));
bob::core::array::assertSameDimensionLength(X.extent(1), B.extent(1)); bob::core::array::assertSameDimensionLength(X.extent(1), B.extent(1));
bob::math::linsolve_(A, X, B); bob::math::linsolve_(A, B, X);
} }
void bob::math::linsolve_(const blitz::Array<double,2>& A, blitz::Array<double,2>& X, void bob::math::linsolve_(const blitz::Array<double,2>& A,
const blitz::Array<double,2>& B) const blitz::Array<double,2>& B, blitz::Array<double,2>& X)
{ {
// Defines dimensionality variables // Defines dimensionality variables
const int N = A.extent(0); const int N = A.extent(0);
const int P = X.extent(1); const int P = X.extent(1);
...@@ -148,7 +149,7 @@ void bob::math::linsolve_(const blitz::Array<double,2>& A, blitz::Array<double,2 ...@@ -148,7 +149,7 @@ void bob::math::linsolve_(const blitz::Array<double,2>& A, blitz::Array<double,2
void bob::math::linsolveSympos(const blitz::Array<double,2>& A, void bob::math::linsolveSympos(const blitz::Array<double,2>& A,
blitz::Array<double,1>& x, const blitz::Array<double,1>& b) const blitz::Array<double,1>& b, blitz::Array<double,1>& x)
{ {
// Check x and b // Check x and b
bob::core::array::assertZeroBase(x); bob::core::array::assertZeroBase(x);
...@@ -160,12 +161,13 @@ void bob::math::linsolveSympos(const blitz::Array<double,2>& A, ...@@ -160,12 +161,13 @@ void bob::math::linsolveSympos(const blitz::Array<double,2>& A,
bob::core::array::assertSameDimensionLength(A.extent(0), A.extent(1)); bob::core::array::assertSameDimensionLength(A.extent(0), A.extent(1));
bob::core::array::assertSameDimensionLength(A.extent(1), b.extent(0)); bob::core::array::assertSameDimensionLength(A.extent(1), b.extent(0));
bob::math::linsolveSympos_(A, x, b); bob::math::linsolveSympos_(A, b, x);
} }
void bob::math::linsolveSympos_(const blitz::Array<double,2>& A, void bob::math::linsolveSympos_(const blitz::Array<double,2>& A,
blitz::Array<double,1>& x, const blitz::Array<double,1>& b) const blitz::Array<double,1>& b, blitz::Array<double,1>& x)
{ {
// Defines dimensionality variables // Defines dimensionality variables
const int N = A.extent(0); const int N = A.extent(0);
...@@ -208,8 +210,8 @@ void bob::math::linsolveSympos_(const blitz::Array<double,2>& A, ...@@ -208,8 +210,8 @@ void bob::math::linsolveSympos_(const blitz::Array<double,2>& A,
x = x_blitz_lapack; x = x_blitz_lapack;
} }
void bob::math::linsolveSympos(const blitz::Array<double,2>& A, blitz::Array<double,2>& X, void bob::math::linsolveSympos(const blitz::Array<double,2>& A,
const blitz::Array<double,2>& B) const blitz::Array<double,2>& B, blitz::Array<double,2>& X)
{ {
// Checks dimensionality and zero base // Checks dimensionality and zero base
bob::core::array::assertZeroBase(A); bob::core::array::assertZeroBase(A);
...@@ -220,11 +222,11 @@ void bob::math::linsolveSympos(const blitz::Array<double,2>& A, blitz::Array<dou ...@@ -220,11 +222,11 @@ void bob::math::linsolveSympos(const blitz::Array<double,2>& A, blitz::Array<dou
bob::core::array::assertSameDimensionLength(A.extent(0), B.extent(0)); bob::core::array::assertSameDimensionLength(A.extent(0), B.extent(0));
bob::core::array::assertSameDimensionLength(X.extent(1), B.extent(1)); bob::core::array::assertSameDimensionLength(X.extent(1), B.extent(1));
bob::math::linsolveSympos_(A, X, B); bob::math::linsolveSympos_(A, B, X);
} }
void bob::math::linsolveSympos_(const blitz::Array<double,2>& A, blitz::Array<double,2>& X, void bob::math::linsolveSympos_(const blitz::Array<double,2>& A,
const blitz::Array<double,2>& B) const blitz::Array<double,2>& B, blitz::Array<double,2>& X)
{ {
// Defines dimensionality variables // Defines dimensionality variables
const int N = A.extent(0); const int N = A.extent(0);
...@@ -275,8 +277,9 @@ void bob::math::linsolveSympos_(const blitz::Array<double,2>& A, blitz::Array<do ...@@ -275,8 +277,9 @@ void bob::math::linsolveSympos_(const blitz::Array<double,2>& A, blitz::Array<do
void bob::math::linsolveCGSympos(const blitz::Array<double,2>& A, blitz::Array<double,1>& x, void bob::math::linsolveCGSympos(const blitz::Array<double,2>& A,
const blitz::Array<double,1>& b, const double acc, const int max_iter) const blitz::Array<double,1>& b, blitz::Array<double,1>& x,
const double acc, const int max_iter)
{ {
// Dimensionality of the problem // Dimensionality of the problem
const int N = b.extent(0); const int N = b.extent(0);
...@@ -291,11 +294,12 @@ void bob::math::linsolveCGSympos(const blitz::Array<double,2>& A, blitz::Array<d ...@@ -291,11 +294,12 @@ void bob::math::linsolveCGSympos(const blitz::Array<double,2>& A, blitz::Array<d
bob::core::array::assertSameDimensionLength(A.extent(0), N); bob::core::array::assertSameDimensionLength(A.extent(0), N);
bob::core::array::assertSameDimensionLength(A.extent(1), N); bob::core::array::assertSameDimensionLength(A.extent(1), N);
bob::math::linsolveCGSympos_(A, x, b, acc, max_iter); bob::math::linsolveCGSympos_(A, b, x, acc, max_iter);
} }
void bob::math::linsolveCGSympos_(const blitz::Array<double,2>& A, blitz::Array<double,1>& x, void bob::math::linsolveCGSympos_(const blitz::Array<double,2>& A,
const blitz::Array<double,1>& b, const double acc, const int max_iter) const blitz::Array<double,1>& b, blitz::Array<double,1>& x,
const double acc, const int max_iter)
{ {
// Dimensionality of the problem // Dimensionality of the problem
const int N = b.extent(0); const int N = b.extent(0);
...@@ -347,4 +351,3 @@ void bob::math::linsolveCGSympos_(const blitz::Array<double,2>& A, blitz::Array< ...@@ -347,4 +351,3 @@ void bob::math::linsolveCGSympos_(const blitz::Array<double,2>& A, blitz::Array<
// TODO return best_res and number of iterations? // TODO return best_res and number of iterations?
//double res = best_res; //double res = best_res;
} }
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#define BOB_MATH_CONFIG_H #define BOB_MATH_CONFIG_H
/* Macros that define versions and important names */ /* Macros that define versions and important names */
#define BOB_MATH_API_VERSION 0x0200 #define BOB_MATH_API_VERSION 0x0201
#ifdef BOB_IMPORT_VERSION #ifdef BOB_IMPORT_VERSION
......
...@@ -23,10 +23,10 @@ namespace bob { namespace math { ...@@ -23,10 +23,10 @@ namespace bob { namespace math {
* @param x The x vector of the system A*x=b which will be updated * @param x The x vector of the system A*x=b which will be updated
* at the end of the function. * at the end of the function.
*/ */
void linsolve(const blitz::Array<double,2>& A, blitz::Array<double,1>& x, void linsolve(const blitz::Array<double,2>& A,
const blitz::Array<double,1>& b); const blitz::Array<double,1>& b, blitz::Array<double,1>& x);
void linsolve_(const blitz::Array<double,2>& A, blitz::Array<double,1>& x, void linsolve_(const blitz::Array<double,2>& A,
const blitz::Array<double,1>& b); const blitz::Array<double,1>& b, blitz::Array<double,1>& x);
/** /**
* @brief Function which solves a linear system of equation using the * @brief Function which solves a linear system of equation using the
...@@ -36,10 +36,10 @@ namespace bob { namespace math { ...@@ -36,10 +36,10 @@ namespace bob { namespace math {
* @param X The X matrix of the system A*X=B which will be updated * @param X The X matrix of the system A*X=B which will be updated
* at the end of the function (size NxP). * at the end of the function (size NxP).
*/ */
void linsolve(const blitz::Array<double,2>& A, blitz::Array<double,2>& X, void linsolve(const blitz::Array<double,2>& A,
const blitz::Array<double,2>& B); const blitz::Array<double,2>& B, blitz::Array<double,2>& X);
void linsolve_(const blitz::Array<double,2>& A, blitz::Array<double,2>& X, void linsolve_(const blitz::Array<double,2>& A,
const blitz::Array<double,2>& B); const blitz::Array<double,2>& B, blitz::Array<double,2>& X);
/** /**
* @brief Function which solves a symmetric positive definite linear * @brief Function which solves a symmetric positive definite linear
...@@ -53,9 +53,9 @@ namespace bob { namespace math { ...@@ -53,9 +53,9 @@ namespace bob { namespace math {
* at the end of the function (size N) * at the end of the function (size N)
*/ */
void linsolveSympos(const blitz::Array<double,2>& A, void linsolveSympos(const blitz::Array<double,2>& A,
blitz::Array<double,1>& x, const blitz::Array<double,1>& b); const blitz::Array<double,1>& b, blitz::Array<double,1>& x);
void linsolveSympos_(const blitz::Array<double,2>& A, void linsolveSympos_(const blitz::Array<double,2>& A,
blitz::Array<double,1>& x, const blitz::Array<double,1>& b); const blitz::Array<double,1>& b, blitz::Array<double,1>& x);
/** /**
* @brief Function which solves a symmetric positive definite linear * @brief Function which solves a symmetric positive definite linear
...@@ -69,9 +69,9 @@ namespace bob { namespace math { ...@@ -69,9 +69,9 @@ namespace bob { namespace math {
* at the end of the function (size NxP) * at the end of the function (size NxP)
*/ */
void linsolveSympos(const blitz::Array<double,2>& A, void linsolveSympos(const blitz::Array<double,2>& A,
blitz::Array<double,2>& X, const blitz::Array<double,2>& B); const blitz::Array<double,2>& B, blitz::Array<double,2>& X);
void linsolveSympos_(const blitz::Array<double,2>& A, void linsolveSympos_(const blitz::Array<double,2>& A,
blitz::Array<double,2>& X, const blitz::Array<double,2>& B); const blitz::Array<double,2>& B, blitz::Array<double,2>& X);
/** /**
...@@ -86,12 +86,13 @@ namespace bob { namespace math { ...@@ -86,12 +86,13 @@ namespace bob { namespace math {
* norm(Ax-b)/norm(b) < acc * norm(Ax-b)/norm(b) < acc
* @param max_iter The maximum number of iterations * @param max_iter The maximum number of iterations
*/ */
void linsolveCGSympos(const blitz::Array<double,2>& A, blitz::Array<double,1>& x, void linsolveCGSympos(const blitz::Array<double,2>& A,
const blitz::Array<double,1>& b, const double acc, const int max_iter); const blitz::Array<double,1>& b, blitz::Array<double,1>& x,
void linsolveCGSympos_(const blitz::Array<double,2>& A, blitz::Array<double,1>& x, const double acc, const int max_iter);
const blitz::Array<double,1>& b, const double acc, const int max_iter); void linsolveCGSympos_(const blitz::Array<double,2>& A,
const blitz::Array<double,1>& b, blitz::Array<double,1>& x,
const double acc, const int max_iter);
}} }}
#endif /* BOB_MATH_LINSOLVE_H */ #endif /* BOB_MATH_LINSOLVE_H */
This diff is collapsed.
/** /**
* @author Andre Anjos <andre.anjos@idiap.ch> * @author Andre Anjos <andre.anjos@idiap.ch>
* @date Wed 4 Dec 15:26:54 2013 * @date Wed 4 Dec 15:26:54 2013
* *
* @brief Declaration of components relevant for main.cpp * @brief Declaration of components relevant for main.cpp
*/ */
...@@ -8,8 +8,9 @@ ...@@ -8,8 +8,9 @@
#include <Python.h> #include <Python.h>
PyObject* py_linsolve(PyObject*, PyObject* args, PyObject* kwargs); PyObject* py_linsolve(PyObject*, PyObject* args, PyObject* kwargs);
PyObject* py_linsolve_nocheck(PyObject*, PyObject* args, PyObject* kwargs);
PyObject* py_linsolve_sympos(PyObject*, PyObject* args, PyObject* kwargs); PyObject* py_linsolve_sympos(PyObject*, PyObject* args, PyObject* kwargs);
PyObject* py_linsolve_sympos_nocheck(PyObject*, PyObject* args, PyObject* kwargs);
PyObject* py_linsolve_cg_sympos(PyObject*, PyObject* args, PyObject* kwargs); PyObject* py_linsolve_cg_sympos(PyObject*, PyObject* args, PyObject* kwargs);
PyObject* py_linsolve_cg_sympos_nocheck(PyObject*, PyObject* args, PyObject* kwargs);
extern bob::extension::FunctionDoc s_linsolve;
extern bob::extension::FunctionDoc s_linsolve_sympos;
extern bob::extension::FunctionDoc s_linsolve_cg_sympos;
...@@ -82,107 +82,6 @@ static bob::extension::FunctionDoc s_kullback_leibler = bob::extension::Function ...@@ -82,107 +82,6 @@ static bob::extension::FunctionDoc s_kullback_leibler = bob::extension::Function
.add_return("dist", "float", "The Kullback-Leibler divergence value for the given histograms.") .add_return("dist", "float", "The Kullback-Leibler divergence value for the given histograms.")
; ;
static bob::extension::FunctionDoc s_linsolve = bob::extension::FunctionDoc(
"linsolve",
"Solves the linear system :math:`Ax=b` and returns the result in :math:`x`.",
"This method uses LAPACK's ``dgesv`` generic solver. "
"You can use this method in two different formats. "
"The first interface accepts the matrices :math:`A` and :math:`b` returning :math:`x`. "
"The second one accepts a pre-allocated :math:`x` vector and sets it with the linear system solution."
)
.add_prototype("A, b", "x")
.add_prototype("A, b, x")
.add_parameter("A", "array_like (2D)", "The matrix :math:`A` of the linear system")
.add_parameter("b", "array_like (1D)", "The vector :math:`b` of the linear system")
.add_parameter("x", "array_like (1D)", "The result vector :math:`x`, as parameter")
.add_return("x", "array_like (1D)", "The result vector :math:`x`, as return value")
;
static bob::extension::FunctionDoc s_linsolve_nocheck = bob::extension::FunctionDoc(
"linsolve_",
"Solves the linear system :math:`Ax=b` and returns the result in :math:`x`.",
".. warning:: This variant does not perform any checks on the input matrices and is faster then :py:func:`linsolve`. "
"Use it when you are sure your input matrices sizes match.\n\n"
"This method uses LAPACK's ``dgesv`` generic solver. "
"You can use this method in two different formats. "
"The first interface accepts the matrices :math:`A` and :math:`b` returning :math:`x`. "
"The second one accepts a pre-allocated :math:`x` vector and sets it with the linear system solution."
)
.add_prototype("A, b", "x")
.add_prototype("A, b, x")
.add_parameter("A", "array_like (2D)", "The matrix :math:`A` of the linear system")
.add_parameter("b", "array_like (1D)", "The vector :math:`b` of the linear system")
.add_parameter("x", "array_like (1D)", "The result vector :math:`x`, as parameter")
.add_return("x", "array_like (1D)", "The result vector :math:`x`, as return value")
;
static bob::extension::FunctionDoc s_linsolve_sympos = bob::extension::FunctionDoc(
"linsolve_sympos",
"Solves the linear system :math:`Ax=b` and returns the result in :math:`x` for symmetric :math:`A` matrix.",
"This method uses LAPACK's ``dposv`` solver, assuming :math:`A` is a symmetric positive definite matrix. "
"You can use this method in two different formats. "
"The first interface accepts the matrices :math:`A` and :math:`b` returning :math:`x`. "
"The second one accepts a pre-allocated :math:`x` vector and sets it with the linear system solution."
)
.add_prototype("A, b", "x")
.add_prototype("A, b, x")
.add_parameter("A", "array_like (2D)", "The matrix :math:`A` of the linear system")
.add_parameter("b", "array_like (1D)", "The vector :math:`b` of the linear system")
.add_parameter("x", "array_like (1D)", "The result vector :math:`x`, as parameter")
.add_return("x", "array_like (1D)", "The result vector :math:`x`, as return value")
;
static bob::extension::FunctionDoc s_linsolve_sympos_nocheck = bob::extension::FunctionDoc(
"linsolve_sympos_",
"Solves the linear system :math:`Ax=b` and returns the result in :math:`x` for symmetric :math:`A` matrix.",
".. warning:: This variant does not perform any checks on the input matrices and is faster then :py:func:`linsolve_sympos`. "
"Use it when you are sure your input matrices sizes match.\n\n"
"This method uses LAPACK's ``dposv`` solver, assuming :math:`A` is a symmetric positive definite matrix. "
"You can use this method in two different formats. "
"The first interface accepts the matrices :math:`A` and :math:`b` returning :math:`x`. "
"The second one accepts a pre-allocated :math:`x` vector and sets it with the linear system solution."
)
.add_prototype("A, b", "x")
.add_prototype("A, b, x")
.add_parameter("A", "array_like (2D)", "The matrix :math:`A` of the linear system")
.add_parameter("b", "array_like (1D)", "The vector :math:`b` of the linear system")
.add_parameter("x", "array_like (1D)", "The result vector :math:`x`, as parameter")
.add_return("x", "array_like (1D)", "The result vector :math:`x`, as return value")
;
static bob::extension::FunctionDoc s_linsolve_cg_sympos = bob::extension::FunctionDoc(
"linsolve_cg_sympos",
"Solves the linear system :math:`Ax=b` using conjugate gradients and returns the result in :math:`x` for symmetric :math:`A` matrix.",
"This method uses the conjugate gradient solver, assuming :math:`A` is a symmetric positive definite matrix. "
"You can use this method in two different formats. "
"The first interface accepts the matrices :math:`A` and :math:`b` returning :math:`x`. "
"The second one accepts a pre-allocated :math:`x` vector and sets it with the linear system solution."
)
.add_prototype("A, b", "x")
.add_prototype("A, b, x")
.add_parameter("A", "array_like (2D)", "The matrix :math:`A` of the linear system")
.add_parameter("b", "array_like (1D)", "The vector :math:`b` of the linear system")
.add_parameter("x", "array_like (1D)", "The result vector :math:`x`, as parameter")
.add_return("x", "array_like (1D)", "The result vector :math:`x`, as return value")
;
static bob::extension::FunctionDoc s_linsolve_cg_sympos_nocheck = bob::extension::FunctionDoc(
"linsolve_cg_sympos_",
"Solves the linear system :math:`Ax=b` using conjugate gradients and returns the result in :math:`x` for symmetric :math:`A` matrix.",
".. warning:: This variant does not perform any checks on the input matrices and is faster then :py:func:`linsolve_cg_sympos`. "
"Use it when you are sure your input matrices sizes match.\n\n"
"This method uses the conjugate gradient solver, assuming :math:`A` is a symmetric positive definite matrix. "
"You can use this method in two different formats. "
"The first interface accepts the matrices :math:`A` and :math:`b` returning :math:`x`. "
"The second one accepts a pre-allocated :math:`x` vector and sets it with the linear system solution."
)
.add_prototype("A, b", "x")
.add_prototype("A, b, x")
.add_parameter("A", "array_like (2D)", "The matrix :math:`A` of the linear system")
.add_parameter("b", "array_like (1D)", "The vector :math:`b` of the linear system")
.add_parameter("x", "array_like (1D)", "The result vector :math:`x`, as parameter")
.add_return("x", "array_like (1D)", "The result vector :math:`x`, as return value")
;
static bob::extension::FunctionDoc s_pavx = bob::extension::FunctionDoc( static bob::extension::FunctionDoc s_pavx = bob::extension::FunctionDoc(
"pavx", "pavx",
...@@ -200,24 +99,6 @@ static bob::extension::FunctionDoc s_pavx = bob::extension::FunctionDoc( ...@@ -200,24 +99,6 @@ static bob::extension::FunctionDoc s_pavx = bob::extension::FunctionDoc(
.add_return("output", "array_like (float, 1D)", "The output matrix; will be created in the same size as ``input``") .add_return("output", "array_like (float, 1D)", "The output matrix; will be created in the same size as ``input``")
; ;
static bob::extension::FunctionDoc s_pavx_nocheck = bob::extension::FunctionDoc(
"pavx_",
"Applies the Pool-Adjacent-Violators Algorithm",
".. warning:: This variant does not perform any checks on the input matrices and is faster then :py:func:`pavx`. "
"Use it when you are sure your input matrices sizes match.\n\n"
"Applies the Pool-Adjacent-Violators Algorithm to ``input``. "
"This is a simplified C++ port of the isotonic regression code made available at the `University of Bern website <http://www.imsv.unibe.ch/content/staff/personalhomepages/duembgen/software/isotonicregression/index_eng.html>`_.\n\n"
"You can use this method in two different formats. "
"The first interface accepts the ``input`` and ``output``. "
"The second one accepts the input array ``input`` and allocates a new ``output`` array, which is returned. "
)
.add_prototype("input, output")
.add_prototype("input", "output")
.add_parameter("input", "array_like (float, 1D)", "The input matrix for the PAV algorithm.")
.add_parameter("output", "array_like (float, 1D)", "The output matrix, must be of the same size as ``input``")
.add_return("output", "array_like (float, 1D)", "The output matrix; will be created in the same size as ``input``")
;
static bob::extension::FunctionDoc s_pavx_width = bob::extension::FunctionDoc( static bob::extension::FunctionDoc s_pavx_width = bob::extension::FunctionDoc(
"pavxWidth", "pavxWidth",
"Applies the Pool-Adjacent-Violators Algorithm and returns the width.", "Applies the Pool-Adjacent-Violators Algorithm and returns the width.",
...@@ -288,23 +169,6 @@ static bob::extension::FunctionDoc s_scatter = bob::extension::FunctionDoc( ...@@ -288,23 +169,6 @@ static bob::extension::FunctionDoc s_scatter = bob::extension::FunctionDoc(
.add_return("m", "array_like (float, 1D)", "The mean matrix, with with the row means of ``a``") .add_return("m", "array_like (float, 1D)", "The mean matrix, with with the row means of ``a``")
; ;
static bob::extension::FunctionDoc s_scatter_nocheck = bob::extension::FunctionDoc(
"scatter_",
"Computes scatter matrix of a 2D array.",
".. warning:: This variant does not perform any checks on the input matrices and is faster then :py:func:`scatter`."
"Use it when you are sure your input matrices sizes match.\n\n"
"Computes the scatter matrix of a 2D array *considering data is organized row-wise* (each sample is a row, each feature is a column). "
"The resulting array ``s`` is squared with extents equal to the number of columns in ``a``. "
"The resulting array ``m`` is a 1D array with the row means of ``a``. "
"This function supports many calling modes, but you should provide, at least, the input data matrix ``a``. "
"All non-provided arguments will be allocated internally and returned."
)
.add_prototype("a, s, m")
.add_parameter("a", "array_like (float, 2D)", "The sample matrix, *considering data is organized row-wise* (each sample is a row, each feature is a column)")
.add_parameter("s", "array_like (float, 2D)", "The scatter matrix, squared with extents equal to the number of columns in ``a``")
.add_parameter("m", "array_like (float,1D)", "The mean matrix, with with the row means of ``a``")
;
static bob::extension::FunctionDoc s_scatters = bob::extension::FunctionDoc( static bob::extension::FunctionDoc s_scatters = bob::extension::FunctionDoc(
"scatters", "scatters",
...@@ -337,24 +201,6 @@ static bob::extension::FunctionDoc s_scatters = bob::extension::FunctionDoc( ...@@ -337,24 +201,6 @@ static bob::extension::FunctionDoc s_scatters = bob::extension::FunctionDoc(
.add_return("m", "array_like (float, 1D)", "The mean matrix, representing the ensemble mean with no prior (i.e., biased towards classes with more samples)") .add_return("m", "array_like (float, 1D)", "The mean matrix, representing the ensemble mean with no prior (i.e., biased towards classes with more samples)")
; ;
static bob::extension::FunctionDoc s_scatters_nocheck = bob::extension::FunctionDoc(
"scatters_",
"Computes :math:`S_w` and :math:`S_b` scatter matrices of a set of 2D arrays.",
".. warning:: This variant does not perform any checks on the input matrices and is faster then :py:func:`scatters`. "