代码之家  ›  专栏  ›  技术社区  ›  rcollyer

无法确定“与”operator<“不匹配”编译错误的原因

  •  3
  • rcollyer  · 技术社区  · 14 年前

    我正在使用代码源 implementation 矢量信号图像处理库( vsipl++ )我编写了一个函数,它应该返回[i+a*a]^-1b,其中i是单位矩阵,a和b是兼容的平方矩阵,如下所示:

    namespace vsipl {
    
    template< class T1, class T2, class O1, class O2, class L1, class L2,
         template< dimension_type, class, class, class > class B1,
         template< dimension_type, class, class, class > class B2 >
    Matrix< typename Promotion< T1, T2 >::type, 
            B1< 2, typename Promotion< T1, T2 >::type, O1, L1 > > 
    inv_mult( typename Promotion< T1, T2 >::type a, 
           Matrix< T1, B1< 2, T1, O1, L1 > > const& A,
           Matrix< T2, B2< 2, T2, O2, L2 > > const& B
         ) 
    {
     typedef typename Promotion< T1, T2 >::type value_type;
     typedef Matrix< value_type, B1< 2, value_type, O1, L1 > > ret_type;
     typedef lud< value_type, by_reference > lud_type;
    
     ret_type ret(A.size(0),A.size(1),0), denom(A.size(0),A.size(1),0);
    
     //I + a*A
     denom.diag() = 1;
     denom = denom + a*A;
    
     lud_type ld( denom.size() );
     ld.decompose( denom );
    
     //as a side effect of using LAPACK as a back end, this requires a template
     //param to indicate precisely what is being solved.
     ld.solve< mat_ntrans >( B, ret );  // <--- Line generating error.
    
     return ret;
    }//inv_mult
    }//vsipl
    

    很明显,在vsipl++中,矩阵接受两个参数:一个类型和一个描述信息存储方式的块。块是上面模板汤的原因。此外,lud对象对矩阵a执行lu分解,然后使用分解形式a求解ax=b。

    当我尝试使用gcc(MacOS 10.6上的4.2.1和Fedora 9上的4.3.0)编译它时,我得到了以下错误

    error: no match for 'operator<' in 'ld.vsip::lud<T, by_reference>::solve [with 
     vsip::mat_op_type tr = tr, Block0 = Block0, Block1 = Block1, T = double] < mat_ntrans
    

    我试图通过消除类型来简化代码 Promotion ,需要一个数据和块类型,我得到相同的错误。

    有什么想法吗?

    1 回复  |  直到 14 年前
        1
  •  3
  •   Community CDub    7 年前

    ld.template solve< mat_ntrans >
    

    explanation