本文整理汇总了C++中boost::num_cols方法的典型用法代码示例。如果您正苦于以下问题:C++ boost::num_cols方法的具体用法?C++ boost::num_cols怎么用?C++ boost::num_cols使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost
的用法示例。
在下文中一共展示了boost::num_cols方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mult
boost boost::mult(const boost& rhs) const {
if (rhs.num_rows() != num_cols()) {
throw std::invalid_argument("Column of left matrix does not match row of right matrix");
} else {
bnu::matrix<float> prod(num_rows(), rhs.num_cols());
bnu::noalias(prod) = bnu::prod(this->data(), rhs.data());
return std::move(boost(prod));
}
}
示例2: concat
boost boost::concat(const boost& mat) const {
if (mat.num_rows() != this->num_rows()) {
throw std::invalid_argument("Number of rows do not match");
} else {
int rows = this->num_rows();
int cols = this->num_cols();
int new_cols = cols + mat.num_cols();
bnu::matrix<float> c(rows, new_cols);
bnu::project(c, bnu::range(0, rows), bnu::range(0, cols)) = this->data();
bnu::project(c, bnu::range(0, rows), bnu::range(cols, new_cols)) = mat.data();
return std::move(boost(c));
}
}
示例3: solve_x
boost boost::solve_x(const boost& B) const {
if(this->num_rows() != this->num_cols())
throw std::invalid_argument("A must be square in Ax = B");
if(this->num_cols() != B.num_rows())
throw std::invalid_argument("B.rows must equal A.cols in Ax = B");
if(B.num_cols() != 1)
throw std::invalid_argument("B must be n x 1 vector in Ax = B");
bnu::matrix<float> A(this->data());
bnu::matrix<float> y = bnu::trans(B.data());
bnu::vector<float> b(B.num_rows());
std::copy(y.begin1(), y.end1(), b.begin());
bnu::permutation_matrix<> piv(b.size());
bnu::lu_factorize(A, piv);
bnu::lu_substitute(A, piv, b);
bnu::matrix<float> x(this->num_rows(), 1);
std::copy(b.begin(), b.end(), x.begin1());
return std::move(boost(x));
}