removed typename because MacOS gcc 4.2 complained
							parent
							
								
									71a7ddb354
								
							
						
					
					
						commit
						872b145b16
					
				|  | @ -15,7 +15,7 @@ using namespace gtsam; | |||
| namespace gtsam { | ||||
| 
 | ||||
| /* ************************************************************************* */ | ||||
| void optimize2(const typename BayesTree<GaussianConditional>::sharedClique& clique, double threshold, | ||||
| void optimize2(const BayesTree<GaussianConditional>::sharedClique& clique, double threshold, | ||||
| 		vector<bool>& changed, const vector<bool>& replaced, Permuted<VectorValues>& delta, int& count) { | ||||
| 	// if none of the variables in this clique (frontal and separator!) changed
 | ||||
| 	// significantly, then by the running intersection property, none of the
 | ||||
|  | @ -85,7 +85,7 @@ void optimize2(const typename BayesTree<GaussianConditional>::sharedClique& cliq | |||
|     } | ||||
| 
 | ||||
|     // Recurse to children
 | ||||
|     BOOST_FOREACH(const typename BayesTree<GaussianConditional>::sharedClique& child, clique->children_) { | ||||
|     BOOST_FOREACH(const BayesTree<GaussianConditional>::sharedClique& child, clique->children_) { | ||||
|       optimize2(child, threshold, changed, replaced, delta, count); | ||||
|     } | ||||
| 	} | ||||
|  | @ -93,14 +93,14 @@ void optimize2(const typename BayesTree<GaussianConditional>::sharedClique& cliq | |||
| 
 | ||||
| /* ************************************************************************* */ | ||||
| // fast full version without threshold
 | ||||
| void optimize2(const typename BayesTree<GaussianConditional>::sharedClique& clique, VectorValues& delta) { | ||||
| void optimize2(const BayesTree<GaussianConditional>::sharedClique& clique, VectorValues& delta) { | ||||
| 
 | ||||
| 	// parents are assumed to already be solved and available in result
 | ||||
|   (*clique)->rhs(delta); | ||||
|   (*clique)->solveInPlace(delta); | ||||
| 
 | ||||
|   // Solve chilren recursively
 | ||||
|   BOOST_FOREACH(const typename BayesTree<GaussianConditional>::sharedClique& child, clique->children_) { | ||||
|   BOOST_FOREACH(const BayesTree<GaussianConditional>::sharedClique& child, clique->children_) { | ||||
| 		optimize2(child, delta); | ||||
| 	} | ||||
| } | ||||
|  | @ -115,7 +115,7 @@ void optimize2(const typename BayesTree<GaussianConditional>::sharedClique& cliq | |||
| //}
 | ||||
| 
 | ||||
| /* ************************************************************************* */ | ||||
| int optimize2(const typename BayesTree<GaussianConditional>::sharedClique& root, double threshold, const vector<bool>& keys, Permuted<VectorValues>& delta) { | ||||
| int optimize2(const BayesTree<GaussianConditional>::sharedClique& root, double threshold, const vector<bool>& keys, Permuted<VectorValues>& delta) { | ||||
| 	vector<bool> changed(keys.size(), false); | ||||
| 	int count = 0; | ||||
| 	// starting from the root, call optimize on each conditional
 | ||||
|  | @ -124,18 +124,18 @@ int optimize2(const typename BayesTree<GaussianConditional>::sharedClique& root, | |||
| } | ||||
| 
 | ||||
| /* ************************************************************************* */ | ||||
| void nnz_internal(const typename BayesTree<GaussianConditional>::sharedClique& clique, int& result) { | ||||
| void nnz_internal(const BayesTree<GaussianConditional>::sharedClique& clique, int& result) { | ||||
|   int dimR = (*clique)->dim(); | ||||
|   int dimSep = (*clique)->get_S().cols() - dimR; | ||||
|   result += ((dimR+1)*dimR)/2 + dimSep*dimR; | ||||
| 	// traverse the children
 | ||||
| 	BOOST_FOREACH(const typename BayesTree<GaussianConditional>::sharedClique& child, clique->children_) { | ||||
| 	BOOST_FOREACH(const BayesTree<GaussianConditional>::sharedClique& child, clique->children_) { | ||||
| 		nnz_internal(child, result); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| /* ************************************************************************* */ | ||||
| int calculate_nnz(const typename BayesTree<GaussianConditional>::sharedClique& clique) { | ||||
| int calculate_nnz(const BayesTree<GaussianConditional>::sharedClique& clique) { | ||||
| 	int result = 0; | ||||
| 	// starting from the root, add up entries of frontal and conditional matrices of each conditional
 | ||||
| 	nnz_internal(clique, result); | ||||
|  |  | |||
|  | @ -30,7 +30,7 @@ template <class VALUES> | |||
| class GaussianISAM2 : public ISAM2<GaussianConditional, VALUES> {}; | ||||
| 
 | ||||
| // optimize the BayesTree, starting from the root
 | ||||
| void optimize2(const typename BayesTree<GaussianConditional>::sharedClique& root, VectorValues& delta); | ||||
| void optimize2(const BayesTree<GaussianConditional>::sharedClique& root, VectorValues& delta); | ||||
| 
 | ||||
| // optimize the BayesTree, starting from the root; "replaced" needs to contain
 | ||||
| // all variables that are contained in the top of the Bayes tree that has been
 | ||||
|  | @ -40,10 +40,10 @@ void optimize2(const typename BayesTree<GaussianConditional>::sharedClique& root | |||
| // and recursive backsubstitution might eventually stop if none of the changed
 | ||||
| // variables are contained in the subtree.
 | ||||
| // returns the number of variables that were solved for
 | ||||
| int optimize2(const typename BayesTree<GaussianConditional>::sharedClique& root, | ||||
| int optimize2(const BayesTree<GaussianConditional>::sharedClique& root, | ||||
|     double threshold, const std::vector<bool>& replaced, Permuted<VectorValues>& delta); | ||||
| 
 | ||||
| // calculate the number of non-zero entries for the tree starting at clique (use root for complete matrix)
 | ||||
| int calculate_nnz(const typename BayesTree<GaussianConditional>::sharedClique& clique); | ||||
| int calculate_nnz(const BayesTree<GaussianConditional>::sharedClique& clique); | ||||
| 
 | ||||
| }/// namespace gtsam
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue