本文整理汇总了C++中CKernel::get_subkernel_weights方法的典型用法代码示例。如果您正苦于以下问题:C++ CKernel::get_subkernel_weights方法的具体用法?C++ CKernel::get_subkernel_weights怎么用?C++ CKernel::get_subkernel_weights使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKernel
的用法示例。
在下文中一共展示了CKernel::get_subkernel_weights方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
const float64_t* CCombinedKernel::get_subkernel_weights(int32_t& num_weights)
{
SG_DEBUG("entering CCombinedKernel::get_subkernel_weights()\n");
num_weights = get_num_subkernels() ;
SG_FREE(subkernel_weights_buffer);
subkernel_weights_buffer = SG_MALLOC(float64_t, num_weights);
if (append_subkernel_weights)
{
SG_DEBUG("appending kernel weights\n");
int32_t i=0 ;
CListElement* current = NULL ;
CKernel* k = get_first_kernel(current);
while(k)
{
int32_t num = -1 ;
const float64_t *w = k->get_subkernel_weights(num);
ASSERT(num==k->get_num_subkernels());
for (int32_t j=0; j<num; j++)
subkernel_weights_buffer[i+j]=w[j] ;
SG_UNREF(k);
k = get_next_kernel(current);
i += num ;
}
}
else
{
SG_DEBUG("not appending kernel weights\n");
int32_t i=0 ;
CListElement* current = NULL ;
CKernel* k = get_first_kernel(current);
while(k)
{
subkernel_weights_buffer[i] = k->get_combined_kernel_weight();
SG_UNREF(k);
k = get_next_kernel(current);
i++ ;
}
}
SG_DEBUG("leaving CCombinedKernel::get_subkernel_weights()\n");
return subkernel_weights_buffer ;
}
示例2: compute_by_subkernel
void CCombinedKernel::compute_by_subkernel(
int32_t idx, float64_t * subkernel_contrib)
{
if (append_subkernel_weights)
{
int32_t i=0 ;
CListElement* current = NULL ;
CKernel* k = get_first_kernel(current);
while(k)
{
int32_t num = -1 ;
k->get_subkernel_weights(num);
if (num>1)
k->compute_by_subkernel(idx, &subkernel_contrib[i]) ;
else
subkernel_contrib[i] += k->get_combined_kernel_weight() * k->compute_optimized(idx) ;
SG_UNREF(k);
k = get_next_kernel(current);
i += num ;
}
}
else
{
int32_t i=0 ;
CListElement* current = NULL ;
CKernel* k = get_first_kernel(current);
while(k)
{
if (k->get_combined_kernel_weight()!=0)
subkernel_contrib[i] += k->get_combined_kernel_weight() * k->compute_optimized(idx) ;
SG_UNREF(k);
k = get_next_kernel(current);
i++ ;
}
}
}