本文整理汇总了C++中parameters::MUD方法的典型用法代码示例。如果您正苦于以下问题:C++ parameters::MUD方法的具体用法?C++ parameters::MUD怎么用?C++ parameters::MUD使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parameters
的用法示例。
在下文中一共展示了parameters::MUD方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetScore
bool GetScore(ap::template_2d_array<float,true>& Responses,
ap::template_1d_array<unsigned short int, true>& Code,
parameters tMUD,
ap::template_1d_array<short int,true>& trialnr,
ap::template_1d_array<double,true>& windowlen,
int numchannels,
int NumberOfSequences,
int NumberOfChoices,
int mode,
ap::real_2d_array &pscore)
{
///////////////////////////////////////////////////////////////////////
// Section: Define variables
int row_Responses, col_Responses, row_MUD, col_MUD,
dslen, count, max, NumberOfEpochs, numVariables;
bool flag = true;
ap::real_2d_array Responses_double;
ap::template_2d_array<float, true> Responses_copy;
ap::real_2d_array DATA;
ap::real_2d_array tmp_MUD;
ap::real_1d_array score;
ap::real_1d_array weights;
vector<short int> trial;
//vector<short int> trial_copy;
vector<int> range;
vector<int> code_indx;
vector<short int>::iterator it;
///////////////////////////////////////////////////////////////////////
// Section: Get Dimmensions
row_Responses = Responses.gethighbound(1)+1;
col_Responses = Responses.gethighbound(0)+1;
row_MUD = tMUD.MUD.gethighbound(1)+1;
col_MUD = tMUD.MUD.gethighbound(0)+1;
///////////////////////////////////////////////////////////////////////
// Section: Extract from the signal only the channels containing the "in" variables
numVariables = static_cast<int>( col_Responses/static_cast<double>( numchannels ) );
Responses_copy.setbounds(0, row_Responses-1, 0, numVariables*(tMUD.channels.gethighbound(1)+1)-1);
Responses_double.setbounds(0, row_Responses-1, 0, numVariables*(tMUD.channels.gethighbound(1)+1)-1);
for (int i=0; i<row_Responses; i++)
{
for (int j=0; j<tMUD.channels.gethighbound(1)+1; j++)
{
ap::vmove(Responses_copy.getrow(i, j*numVariables, ((j+1)*numVariables)-1),
Responses.getrow(i, static_cast<int>(tMUD.channels(j)-1)*numVariables,
static_cast<int>(tMUD.channels(j)*numVariables)-1));
}
}
for (int i=0; i<row_Responses; i++)
{
for (int j=0; j<numVariables*(tMUD.channels.gethighbound(1)+1); j++)
Responses_double(i,j) = static_cast<double>( Responses_copy(i,j) );
}
for (int i=0; i<row_Responses; i++)
trial.push_back(trialnr(i));
///////////////////////////////////////////////////////////////////////
// Section: Downsampling the MUD
dslen = ap::iceil((row_MUD-1)/tMUD.DF)+1;
tmp_MUD.setbounds(0, dslen, 0, col_MUD-1);
for (int j=0; j<col_MUD; j++)
{
for (int i=0; i<dslen; i++)
{
if (j==0)
tmp_MUD(i,0) = tMUD.MUD(i*tMUD.DF, 0)-1;
if (j==1)
{
tmp_MUD(i,1) = tMUD.MUD(i*tMUD.DF, 1) - windowlen(0);
tmp_MUD(i,1) = ap::ifloor(tmp_MUD(i,1)/tMUD.DF)+1;
tmp_MUD(i,1) = tmp_MUD(i,1) + (tmp_MUD(i,0)*numVariables);
}
if (j==2)
tmp_MUD(i,2) = tMUD.MUD(i*tMUD.DF, 2);
}
}
///////////////////////////////////////////////////////////////////////
// Section: Computing the score
DATA.setbounds(0, row_Responses-1, 0, dslen-1);
score.setbounds(0, row_Responses-1);
weights.setbounds(0, dslen-1);
double valor;
for (int i=0; i<dslen; i++)
{
valor = tmp_MUD(i,1);
ap::vmove(DATA.getcolumn(i, 0, row_Responses-1), Responses_double.getcolumn(static_cast<int>( tmp_MUD(i,1) ), 0, row_Responses-1));
valor = DATA(0,i);
weights(i) = tmp_MUD(i,2);
}
//.........这里部分代码省略.........