include/geometry/linalg.hpp
author Aravindakshan Babu <akshan@stanford.edu>
Tue, 17 Aug 2010 22:19:19 -0700
branchdev
changeset 219 5311343eb2f5
parent 19 efa14432761a
permissions -rw-r--r--
Added documentation for the python classes Point and PersistenceDiagram. Removed the __sub__ method for PersistenceDiagram. Minor renaming. Renamed BottleneckDistance to bottleneck_distance. Renamed intervals iterator for PersistenceDiagram to points. Seems in better conformance with usage.

template<class ValueType_>
typename LinearAlgebra<ValueType_>::ValueType 					
LinearAlgebra<ValueType_>::
determinant(const MatrixType& a)
{
	using namespace boost::numeric::ublas;
	MatrixType m = a;
	lu_factorize(m);
	return determinant(triangular_adaptor<MatrixType, upper>(m));
}

template<class ValueType_>
void
LinearAlgebra<ValueType_>::
solve(const MatrixType& a, const VectorType& b, VectorType& x)
{
	using namespace boost::numeric::ublas;
	MatrixType m = a;
	x = b;
	lu_factorize(m);
	//lu_substitute(m, x);
	inplace_solve(m,x,unit_lower_tag());
	inplace_solve(m,x,upper_tag());
}


/* Private */
template<class ValueType_>
template<class TriangularType_>
typename LinearAlgebra<ValueType_>::ValueType 					
LinearAlgebra<ValueType_>::
determinant(const boost::numeric::ublas::triangular_adaptor<MatrixType, TriangularType_>& t)
{
	ValueType res = ValueType(1);
	for (typename MatrixType::size_type i = 0; i < t.size1(); ++i)
		res *= t(i,i);
	return res;
}