当前位置: 首页>>代码示例>>Java>>正文


Java TIntArrayList.resetQuick方法代码示例

本文整理汇总了Java中gnu.trove.TIntArrayList.resetQuick方法的典型用法代码示例。如果您正苦于以下问题:Java TIntArrayList.resetQuick方法的具体用法?Java TIntArrayList.resetQuick怎么用?Java TIntArrayList.resetQuick使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gnu.trove.TIntArrayList的用法示例。


在下文中一共展示了TIntArrayList.resetQuick方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: computeExpectations

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public void computeExpectations(ArrayList<SumLattice> lattices) {
  double[][][] xis;
  TIntArrayList cache = new TIntArrayList();
  for (int i = 0; i < lattices.size(); i++) {
    if (lattices.get(i) == null) { continue; }
    FeatureVectorSequence fvs = (FeatureVectorSequence)lattices.get(i).getInput();
    SumLattice lattice = lattices.get(i);
    xis = lattice.getXis();
    for (int ip = 1; ip < fvs.size(); ++ip) {
      cache.resetQuick();
      FeatureVector fv = fvs.getFeatureVector(ip);
      int fi;
      for (int loc = 0; loc < fv.numLocations(); loc++) {
        fi = fv.indexAtLocation(loc);
        // binary constraint features
        if (constraintsMap.containsKey(fi)) {
          cache.add(constraintsMap.get(fi));
        }
      }
      for (int prev = 0; prev < map.getNumStates(); ++prev) {
        int liPrev = map.getLabelIndex(prev);
        if (liPrev != StateLabelMap.START_LABEL) {
          for (int curr = 0; curr < map.getNumStates(); ++curr) {
            int liCurr = map.getLabelIndex(curr);
            if (liCurr != StateLabelMap.START_LABEL) {
              double prob = Math.exp(xis[ip][prev][curr]);
              for (int j = 0; j < cache.size(); j++) {
                constraintsList.get(cache.getQuick(j)).expectation[liPrev][liCurr] += prob;
              }
            }
          }
        }
      }
    }
  }
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:37,代码来源:TwoLabelGEConstraints.java

示例2: computeExpectations

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public void computeExpectations(ArrayList<SumLattice> lattices) {
  double[][] gammas;    
  TIntArrayList cache = new TIntArrayList();
  for (int i = 0; i < lattices.size(); i++) {
    if (lattices.get(i) == null) { continue; }
    SumLattice lattice = lattices.get(i);
    FeatureVectorSequence fvs = (FeatureVectorSequence)lattice.getInput();
    gammas = lattice.getGammas();
    for (int ip = 0; ip < fvs.size(); ++ip) {
      cache.resetQuick();
      FeatureVector fv = fvs.getFeatureVector(ip);
      int fi;
      for (int loc = 0; loc < fv.numLocations(); loc++) {
        fi = fv.indexAtLocation(loc);
        // binary constraint features
        if (constraints.containsKey(fi)) {
          cache.add(fi);
        }
      }
      if (constraints.containsKey(fv.getAlphabet().size())) {
        cache.add(fv.getAlphabet().size());
      }
      for (int s = 0; s < map.getNumStates(); ++s) {
        int li = map.getLabelIndex(s);
        if (li != StateLabelMap.START_LABEL) {
          double gammaProb = Math.exp(gammas[ip+1][s]);
          for (int j = 0; j < cache.size(); j++) {
            constraints.get(cache.getQuick(j)).incrementExpectation(li,gammaProb);
          }
        }
      }
    }
  }
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:35,代码来源:OneLabelL2RangeGEConstraints.java

示例3: computeExpectations

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public void computeExpectations(ArrayList<SumLattice> lattices) {
  double[][] gammas;    
  TIntArrayList cache = new TIntArrayList();
  for (int i = 0; i < lattices.size(); i++) {
    if (lattices.get(i) == null) { continue; }
    SumLattice lattice = lattices.get(i);
    FeatureVectorSequence fvs = (FeatureVectorSequence)lattice.getInput();
    gammas = lattice.getGammas();
    for (int ip = 0; ip < fvs.size(); ++ip) {
      cache.resetQuick();
      FeatureVector fv = fvs.getFeatureVector(ip);
      int fi;
      for (int loc = 0; loc < fv.numLocations(); loc++) {
        fi = fv.indexAtLocation(loc);
        // binary constraint features
        if (constraints.containsKey(fi)) {
          cache.add(fi);
        }
      }
      if (constraints.containsKey(fv.getAlphabet().size())) {
        cache.add(fv.getAlphabet().size());
      }
      for (int s = 0; s < map.getNumStates(); ++s) {
        int li = map.getLabelIndex(s);
        if (li != StateLabelMap.START_LABEL) {
          double gammaProb = Math.exp(gammas[ip+1][s]);
          for (int j = 0; j < cache.size(); j++) {
            constraints.get(cache.getQuick(j)).expectation[li] += gammaProb;
          }
        }
      }
    }
  }
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:35,代码来源:OneLabelGEConstraints.java

示例4: executeImpl

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
protected static boolean executeImpl(IndexPatternSearch.SearchParameters queryParameters,
                                     Processor<IndexPatternOccurrence> consumer) {
  final IndexPatternProvider patternProvider = queryParameters.getPatternProvider();
  final PsiFile file = queryParameters.getFile();
  TIntArrayList commentStarts = new TIntArrayList();
  TIntArrayList commentEnds = new TIntArrayList();

  final CharSequence chars = file.getViewProvider().getContents();
  findCommentTokenRanges(file, chars, queryParameters.getRange(), commentStarts, commentEnds);
  TIntArrayList occurrences = new TIntArrayList(1);
  IndexPattern[] patterns = patternProvider != null ? patternProvider.getIndexPatterns() : null;

  for (int i = 0; i < commentStarts.size(); i++) {
    int commentStart = commentStarts.get(i);
    int commentEnd = commentEnds.get(i);
    occurrences.resetQuick();

    if (patternProvider != null) {
      for (int j = patterns.length - 1; j >=0; --j) {
        if (!collectPatternMatches(patterns[j], chars, commentStart, commentEnd, file, queryParameters.getRange(), consumer, occurrences)) {
          return false;
        }
      }
    }
    else {
      if (!collectPatternMatches(queryParameters.getPattern(), chars, commentStart, commentEnd, file, queryParameters.getRange(),
                                 consumer, occurrences)) {
        return false;
      }
    }
  }

  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:IndexPatternSearcher.java


注:本文中的gnu.trove.TIntArrayList.resetQuick方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。