本文整理汇总了C++中eigen::MatrixXcd::ldlt方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixXcd::ldlt方法的具体用法?C++ MatrixXcd::ldlt怎么用?C++ MatrixXcd::ldlt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eigen::MatrixXcd
的用法示例。
在下文中一共展示了MatrixXcd::ldlt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: build_otsdf
void CCorrelationFilters::build_otsdf(struct CDataStruct *img, struct CParamStruct *params, struct CFilterStruct *filt)
{
/*
* This function implements the correlation filter design proposed in the following publications.
*
* [1] Optimal trade-off synthetic discriminant function filters for arbitrary devices, B.V.K.Kumar, D.W.Carlson, A.Mahalanobis - Optics Letters, 1994.
*
* [2] Jason Thornton, "Matching deformed and occluded iris patterns: a probabilistic model based on discriminative cues." PhD thesis, Carnegie Mellon University, Pittsburgh, PA, USA, 2007.
*
* [3] Vishnu Naresh Boddeti, Jonathon M Smereka, and B. V. K. Vijaya Kumar, "A comparative evaluation of iris and ocular recognition methods on challenging ocular images." IJCB, 2011.
*
* [4] A. Mahalanobis, B.V.K. Kumar, D. Casasent, "Minimum average correlation energy filters," Applied Optics, 1987
*
* Notes: This filter design is good when the dimensionality of the data is greater than the training sample size. Setting the filter parameter params->alpha=0 results in the popular MACE filter. However, it is usually better to set alpha to a small number rather than setting it to 0. If you use MACE cite [4].
*/
filt->params = *params;
filt->filter.size_data = params->size_filt_freq;
filt->filter.size_data_freq = params->size_filt_freq;
filt->filter.num_elements_freq = img->num_elements_freq;
params->num_elements_freq = img->num_elements_freq;
filt->filter.data_freq = new complex<double>[img->num_elements_freq*img->num_channels];
Eigen::ArrayXcd filt_freq = Eigen::ArrayXcd::Zero(params->num_elements_freq*img->num_channels);
// If not set default to 1
if (params->wpos < 1) params->wpos = 1;
filt->params.wpos = params->wpos;
compute_psd_matrix(img, params);
Eigen::MatrixXcd Y = Eigen::MatrixXcd::Zero(img->num_elements_freq*img->num_channels,img->num_data);
Eigen::MatrixXcd u = Eigen::MatrixXcd::Zero(img->num_data,1);
Eigen::MatrixXcd temp = Eigen::MatrixXcd::Zero(img->num_data,img->num_data);
Eigen::MatrixXd tmp = Eigen::MatrixXd::Zero(img->num_data,img->num_data);
Eigen::Map<Eigen::MatrixXcd> X(img->data_freq,img->num_elements_freq*img->num_channels,img->num_data);
Eigen::ArrayXXcd temp1 = Eigen::ArrayXXcd::Zero(img->num_elements_freq,img->num_channels);
Eigen::ArrayXXcd temp2 = Eigen::ArrayXXcd::Zero(img->num_elements_freq,img->num_channels);
Eigen::Vector2i num_blocks_1, num_blocks_2;
num_blocks_1 << img->num_channels,img->num_channels;
num_blocks_2 << img->num_channels,1;
for (int k=0;k<img->num_data;k++){
temp2 = X.block(0,k,img->num_elements_freq*img->num_channels,1).array();
temp2.resize(img->num_elements_freq,img->num_channels);
fusion_matrix_multiply(temp1, img->Sinv, temp2, num_blocks_1, num_blocks_2);
temp1.resize(img->num_elements_freq*img->num_channels,1);
Y.block(0,k,img->num_elements_freq*img->num_channels,1) = temp1.matrix();
temp1.resize(img->num_elements_freq,img->num_channels);
if (img->labels[k] == 1)
{
u(k) = std::complex<double>(params->wpos,0);
}
else
{
u(k) = std::complex<double>(1,0);
}
}
temp = X.conjugate().transpose()*Y;
temp = temp.ldlt().solve(u);
filt_freq = Y*temp;
Y.resize(0,0);
Eigen::Map<Eigen::ArrayXcd>(filt->filter.data_freq,img->num_elements_freq*img->num_channels) = filt_freq;
filt->filter.num_data = 1;
filt->filter.num_channels = img->num_channels;
filt->filter.ptr_data.reserve(filt->filter.num_data);
filt->filter.ptr_data_freq.reserve(filt->filter.num_data);
ifft_data(&filt->filter);
fft_data(&filt->filter);
}