本文整理汇总了C++中DoubleVector::setSize方法的典型用法代码示例。如果您正苦于以下问题:C++ DoubleVector::setSize方法的具体用法?C++ DoubleVector::setSize怎么用?C++ DoubleVector::setSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DoubleVector
的用法示例。
在下文中一共展示了DoubleVector::setSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TrainTargetJFA
//-----------------------------------------------------------------------------------------------------------------------------------------------------------
int TrainTargetJFA(Config& config)
{
String inputClientListFileName = config.getParam("targetIdList");
String inputWorldFilename = config.getParam("inputWorldFilename");
String outputSERVERFilename = "";
if (config.existsParam("mixtureServer")) outputSERVERFilename =config.getParam("mixtureServer");
bool initByClient=false; // In this case, the init model is read from the file
if (config.existsParam("initByClient")) initByClient=config.getParam("initByClient").toBool();
bool saveEmptyModel=false;
if (config.existsParam("saveEmptyModel")) saveEmptyModel=config.getParam("saveEmptyModel").toBool();
// label for selected frames - Only the frames associated with this label, in the label files, will be used
bool fixedLabelSelectedFrame=true;
String labelSelectedFrames;
if (config.existsParam("useIdForSelectedFrame")) // the ID of each speaker is used as labelSelectedFrame ?
fixedLabelSelectedFrame=(config.getParam("useIdForSelectedFrame").toBool()==false);
if (fixedLabelSelectedFrame) // the label is decided by the command line and is unique for the run
labelSelectedFrames=config.getParam("labelSelectedFrames");
bool modelData=false;
if (config.existsParam("useModelData")) modelData=config.getParam("useModelData").toBool();
String initModelS=inputWorldFilename;
if (modelData) if (config.existsParam("initModel")) initModelS=config.getParam("initModel"); // Use a specific model for Em init
bool outputAdaptParam=false;
if (config.existsParam("superVectors")) outputAdaptParam=true;
try{
XList inputClientList(inputClientListFileName,config); // read the Id + filenames for each client
XLine * linep;
inputClientList.getLine(0);
MixtureServer ms(config);
StatServer ss(config, ms);
if (verbose) cout << "(TrainTarget) Joint Factor Analysis - Load world model [" << inputWorldFilename<<"]"<<endl;
MixtureGD& world = ms.loadMixtureGD(inputWorldFilename);
if (verbose) cout <<"(TrainTarget) Use["<<initModelS<<"] for initializing EM"<<endl;
//LOAD JFA MAtrices
Matrix<double> U, V;
DoubleVector D;
//Initialise EC matrix
if(config.existsParam("eigenChannelMatrix")){
String uName = config.getParam("matrixFilesPath") + config.getParam("eigenChannelMatrix") + config.getParam("loadMatrixFilesExtension");
U.load (uName, config);
if (verboseLevel >=1) cout << "(TrainTargetJFA) Init EC matrix from "<< config.getParam("eigenChannelMatrix") <<" from EigenChannel Matrix: "<<", rank: ["<<U.rows() << "] sv size: [" << U.cols() <<"]"<<endl;
}
else{
unsigned long sS = world.getVectSize() * world.getDistribCount();
U.setDimensions(1,sS);
U.setAllValues(0.0);
if (verboseLevel >=1) cout << "(TrainTargetJFA) Init EC matrix to 0"<<endl;
}
//Initialise EV matrix
if(config.existsParam("eigenVoiceMatrix")){
String vName = config.getParam("matrixFilesPath") + config.getParam("eigenVoiceMatrix") + config.getParam("loadMatrixFilesExtension");
V.load (vName, config);
if (verboseLevel >=1) cout << "(TrainTargetJFA) Init EV matrix from "<< config.getParam("eigenVoiceMatrix") <<" from EigenVoice Matrix: "<<", rank: ["<<V.rows() << "] sv size: [" << V.cols() <<"]"<<endl;
}
else{
unsigned long sS = world.getVectSize() * world.getDistribCount();
V.setDimensions(1,sS);
V.setAllValues(0.0);
if (verboseLevel >=1) cout << "(TrainTargetJFA) Init EV matrix to 0"<<endl;
}
//Initialise D matrix
if(config.existsParam("DMatrix")){
String dName = config.getParam("matrixFilesPath") + config.getParam("DMatrix") + config.getParam("loadMatrixFilesExtension");
Matrix<double> tmpD(dName, config);
if( (tmpD.rows() != 1) || ( tmpD.cols() != world.getVectSize()*world.getDistribCount() ) ){
throw Exception("Incorrect dimension of D Matrix",__FILE__,__LINE__);
}
else{
D.setSize(world.getVectSize()*world.getDistribCount());
D.setAllValues(0.0);
for(unsigned long i=0; i<world.getVectSize()*world.getDistribCount(); i++){
D[i] = tmpD(0,i);
}
if (verboseLevel >=1) cout << "(TrainTargetJFA) Init D matrix from "<<config.getParam("DMatrix")<<endl;
}
}
else{
unsigned long sS = world.getVectSize() * world.getDistribCount();
D.setSize(sS);
D.setAllValues(0.0);
if (verboseLevel >1) cout << "(TrainTargetJFA) Init D matrix to 0"<<endl;
}
// *********** Target loop *****************
while ((linep=inputClientList.getLine()) != NULL){ // linep gives the XLine with the Id of a given client and the list of files
String *id=linep->getElement(); // Get the Client ID (id)
XLine featureFileListp=linep->getElements(); // Get the list of feature file for the client (end of the line)
if (verbose) cout << "(TrainTarget) Train model ["<<*id<<"]"<<endl;
XList ndx; ndx.addLine() = featureFileListp;
JFAAcc jfaAcc(ndx,config,"TrainTarget");
//Load V, U and D from existing matrices.
//.........这里部分代码省略.........