mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-11 19:29:02 +08:00
Fix function dependencies
This commit is contained in:
parent
c3c8ad8046
commit
f2c2465acc
@ -32,33 +32,6 @@ struct rcond_compute_sign<Vector, Vector, false> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \brief Reciprocal condition number estimator.
|
|
||||||
*
|
|
||||||
* Computing a decomposition of a dense matrix takes O(n^3) operations, while
|
|
||||||
* this method estimates the condition number quickly and reliably in O(n^2)
|
|
||||||
* operations.
|
|
||||||
*
|
|
||||||
* \returns an estimate of the reciprocal condition number
|
|
||||||
* (1 / (||matrix||_1 * ||inv(matrix)||_1)) of matrix, given ||matrix||_1 and
|
|
||||||
* its decomposition. Supports the following decompositions: FullPivLU,
|
|
||||||
* PartialPivLU, LDLT, and LLT.
|
|
||||||
*
|
|
||||||
* \sa FullPivLU, PartialPivLU, LDLT, LLT.
|
|
||||||
*/
|
|
||||||
template <typename Decomposition>
|
|
||||||
typename Decomposition::RealScalar
|
|
||||||
rcond_estimate_helper(typename Decomposition::RealScalar matrix_norm, const Decomposition& dec)
|
|
||||||
{
|
|
||||||
typedef typename Decomposition::RealScalar RealScalar;
|
|
||||||
eigen_assert(dec.rows() == dec.cols());
|
|
||||||
if (dec.rows() == 0) return RealScalar(1);
|
|
||||||
if (matrix_norm == RealScalar(0)) return RealScalar(0);
|
|
||||||
if (dec.rows() == 1) return RealScalar(1);
|
|
||||||
const RealScalar inverse_matrix_norm = rcond_invmatrix_L1_norm_estimate(dec);
|
|
||||||
return (inverse_matrix_norm == RealScalar(0) ? RealScalar(0)
|
|
||||||
: (RealScalar(1) / inverse_matrix_norm) / matrix_norm);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \returns an estimate of ||inv(matrix)||_1 given a decomposition of
|
* \returns an estimate of ||inv(matrix)||_1 given a decomposition of
|
||||||
* \a matrix that implements .solve() and .adjoint().solve() methods.
|
* \a matrix that implements .solve() and .adjoint().solve() methods.
|
||||||
@ -167,6 +140,33 @@ typename Decomposition::RealScalar rcond_invmatrix_L1_norm_estimate(const Decomp
|
|||||||
return numext::maxi(lower_bound, alternate_lower_bound);
|
return numext::maxi(lower_bound, alternate_lower_bound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** \brief Reciprocal condition number estimator.
|
||||||
|
*
|
||||||
|
* Computing a decomposition of a dense matrix takes O(n^3) operations, while
|
||||||
|
* this method estimates the condition number quickly and reliably in O(n^2)
|
||||||
|
* operations.
|
||||||
|
*
|
||||||
|
* \returns an estimate of the reciprocal condition number
|
||||||
|
* (1 / (||matrix||_1 * ||inv(matrix)||_1)) of matrix, given ||matrix||_1 and
|
||||||
|
* its decomposition. Supports the following decompositions: FullPivLU,
|
||||||
|
* PartialPivLU, LDLT, and LLT.
|
||||||
|
*
|
||||||
|
* \sa FullPivLU, PartialPivLU, LDLT, LLT.
|
||||||
|
*/
|
||||||
|
template <typename Decomposition>
|
||||||
|
typename Decomposition::RealScalar
|
||||||
|
rcond_estimate_helper(typename Decomposition::RealScalar matrix_norm, const Decomposition& dec)
|
||||||
|
{
|
||||||
|
typedef typename Decomposition::RealScalar RealScalar;
|
||||||
|
eigen_assert(dec.rows() == dec.cols());
|
||||||
|
if (dec.rows() == 0) return RealScalar(1);
|
||||||
|
if (matrix_norm == RealScalar(0)) return RealScalar(0);
|
||||||
|
if (dec.rows() == 1) return RealScalar(1);
|
||||||
|
const RealScalar inverse_matrix_norm = rcond_invmatrix_L1_norm_estimate(dec);
|
||||||
|
return (inverse_matrix_norm == RealScalar(0) ? RealScalar(0)
|
||||||
|
: (RealScalar(1) / inverse_matrix_norm) / matrix_norm);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
} // namespace Eigen
|
} // namespace Eigen
|
||||||
|
Loading…
x
Reference in New Issue
Block a user