Beispiel #1
0
double luT(
	viennacl::matrix<T> &vclX,
	viennacl::vector_base<T> &vclD) {

	double logdet=-99.9;

	viennacl::linalg::lu_factorize(vclX);

	// pointer to the actual diagonal
	viennacl::vector_base<T> diagOfVar(
		vclX.handle(), vclX.size1(), 0, 
		vclX.internal_size2() + 1);

		// compute log determinant
	vclD = viennacl::linalg::element_log(diagOfVar);
	logdet = viennacl::linalg::sum(vclD);
// OPERATION_UNARY_LOG_TYPE 	
		//http://viennacl.sourceforge.net/doc/scheduler_8cpp-example.html#a11

		// put the diagonals in D, and 1's on the diagonal of L
	vclD = diagOfVar;

		//diagOfVar = T(1); // problem here
	
	return(logdet);
}
 viennacl::vector_range<viennacl::vector_base<T> > sharedCol(){
     // viennacl::vector_base<T> tmp(ptr_matrix->handle(), ptr_matrix->internal_size(), 0, 1);
     
     // std::cout << "returning column" << std::endl;
     viennacl::vector_base<T> tmp(ptr_matrix->handle(), ptr_matrix->size1(), begin, ptr_matrix->internal_size2());
     // std::cout << "got column" << std::endl;
     
     viennacl::vector_range<viennacl::vector_base<T> > v_sub(tmp, r);
     // std::cout << "got range" << std::endl;
     
     return v_sub;
 }
 viennacl::vector_range<viennacl::vector_base<T> > sharedRow(){
     // viennacl::vector_base<T> tmp(ptr_matrix->handle(), ptr_matrix->internal_size(), 0, 1);
     viennacl::vector_base<T> tmp(ptr_matrix->handle(), ptr_matrix->size2(), begin, 1);
     viennacl::vector_range<viennacl::vector_base<T> > v_sub(tmp, r);
     return v_sub;
 }
 viennacl::vector_range<viennacl::vector_base<T> > sharedVector(){
     viennacl::vector_base<T> tmp(ptr_matrix->handle(), ptr_matrix->internal_size(), 0, 1);
     viennacl::vector_range<viennacl::vector_base<T> > v_sub(tmp, r);
     return v_sub;
 }