本文整理汇总了C++中Array2D::setAllTo方法的典型用法代码示例。如果您正苦于以下问题:C++ Array2D::setAllTo方法的具体用法?C++ Array2D::setAllTo怎么用?C++ Array2D::setAllTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Array2D
的用法示例。
在下文中一共展示了Array2D::setAllTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FitchLikelihooder
FitchLikelihooder(int numNodes,int numAlpha,Alphabet &alpha,
MultSeqAlignment &A,int column,RootNode *root,int order)
: A(A), numNodes(numNodes), numAlpha(numAlpha),
alpha(alpha), L(numNodes,numAlpha), column(column),
order(order), root(root), likelihood(NEGATIVE_INFINITY),
gapSymbols(A.getGapSymbols()), V(numAlpha)
{
L.setAllTo(NEGATIVE_INFINITY);
V.setAllTo(NEGATIVE_INFINITY);
}
示例2: main
int Application::main(int argc,char *argv[])
{
// Process command line
CommandLine cmd(argc,argv,"");
if(cmd.numArgs()!=2)
throw String("train-3state <alignment-file> <outfile>");
String infile=cmd.arg(0);
String outfile=cmd.arg(1);
// Initialization
transCounts.resize(4,4);
emitCounts.resize(4,nAlpha,nAlpha);
transCounts.setAllTo(0);
emitCounts.setAllTo(0);
// Process all alignments (pairs of sequences in fasta file)
FastaReader reader(infile,alphabet);
String def1, seq1, def2, seq2;
while(reader.nextSequence(def1,seq1) &&
reader.nextSequence(def2,seq2)) {
Sequence S1(seq1,alphabet), S2(seq2,alphabet);
updateCounts(S1,S2);
}
// Compute HMM parameters
PairHMM hmm(alphabet,gapSymbol,4);
hmm.setStateType(INSERTION_STATE,PHMM_INSERT);
hmm.setStateType(DELETION_STATE,PHMM_DELETE);
hmm.setStateType(MATCH_STATE,PHMM_MATCH);
hmm.setStateType(0,PHMM_OTHER);
for(STATE i=0 ; i<4 ; ++i) {
double sum=0;
for(STATE j=0 ; j<4 ; ++j)
sum+=transCounts[i][j];
for(STATE j=0 ; j<4 ; ++j)
hmm.setTransP(i,j,transCounts[i][j]/sum);
}
for(STATE k=0 ; k<4 ; ++k) {
double sum=0;
for(Symbol i=0 ; i<nAlpha ; ++i)
for(Symbol j=0 ; j<nAlpha ; ++j)
sum+=emitCounts(k,i,j);
if(sum==0) sum=1;
for(Symbol i=0 ; i<nAlpha ; ++i)
for(Symbol j=0 ; j<nAlpha ; ++j)
hmm.setEmitP(k,i,j,emitCounts(k,i,j)/sum);
}
// Save HMM
hmm.save(outfile);
return 0;
}
示例3: reinit
void reinit(int col)
{
L.setAllTo(NEGATIVE_INFINITY);
column=col;
}