当前位置: 首页>>代码示例>>C++>>正文


C++ Mat::is_square方法代码示例

本文整理汇总了C++中Mat::is_square方法的典型用法代码示例。如果您正苦于以下问题:C++ Mat::is_square方法的具体用法?C++ Mat::is_square怎么用?C++ Mat::is_square使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mat的用法示例。


在下文中一共展示了Mat::is_square方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sum_self_transpose

 SpdMatrix sum_self_transpose(const Mat &A){
   assert(A.is_square());
   uint n = A.nrow();
   Spd ans(n, 0.0);
   for(uint i=0; i<n; ++i){
     for(uint j=0; j<i; ++j){
       ans(i,j) = ans(j,i) = A(i,j) + A(j,i);}}
   return ans;
 }
开发者ID:Hkey1,项目名称:boom,代码行数:9,代码来源:SpdMatrix.cpp

示例2: ans

   SpdMatrix chol2inv(const Mat &L){
     assert(L.is_square());
     int n = L.nrow();
     SpdMatrix ans(L, false);
     int info=0;

     dpotri_("L", &n, ans.data(), &n, &info);
     for(int i=0; i<n; ++i){
       for(int j=0; j<i; ++j){
         ans(j,i) = ans(i,j);}}
     return ans;
   }
开发者ID:Hkey1,项目名称:boom,代码行数:12,代码来源:SpdMatrix.cpp

示例3:

inline
void
op_trimat::apply_htrans
  (
        Mat<eT>& out,
  const Mat<eT>& A,
  const bool     upper,
  const typename arma_cx_only<eT>::result* junk
  )
  {
  arma_extra_debug_sigprint();
  arma_ignore(junk);
  
  arma_debug_check( (A.is_square() == false), "trimatu()/trimatl(): given matrix must be square sized" );
  
  const uword N = A.n_rows;
  
  if(&out != &A)
    {
    out.copy_size(A);
    }
  
  if(upper)
    {
    // Upper triangular: but since we're transposing, we're taking the lower
    // triangular and putting it in the upper half.
    for(uword row = 0; row < N; ++row)
      {
      eT* out_colptr = out.colptr(row);
      
      for(uword col = 0; col <= row; ++col)
        {
        //out.at(col, row) = std::conj( A.at(row, col) );
        out_colptr[col] = std::conj( A.at(row, col) );
        }
      }
    }
  else
    {
    // Lower triangular: but since we're transposing, we're taking the upper
    // triangular and putting it in the lower half.
    for(uword row = 0; row < N; ++row)
      {
      for(uword col = row; col < N; ++col)
        {
        out.at(col, row) = std::conj( A.at(row, col) );
        }
      }
    }
  
  op_trimat::fill_zeros(out, upper);
  }
开发者ID:mrlspl,项目名称:biped-library,代码行数:52,代码来源:op_trimat_meat.hpp

示例4: uword

inline
bool
op_chol::apply_direct(Mat<typename T1::elem_type>& out, const Base<typename T1::elem_type,T1>& A_expr, const uword layout)
  {
  arma_extra_debug_sigprint();
  
  out = A_expr.get_ref();
  
  arma_debug_check( (out.is_square() == false), "chol(): given matrix must be square sized" );
  
  if(out.is_empty())  { return true; }
  
  uword KD = 0;
  
  const bool is_band = (auxlib::crippled_lapack(out)) ? false : ((layout == 0) ? band_helper::is_band_upper(KD, out, uword(32)) : band_helper::is_band_lower(KD, out, uword(32)));
  
  const bool status = (is_band) ? auxlib::chol_band(out, KD, layout) : auxlib::chol(out, layout);
  
  return status;
  }
开发者ID:mm318,项目名称:mrg-cpp,代码行数:20,代码来源:op_chol_meat.hpp


注:本文中的Mat::is_square方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。