Commit 29349639 authored by Jack Poulson's avatar Jack Poulson

Shortening SparseLDLFactorization to SparseLDL and updating the documentation.

parent caa0eeab
......@@ -347,23 +347,22 @@ OpenMP threads is detected as greater than one).
ldl_control.SetFactorizationType(catamari::kCholeskyFactorization);
// Factor the matrix.
catamari::SparseLDLFactorization<double> factorization;
const catamari::LDLResult result = factorization.Factor(matrix, ldl_control);
catamari::SparseLDL<double> ldl;
const catamari::SparseLDLResult result = ldl.Factor(matrix, ldl_control);
// Solve a linear system using the factorization.
catamari::BlasMatrix<double> right_hand_sides;
right_hand_sides.Resize(num_rows, num_rhs);
// The (i, j) entry of the right-hand side can easily be read or modified, e.g.:
// right_hand_sides(i, j) = 1.;
factorization.Solve(&right_hand_sides.view);
ldl.Solve(&right_hand_sides.view);
// Alternatively, one can solve using iterative-refinement, e.g., using:
catamari::RefinedSolveControl<double> refined_solve_control;
refined_solve_control.relative_tol = 1e-15;
refined_solve_control.max_iters = 3;
refined_solve_control.verbose = true;
factorization.RefinedSolve(
matrix, refined_solve_control, &right_hand_sides.view);
ldl.RefinedSolve(matrix, refined_solve_control, &right_hand_sides.view);
Catamari's sparse-direct solver (like CHOLMOD before it [ChenEtAl-2008]_),
by default, dynamically chooses between a
......@@ -381,7 +380,7 @@ control structure from its default value of
There is also support for efficiently factoring sequences of matrices with
identical sparsity patterns, but different numerical values, via the member
function
:samp:`catamari::SparseLDLFactorization<Field>::RefactorWithFixedSparsityPattern(const catamari::CoordinateMatrix<Field>& matrix)`.
:samp:`catamari::SparseLDL<Field>::RefactorWithFixedSparsityPattern(const catamari::CoordinateMatrix<Field>& matrix)`.
Such a technique is important for an efficient implementation of an Interior
Point Method.
......@@ -395,7 +394,7 @@ using a complex :math:`LDL^T` factorization).
Determinantal Point Process sampling
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Catamari's
`Determinantal Point Process <https://en.wikipedia.org/wiki/Determinantal_point_process>`_ [Macchi-1975]_
`Determinantal Point Process <https://en.wikipedia.org/wiki/Determinantal_point_process>`_ [Macchi-1975]_ [HoughEtAl-2006]_
samplers all operate directly on the *marginal kernel matrix*: if
:math:`P` is a determinantal point process with a ground set of cardinality
:math:`n` (so that we may identify the ground set with indices
......@@ -600,8 +599,8 @@ chooses between a right-looking
multifrontal method and an up-looking simplicial approach based upon the
arithmetic intensity of the factorization.
This default strategy can be overridden by modifying the
:samp:`catamari::LDLControl::supernodal_strategy` member variable of the control
structure from its default value of
:samp:`catamari::SparseLDLControl::supernodal_strategy` member variable of the
control structure from its default value of
:samp:`catamari::kAdaptiveSupernodalStrategy` to either
:samp:`catamari::kSupernodalFactorization` or
:samp:`catamari::kScalarFactorization`.
......@@ -620,4 +619,6 @@ References
.. [Higham-1998] Nicholas J. Higham, Factorizing complex symmetric matrices with positive definite real and imaginary parts, Mathematics of Computation, 64(224), pp. 1591--1599, 1998. URL: https://www.ams.org/journals/mcom/1998-67-224/S0025-5718-98-00978-8/S0025-5718-98-00978-8.pdf
.. [Macchi-1975] O. Macchi, The coincidence approach to stochastic point processes. Adv. Appl. Probab., 7(83), pp. 83--122.
.. [HoughEtAl-2006] J. Ben Hough, Manjunath Krishnapur, Yuval Peres, and Balint Virag, Determinantal Processes and Independence, Probability Surveys, Vol. 3, pp. 206--229, 2006. DOI: http://dx.doi.org/10.1214/154957806000000078
.. [Macchi-1975] O. Macchi, The coincidence approach to stochastic point processes. Adv. Appl. Probab., 7(83), pp. 83--122. DOI: https://doi.org/10.2307/1425855
......@@ -193,9 +193,8 @@ Experiment RunMatrixMarketTest(const std::string& filename,
}
quotient::Timer factorization_timer;
factorization_timer.Start();
catamari::SparseLDLFactorization<Field> ldl_factorization;
const catamari::SparseLDLResult result =
ldl_factorization.Factor(*matrix, ldl_control);
catamari::SparseLDL<Field> ldl;
const catamari::SparseLDLResult result = ldl.Factor(*matrix, ldl_control);
experiment.factorization_seconds = factorization_timer.Stop();
if (result.num_successful_pivots < num_rows) {
std::cout << " Failed factorization after " << result.num_successful_pivots
......@@ -224,7 +223,7 @@ Experiment RunMatrixMarketTest(const std::string& filename,
BlasMatrix<Field> solution = right_hand_side;
quotient::Timer solve_timer;
solve_timer.Start();
ldl_factorization.Solve(&solution.view);
ldl.Solve(&solution.view);
experiment.solve_seconds = solve_timer.Stop();
// Compute the residual.
......
......@@ -768,15 +768,15 @@ Experiment RunTest(SpeedProfile profile, const double& omega,
std::cout << " Running factorization..." << std::endl;
}
timer.Start();
catamari::SparseLDLFactorization<Field> ldl_factorization;
catamari::SparseLDL<Field> ldl;
catamari::SparseLDLResult result;
if (analytical_ordering) {
catamari::SymmetricOrdering ordering;
catamari::UnitReachNestedDissection2D(num_x_elements, num_y_elements,
&ordering);
result = ldl_factorization.Factor(matrix, ordering, ldl_control);
result = ldl.Factor(matrix, ordering, ldl_control);
} else {
result = ldl_factorization.Factor(matrix, ldl_control);
result = ldl.Factor(matrix, ldl_control);
}
experiment.factorization_seconds = timer.Stop();
if (result.num_successful_pivots < num_rows) {
......@@ -797,7 +797,7 @@ Experiment RunTest(SpeedProfile profile, const double& omega,
}
BlasMatrix<Field> solution = right_hand_sides;
timer.Start();
ldl_factorization.Solve(&solution.view);
ldl.Solve(&solution.view);
experiment.solve_seconds = timer.Stop();
if (print_progress) {
......@@ -834,8 +834,7 @@ Experiment RunTest(SpeedProfile profile, const double& omega,
}
BlasMatrix<Field> solution = right_hand_sides;
timer.Start();
ldl_factorization.RefinedSolve(matrix, refined_solve_control,
&solution.view);
ldl.RefinedSolve(matrix, refined_solve_control, &solution.view);
experiment.refined_solve_seconds = timer.Stop();
if (print_progress) {
......
......@@ -944,15 +944,15 @@ Experiment RunTest(SpeedProfile profile, const double& omega,
std::cout << " Running factorization..." << std::endl;
}
timer.Start();
catamari::SparseLDLFactorization<Field> ldl_factorization;
catamari::SparseLDL<Field> ldl;
catamari::SparseLDLResult result;
if (analytical_ordering) {
catamari::SymmetricOrdering ordering;
catamari::UnitReachNestedDissection3D(num_x_elements, num_y_elements,
num_z_elements, &ordering);
result = ldl_factorization.Factor(matrix, ordering, ldl_control);
result = ldl.Factor(matrix, ordering, ldl_control);
} else {
result = ldl_factorization.Factor(matrix, ldl_control);
result = ldl.Factor(matrix, ldl_control);
}
experiment.factorization_seconds = timer.Stop();
if (result.num_successful_pivots < num_rows) {
......@@ -973,7 +973,7 @@ Experiment RunTest(SpeedProfile profile, const double& omega,
}
BlasMatrix<Field> solution = right_hand_sides;
timer.Start();
ldl_factorization.Solve(&solution.view);
ldl.Solve(&solution.view);
experiment.solve_seconds = timer.Stop();
if (print_progress) {
......@@ -1010,8 +1010,7 @@ Experiment RunTest(SpeedProfile profile, const double& omega,
}
BlasMatrix<Field> solution = right_hand_sides;
timer.Start();
ldl_factorization.RefinedSolve(matrix, refined_solve_control,
&solution.view);
ldl.RefinedSolve(matrix, refined_solve_control, &solution.view);
experiment.refined_solve_seconds = timer.Stop();
if (print_progress) {
......@@ -1054,7 +1053,7 @@ Experiment RunTest(SpeedProfile profile, const double& omega,
std::cout << " Running (re)factorization..." << std::endl;
}
timer.Start();
result = ldl_factorization.RefactorWithFixedSparsityPattern(matrix);
result = ldl.RefactorWithFixedSparsityPattern(matrix);
experiment.refactorization_seconds = timer.Stop();
if (result.num_successful_pivots < num_rows) {
std::cout << " Failed refactorization after "
......@@ -1068,7 +1067,7 @@ Experiment RunTest(SpeedProfile profile, const double& omega,
std::cout << " Running solve..." << std::endl;
}
BlasMatrix<Field> solution = right_hand_sides;
ldl_factorization.Solve(&solution.view);
ldl.Solve(&solution.view);
if (print_progress) {
// Print the solution.
......@@ -1103,8 +1102,7 @@ Experiment RunTest(SpeedProfile profile, const double& omega,
std::cout << " Running iteratively-refined solve..." << std::endl;
}
BlasMatrix<Field> solution = right_hand_sides;
ldl_factorization.RefinedSolve(matrix, refined_solve_control,
&solution.view);
ldl.RefinedSolve(matrix, refined_solve_control, &solution.view);
if (print_progress) {
// Print the solution.
......
......@@ -16,8 +16,8 @@
namespace catamari {
template <class Field>
SparseLDLResult SparseLDLFactorization<Field>::Factor(
const CoordinateMatrix<Field>& matrix, const SparseLDLControl& control) {
SparseLDLResult SparseLDL<Field>::Factor(const CoordinateMatrix<Field>& matrix,
const SparseLDLControl& control) {
scalar_factorization.reset();
supernodal_factorization.reset();
......@@ -87,9 +87,9 @@ SparseLDLResult SparseLDLFactorization<Field>::Factor(
}
template <class Field>
SparseLDLResult SparseLDLFactorization<Field>::Factor(
const CoordinateMatrix<Field>& matrix, const SymmetricOrdering& ordering,
const SparseLDLControl& control) {
SparseLDLResult SparseLDL<Field>::Factor(const CoordinateMatrix<Field>& matrix,
const SymmetricOrdering& ordering,
const SparseLDLControl& control) {
scalar_factorization.reset();
supernodal_factorization.reset();
......@@ -117,7 +117,7 @@ SparseLDLResult SparseLDLFactorization<Field>::Factor(
}
template <class Field>
SparseLDLResult SparseLDLFactorization<Field>::RefactorWithFixedSparsityPattern(
SparseLDLResult SparseLDL<Field>::RefactorWithFixedSparsityPattern(
const CoordinateMatrix<Field>& matrix) {
if (is_supernodal) {
return supernodal_factorization->RefactorWithFixedSparsityPattern(matrix);
......@@ -127,8 +127,7 @@ SparseLDLResult SparseLDLFactorization<Field>::RefactorWithFixedSparsityPattern(
}
template <class Field>
void SparseLDLFactorization<Field>::Solve(
BlasMatrixView<Field>* right_hand_sides) const {
void SparseLDL<Field>::Solve(BlasMatrixView<Field>* right_hand_sides) const {
if (is_supernodal) {
supernodal_factorization->Solve(right_hand_sides);
} else {
......@@ -137,7 +136,7 @@ void SparseLDLFactorization<Field>::Solve(
}
template <class Field>
Int SparseLDLFactorization<Field>::RefinedSolve(
Int SparseLDL<Field>::RefinedSolve(
const CoordinateMatrix<Field>& matrix,
const RefinedSolveControl<Real>& control,
BlasMatrixView<Field>* right_hand_sides) const {
......@@ -288,7 +287,7 @@ Int SparseLDLFactorization<Field>::RefinedSolve(
}
template <class Field>
void SparseLDLFactorization<Field>::LowerTriangularSolve(
void SparseLDL<Field>::LowerTriangularSolve(
BlasMatrixView<Field>* right_hand_sides) const {
if (is_supernodal) {
supernodal_factorization->LowerTriangularSolve(right_hand_sides);
......@@ -298,7 +297,7 @@ void SparseLDLFactorization<Field>::LowerTriangularSolve(
}
template <class Field>
void SparseLDLFactorization<Field>::DiagonalSolve(
void SparseLDL<Field>::DiagonalSolve(
BlasMatrixView<Field>* right_hand_sides) const {
if (is_supernodal) {
supernodal_factorization->DiagonalSolve(right_hand_sides);
......@@ -308,7 +307,7 @@ void SparseLDLFactorization<Field>::DiagonalSolve(
}
template <class Field>
void SparseLDLFactorization<Field>::LowerTransposeTriangularSolve(
void SparseLDL<Field>::LowerTransposeTriangularSolve(
BlasMatrixView<Field>* right_hand_sides) const {
if (is_supernodal) {
supernodal_factorization->LowerTransposeTriangularSolve(right_hand_sides);
......@@ -318,8 +317,8 @@ void SparseLDLFactorization<Field>::LowerTransposeTriangularSolve(
}
template <class Field>
void SparseLDLFactorization<Field>::PrintLowerFactor(const std::string& label,
std::ostream& os) const {
void SparseLDL<Field>::PrintLowerFactor(const std::string& label,
std::ostream& os) const {
if (is_supernodal) {
supernodal_factorization->PrintLowerFactor(label, os);
} else {
......@@ -328,8 +327,8 @@ void SparseLDLFactorization<Field>::PrintLowerFactor(const std::string& label,
}
template <class Field>
void SparseLDLFactorization<Field>::PrintDiagonalFactor(
const std::string& label, std::ostream& os) const {
void SparseLDL<Field>::PrintDiagonalFactor(const std::string& label,
std::ostream& os) const {
if (is_supernodal) {
supernodal_factorization->PrintDiagonalFactor(label, os);
} else {
......
......@@ -66,7 +66,7 @@ struct RefinedSolveControl {
// A wrapper for the scalar and supernodal factorization data structures.
template <class Field>
class SparseLDLFactorization {
class SparseLDL {
public:
// The underlying real datatype of the scalar type.
typedef ComplexBase<Field> Real;
......
......@@ -59,21 +59,21 @@ void RunTest(Int num_x_elements, Int num_y_elements, bool analytical_ordering,
catamari::EuclideanNorm(right_hand_sides.ConstView());
// Factor the matrix.
catamari::SparseLDLFactorization<Field> ldl_factorization;
catamari::SparseLDL<Field> ldl;
catamari::SparseLDLResult result;
if (analytical_ordering) {
catamari::SymmetricOrdering ordering;
catamari::UnitReachNestedDissection2D(num_x_elements - 1,
num_y_elements - 1, &ordering);
result = ldl_factorization.Factor(matrix, ordering, ldl_control);
result = ldl.Factor(matrix, ordering, ldl_control);
} else {
result = ldl_factorization.Factor(matrix, ldl_control);
result = ldl.Factor(matrix, ldl_control);
}
REQUIRE(result.num_successful_pivots == num_rows);
// Solve a random linear system.
BlasMatrix<Field> solution = right_hand_sides;
ldl_factorization.Solve(&solution.view);
ldl.Solve(&solution.view);
// Compute the residual.
BlasMatrix<Field> residual = right_hand_sides;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment