diff --git a/gtsam/inference/inference-inl.h b/gtsam/inference/inference-inl.h index 0ed2d1ec7..5c5cedbc3 100644 --- a/gtsam/inference/inference-inl.h +++ b/gtsam/inference/inference-inl.h @@ -33,6 +33,7 @@ namespace inference { template Permutation::shared_ptr PermutationCOLAMD( const VariableIndex& variableIndex, const CONSTRAINED& constrainLast, bool forceOrder) { + gttic(PermutationCOLAMD_constrained); size_t n = variableIndex.size(); std::vector cmember(n, 0); @@ -59,6 +60,7 @@ Permutation::shared_ptr PermutationCOLAMD( template Permutation::shared_ptr PermutationCOLAMDGrouped( const VariableIndex& variableIndex, const CONSTRAINED_MAP& constraints) { + gttic(PermutationCOLAMD_grouped); size_t n = variableIndex.size(); std::vector cmember(n, 0); @@ -74,6 +76,7 @@ Permutation::shared_ptr PermutationCOLAMDGrouped( /* ************************************************************************* */ inline Permutation::shared_ptr PermutationCOLAMD(const VariableIndex& variableIndex) { + gttic(PermutationCOLAMD_unconstrained); size_t n = variableIndex.size(); std::vector cmember(n, 0); return PermutationCOLAMD_(variableIndex, cmember); diff --git a/gtsam/inference/inference.cpp b/gtsam/inference/inference.cpp index 3cddc4cfc..f93402033 100644 --- a/gtsam/inference/inference.cpp +++ b/gtsam/inference/inference.cpp @@ -33,6 +33,9 @@ namespace inference { /* ************************************************************************* */ Permutation::shared_ptr PermutationCOLAMD_(const VariableIndex& variableIndex, std::vector& cmember) { + gttic(PermutationCOLAMD_internal); + + gttic(Prepare); size_t nEntries = variableIndex.nEntries(), nFactors = variableIndex.nFactors(), nVars = variableIndex.size(); // Convert to compressed column major format colamd wants it in (== MATLAB format!) int Alen = ccolamd_recommended(nEntries, nFactors, nVars); /* colamd arg 3: size of the array A */ @@ -69,9 +72,12 @@ Permutation::shared_ptr PermutationCOLAMD_(const VariableIndex& variableIndex, s int stats[CCOLAMD_STATS]; /* colamd arg 7: colamd output statistics and error codes */ + gttoc(Prepare); + // call colamd, result will be in p /* returns (1) if successful, (0) otherwise*/ if(nVars > 0) { + gttic(ccolamd); int rv = ccolamd(nFactors, nVars, Alen, &A[0], &p[0], knobs, stats, &cmember[0]); if(rv != 1) throw runtime_error((boost::format("ccolamd failed with return value %1%")%rv).str()); @@ -79,6 +85,7 @@ Permutation::shared_ptr PermutationCOLAMD_(const VariableIndex& variableIndex, s // ccolamd_report(stats); + gttic(Create_permutation); // Convert elimination ordering in p to an ordering Permutation::shared_ptr permutation(new Permutation(nVars)); for (Index j = 0; j < nVars; j++) { @@ -89,6 +96,7 @@ Permutation::shared_ptr PermutationCOLAMD_(const VariableIndex& variableIndex, s if(debug) cout << "COLAMD: " << j << "->" << p[j] << endl; } if(debug) cout << "COLAMD: p[" << nVars << "] = " << p[nVars] << endl; + gttoc(Create_permutation); return permutation; } diff --git a/gtsam/nonlinear/Ordering.cpp b/gtsam/nonlinear/Ordering.cpp index 6e8f70a0d..1f7c5375b 100644 --- a/gtsam/nonlinear/Ordering.cpp +++ b/gtsam/nonlinear/Ordering.cpp @@ -34,6 +34,7 @@ Ordering::Ordering(const std::list & L):nVars_(0) { /* ************************************************************************* */ void Ordering::permuteWithInverse(const Permutation& inversePermutation) { + gttic(Ordering_permuteWithInverse); BOOST_FOREACH(Ordering::value_type& key_order, *this) { key_order.second = inversePermutation[key_order.second]; }