本文整理汇总了C++中MatrixT::size2方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixT::size2方法的具体用法?C++ MatrixT::size2怎么用?C++ MatrixT::size2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatrixT
的用法示例。
在下文中一共展示了MatrixT::size2方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: backwardSolve
void backwardSolve(MatrixT const & R, VectorT const & y, VectorT & x)
{
for (long i2 = static_cast<long>(R.size2())-1; i2 >= 0; i2--)
{
vcl_size_t i = static_cast<vcl_size_t>(i2);
x(i) = y(i);
for (vcl_size_t j = static_cast<vcl_size_t>(i)+1; j < R.size2(); ++j)
x(i) -= R(i,j)*x(j);
x(i) /= R(i,i);
}
}
示例2: inv
inline DCMatrix inv(const MatrixT &mat, double regularizationCoeff = 0.0) {
BOOST_ASSERT(mat.size1() == mat.size2());
unsigned int n = mat.size1();
DCMatrix inv = mat; // copy data, as it will be modified below
if (regularizationCoeff != 0.0)
inv += regularizationCoeff * ublas::identity_matrix<double>(n);
std::vector<int> ipiv(n); // pivot vector, is first filled by trf, then used by tri to inverse matrix
lapack::getrf(inv,ipiv); // inv and ipiv will both be modified
lapack::getri(inv,ipiv); // afterwards, "inv" is the inverse
return inv;
}
示例3: invSym
inline DCMatrix invSym(const MatrixT &mat, double regularizationCoeff = 0.0) {
BOOST_ASSERT(mat.size1() == mat.size2());
unsigned int n = mat.size1();
DCMatrix inv = mat; // copy data, as it will be modified below
if (regularizationCoeff != 0.0)
inv += regularizationCoeff * ublas::identity_matrix<double>(n);
std::vector<int> ipiv(n); // pivot vector, is first filled by trf, then used by tri to inverse matrix
// TODO (9): use "po..." (po=positive definite matrix) instead if "sy..." (symmetric indefinite matrix) to make it faster
lapack::sytrf('U',inv,ipiv); // inv and ipiv will both be modified
lapack::sytri('U',inv,ipiv); // afterwards, "inv" is the real inverse, but only the upper elements are valid!!!
ublas::symmetric_adaptor<DCMatrix, ublas::upper> iSym(inv);
return iSym; // copies upper matrix to lower
}
示例4: init
ilut_precond(MatrixT const & mat, ilut_tag const & tag) : tag_(tag), LU_(mat.size1(), mat.size2())
{
//initialize preconditioner:
//std::cout << "Start CPU precond" << std::endl;
init(mat);
//std::cout << "End CPU precond" << std::endl;
}
示例5: LLT
ichol0_precond(MatrixT const & mat, ichol0_tag const & tag) : tag_(tag), LLT(mat.size1(), mat.size2(), viennacl::context(viennacl::MAIN_MEMORY))
{
//initialize preconditioner:
//std::cout << "Start CPU precond" << std::endl;
init(mat);
//std::cout << "End CPU precond" << std::endl;
}