本文整理汇总了C++中poco::SharedPtr::cols方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedPtr::cols方法的具体用法?C++ SharedPtr::cols怎么用?C++ SharedPtr::cols使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类poco::SharedPtr
的用法示例。
在下文中一共展示了SharedPtr::cols方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exportComponents
void SeparationTask::exportComponents() const
{
debug_assert(&phaseMatrix() &&
&magnitudeSpectraMatrix(0) &&
&gainsMatrix());
logger().debug(nameAndTaskID() + " exporting the components.");
Poco::Util::LayeredConfiguration& cfg =
BasicApplication::instance().config();
// Determine whether to export components as WAV and/or as matrix files.
bool exportAsMatrix = cfg.getBool("blissart.separation.export.matrix",
false);
if (exportAsMatrix)
logger().debug("Exporting components as matrix file(s).");
bool exportAsWave = cfg.getBool("blissart.separation.export.wave",
true);
if (exportAsWave)
logger().debug("Exporting components as waveform file(s).");
// Determine whether to use wiener reconstruction.
bool wienerRec = cfg.getBool("blissart.separation.export.wienerrec",
true);
// Compute the reconstructed matrix (WH) in case of wiener reconstruction.
Poco::SharedPtr<Matrix> reconst;
if (wienerRec) {
//reconst = new Matrix(phaseMatrix().rows(), phaseMatrix().cols());
reconst = new Matrix(magnitudeSpectraMatrix(0).rows(),
gainsMatrix().cols());
if (_nrOfSpectra > 1) {
reconst->zero();
Matrix hShifted = gainsMatrix();
for (unsigned int t = 0; t < _nrOfSpectra; ++t) {
reconst->add(magnitudeSpectraMatrix(t) * hShifted);
hShifted.shiftColumnsRight();
}
}
else {
magnitudeSpectraMatrix(0).multWithMatrix(gainsMatrix(), reconst);
}
// revert transform to reconst
reconst = revertTransforms(reconst);
}
// Retrieve desired component indices.
vector<vector<int> > compIndices = _exportComponentIndices;
if (compIndices.empty()) {
vector<int> compIndicesSource;
for (int i = 1; i <= _nrOfComponents; i++) {
compIndicesSource.push_back(i);
}
compIndices.push_back(compIndicesSource);
}
// Reconstruct components and mix, if desired.
int sourceIndex = 1;
for (vector<vector<int> >::const_iterator sourceIt = compIndices.begin();
sourceIt != compIndices.end(); ++sourceIt, ++sourceIndex)
{
// Holds the mixed spectrogram if mixing is desired.
Poco::SharedPtr<Matrix> mixedSpectrogram;
logger().debug("Exporting components for source #" +
Poco::NumberFormatter::format(sourceIndex));
for (vector<int>::const_iterator it = sourceIt->begin();
it != sourceIt->end(); ++it)
{
if (*it < 1 || *it > _nrOfComponents) {
logger().error(nameAndTaskID() + ": invalid component index: " +
Poco::NumberFormatter::format(*it));
continue;
}
int i = *it - 1;
logger().debug(nameAndTaskID() + " exporting component #" +
Poco::NumberFormatter::format(i));
// Compute the component's magnitude spectrum.
Poco::SharedPtr<Matrix> magnitudeSpectrum = new Matrix(
magnitudeSpectraMatrix(0).rows(),
gainsMatrix().cols());
// NMD case
if (_nrOfSpectra > 1) {
magnitudeSpectrum->zero();
RowVector componentGains = gainsMatrix().nthRow(i);
for (unsigned int t = 0; t < _nrOfSpectra; t++) {
ColVector componentSpectrum = magnitudeSpectraMatrix(t).nthColumn(i);
magnitudeSpectrum->add(componentSpectrum * componentGains);
componentGains.shiftRight();
}
}
// "NMF" case (separated for efficiency)
else {
ColVector componentSpectrum = magnitudeSpectraMatrix(0).nthColumn(i);
RowVector componentGains = gainsMatrix().nthRow(i);
*magnitudeSpectrum = componentSpectrum * componentGains;
}
// revert transformation to component spectrogram
magnitudeSpectrum = revertTransforms(magnitudeSpectrum);
//.........这里部分代码省略.........