本文整理汇总了C++中BaseMatrix::Nrows方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseMatrix::Nrows方法的具体用法?C++ BaseMatrix::Nrows怎么用?C++ BaseMatrix::Nrows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseMatrix
的用法示例。
在下文中一共展示了BaseMatrix::Nrows方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
void IdentityMatrix<TYPE>::Solve(const BaseMatrix<TYPE>& in, BaseMatrix<TYPE>& out) const
{
int n = GeneralMatrix<TYPE>::nrows;
assert(n == in.Nrows());
assert(in.Ncols() == out.Ncols() && in.Nrows() == out.Nrows());
std::shared_ptr<LinearEquationSolver<TYPE> > solver = this->MakeSolver();
solver->Solve(in, out);
}
示例2: NPDException
void CholeskySolver<TYPE>::Solve(const BaseMatrix<TYPE> &in, BaseMatrix<TYPE> &out) const
{
assert(in.Nrows() == lm.Ncols());
assert(in.Nrows() == out.Nrows() && in.Ncols() == out.Ncols());
if (LinearEquationSolver<TYPE>::fail)
{
Singleton<Tracer>::Instance()->AddMessage("CholeskySolver::Solve(in, out)");
throw NPDException(SimpleSolver<TYPE>::mat);
}
Matrix<TYPE> temp(out.Nrows(), out.Ncols());
lm.Solve(in, temp);
t(lm).Solve(temp, out);
}
示例3: LogicError
void LUsolverNoPivot<TYPE>::Solve(const BaseMatrix<TYPE> &in, BaseMatrix<TYPE> &out) const
{
assert(in.Nrows() == combine.Ncols());
assert(in.Nrows() == out.Nrows() && in.Ncols() == out.Ncols());
if (LinearEquationSolver<TYPE>::IsFailed())
{
Singleton<Tracer>::Instance()->AddMessage("LUsolverNoPivot::Solve");
throw LogicError("LUsolverNoPivot: LU decomposition is failed");
}
Matrix<TYPE> t(in.Nrows(), in.Ncols());
LUsolver<TYPE>::lm.Solve(in, t);
LUsolver<TYPE>::um.Solve(t, out);
}
示例4: SingularException
void BandLUsolverPartialPivot<TYPE>::Solve(const BaseMatrix<TYPE> &in, BaseMatrix<TYPE> &out) const
{
assert(in.Nrows() == combine.Ncols());
assert(in.Nrows() == out.Nrows() && in.Ncols() == out.Ncols());
if (LinearEquationSolver<TYPE>::IsFailed())
{
Singleton<Tracer>::Instance()->AddMessage("BandLUsolverPartialPivot::Solve");
throw SingularException(BandLUsolver<TYPE>::mat);
}
const PermuteMatrix<TYPE> &lp = BandLUsolver<TYPE>::left;
Matrix<TYPE> t(in.Nrows(), in.Ncols());
lm.Solve(c_perm(lp, in), t);
um.Solve(t, out);
}
示例5: lm
BandLUsolverPartialPivot<TYPE>::BandLUsolverPartialPivot(const BaseMatrix<TYPE> &bm, const TYPE &e) :
BandLUsolver<TYPE>(bm, bm.BandWidth().Lower(), std::min(bm.BandWidth().Lower() + bm.BandWidth().Upper(), bm.Nrows() - 1), e),
lm(bm.Nrows()), um(bm.Nrows(), BandLUsolver<TYPE>::ubw),
combine(lm, um)
{
lm << bm;
um << bm;
static const TYPE one(1);
for (int i = 1; i <= bm.Nrows(); ++i)
{
lm(i, i) = one;
}
BandLUdecomposion();
}
示例6: assert
void SymmetricBandMatrix<TYPE>::operator<<(const BaseMatrix<TYPE>& bm)
{
if (&bm == this)
{
return;
}
assert(bm.Nrows() == GeneralMatrix<TYPE>::nrows && bm.Ncols() == GeneralMatrix<TYPE>::ncols);
int n = GeneralMatrix<TYPE>::nrows, lb = this->BandWidth().Lower();
if (bm.Search(*this) == 0)
{
for (int i = 0; i <= lb; ++i)
{
for (int j = 1; j <= n - i; ++j)
{
operator()(j + i, j) = bm(j + i, j);
}
}
}
else
{
SymmetricBandMatrix<TYPE> t(n, lb);
t << bm;
this->Swap(t);
}
}
示例7: SingularException
void ConstantSolver<TYPE>::Solve(const BaseMatrix<TYPE> &in, BaseMatrix<TYPE> &out) const
{
if (LinearEquationSolver<TYPE>::IsFailed())
{
Singleton<Tracer>::Instance()->AddMessage("ConstantSolver::Solve");
throw SingularException(SimpleSolver<TYPE>::mat);
}
int r = SimpleSolver<TYPE>::mat.Nrows();
int c = SimpleSolver<TYPE>::mat.Ncols();
assert(r == 1 && c == 1 && c == in.Nrows());
assert(in.Ncols() == out.Ncols() && in.Nrows() == out.Nrows());
const BaseMatrix<TYPE> &m = SimpleSolver<TYPE>::mat;
for (int i = 1; i <= c; ++i)
{
for (int j = r; j >= 1; --j)
{
out(j, i) = in(j, i) / m(j, j);
}
}
}
示例8: SingularException
void IdentitySolver<TYPE>::Solve(const BaseMatrix<TYPE> &in, BaseMatrix<TYPE> &out) const
{
if (LinearEquationSolver<TYPE>::IsFailed())
{
Singleton<Tracer>::Instance()->AddMessage("IdentitySolver::Solve");
throw SingularException(SimpleSolver<TYPE>::mat);
}
int n = SimpleSolver<TYPE>::mat.Nrows();
assert(n == in.Nrows());
assert(in.Ncols() == out.Ncols() && in.Nrows() == out.Nrows());
TYPE t = SimpleSolver<TYPE>::mat(1, 1);
int c = in.Ncols();
for (int i = 1; i <= c; ++i)
{
for (int j = n; j >= 1; --j)
{
out(j, i) = in(j, i) / t;
}
}
}
示例9: assert
void CholeskySolver<TYPE>::CholeskyDecomposition(const BaseMatrix<TYPE> &bm)
{
assert(bm.Nrows() == bm.Ncols());
int n = lm.Nrows();
const TYPE &e = SimpleSolver<TYPE>::epsilon;
TYPE temp;
for (int i = 1; i <= n; ++i)
{
if (i == 1)
{
temp = bm(i, i);
}
else
{
temp = bm(i, i) - (c_sub(lm, i, i, 1, i - 1) * t(c_sub(lm, i, i, 1, i - 1)))(1, 1);
}
if (temp <= e)
{
LinearEquationSolver<TYPE>::fail = true;
return;
}
else
{
lm(i, i) = std::sqrt(temp);
for (int j = i + 1; j <= n; ++j)
{
if (i == 1)
{
lm(j, i) = bm(j, i) / lm(i, i);
}
else
{
lm(j, i) = (bm(j, i) - (c_sub(lm, i, i, 1, i - 1) * t(c_sub(lm, j, j, 1, i - 1)))(1, 1)) / lm(i, i);
}
}
}
}
}