Package de.torstennahm.integrate.sparse.index

Examples of de.torstennahm.integrate.sparse.index.Index


    boolean calc = false;
   
    for (int i = 0; i < GridVisualizer.GRIDSIZE; i++) {
      for (int j = 0; j < GridVisualizer.GRIDSIZE; j++) {
        if (dim0 != dim1 || i == j) {
          Index index = new FastIndex();
          index = index.set(dim0, i);
          index = index.set(dim1, j);
         
          int[] pixel = positionToPixel(new int[] {i, j});
         
          EvalData data;
          synchronized (valueMap) {
            data = valueMap.get(index);
          }
          if (data == null) {
            calc = true;
          } else {
            double contribution = data.contribution;
            if (! Double.isNaN(contribution)) {
              double b = 0.0;
              double integrate = Math.abs(contribution);
              int evals = evaluator.pointsForIndex(index);
             
              if (mode == 0) {
                b = 0.7 - 0.7 * MathTN.log10(integrate) / MathTN.log10(MathTN.FUDGE);
              } else if (mode == 1) {
                b = 0.4 + 0.1 * MathTN.log10(evals);
              } else if (mode == 2) {
                b = 0.7 - 0.7 * MathTN.log10(integrate / evals) / MathTN.log10(MathTN.FUDGE);
              }
             
              g.setColor(colorScale.getColor((b + colorOffset) * colorFactor));
              g.fillRect(pixel[0], pixel[1], boxSize, boxSize);
//              if (contribution > 0) {
//                g.setColor(Color.BLACK);
//                g.fillRect(pixel[0] + (boxSize * 3) / 8, pixel[1] + (boxSize * 3) / 8, boxSize / 4, boxSize / 4);
//              }
            }
          }
        }
      }
    }
   
    g.setColor(Color.RED);
   
    for (int i = 0; i < GridVisualizer.GRIDSIZE; i++) {
      for (int j = 0; j < GridVisualizer.GRIDSIZE; j++) {
        if (dim0 != dim1 || i == j) {
          Index index = new FastIndex();           
          index = index.set(dim0, i);
          index = index.set(dim1, j);
         
          int[] pixel = positionToPixel(new int[] {i, j});
         
          boolean borderX = false, borderY = false;
          boolean evaluated;
          synchronized (indicesEvaluated) {
             evaluated = isEvaluatedInTimeLimit(index, timeLimit);
             if (! evaluated) {
              if (isEvaluatedInTimeLimit(index.add(dim0, -1), timeLimit)) {
                borderX = true;
              }
             
              if (isEvaluatedInTimeLimit(index.add(dim1, -1), timeLimit)) {
                borderY = true;
              }
             }
          }
         
View Full Code Here


        }
       
        if (! abort) {
          int i = k - j;
          if (task.dim0 != task.dim1 || i == j) {
            Index index = new FastIndex();
            index = index.set(task.dim0, i);
            index = index.set(task.dim1, j);
           
            boolean done = false;
           
            synchronized (task.valueMap) {
              if (task.valueMap.containsKey(index)) {
View Full Code Here

            throw new RuntimeException(e);
          }
        }
      }
     
      Index index = indexIter.next();
      if (! taskData.evaluatedIndices.contains(index)) {
        try {
          double value = taskData.evaluator.deltaEvaluate(index);
          double relResult = value / taskData.evaluator.pointsForIndex(index);
          synchronized (taskData.tailSet) {
View Full Code Here

     
      if (evaluator != null && worker != null) {
        worker.startWorker(evaluator, evaluatedIndices, tailSet);
      }
    } else if (data instanceof IndexContribution) {
      Index index = ((IndexContribution) data).index;
      double contribution = ((IndexContribution) data).contribution;
     
      double relResult = Double.NaN;
      if (evaluator != null) {
        relResult = contribution / evaluator.pointsForIndex(index);
View Full Code Here

      SortedSet<IndexEntry> tailSet = new TreeSet<IndexEntry>();
      FlatIndexGenerator indexIter = new FlatIndexGenerator(evaluator.dimension());
     
      long points = 0;
      while (points < numPoints) {
        Index index = indexIter.next();
       
        if (! evaluatedIndices.contains(index)) {
          try {
            double contribution = evaluator.deltaEvaluate(index);
            points += evaluator.pointsForIndex(index);
View Full Code Here

    }
   
    for (int i = 0; i < gridSize; i++) {
      for (int j = 0; j < gridSize; j++) {
        if (dim0 != dim1 || i == j) {
          Index index = new FastIndex();
          index = index.set(dim0, i);
          index = index.set(dim1, j);
          List<StatusData> indexList;
          synchronized (lock) {
            indexList = statusMap.get(index);
         
            if (indexList != null) {
              DecimalFormat df = new DecimalFormat("0.###E0");
             
              int[] pos = new int[] { index.get(dim0), index.get(dim1) };
              int[] pixel = positionToPixel(pos);
             
              StringBuffer statusText = new StringBuffer();
              int statusCount = 0;
              for (StatusData statusData : indexList) {
View Full Code Here

    synchronized (lock) {
      if (data instanceof IndexContribution) {
        time++;
      }
     
      Index index = data.index;
      StatusData statusData = new StatusData(time, data);
     
      List<StatusData> list = statusMap.get(index);
      if (list == null) {
        list = new LinkedList<StatusData>();
View Full Code Here

          maxDimension = dimension;
          setBarDimension(maxDimension);
        }
      }
    } else if (data instanceof IndexContribution) {
      Index index = ((IndexContribution) data).index;
      double contribution = ((IndexContribution) data).contribution;
     
      contributionPanel.indexEvaluated(index, contribution);
     
      synchronized (lock) {
        if (dimension == 0 && index.lastEntry() >= maxDimension) {
          maxDimension = index.lastEntry() + 1;
          setBarDimension(maxDimension);
        }
        indexCount++;
        timeBar.setMaximum(indexCount);
        timeBar.setValue(indexCount);
      }
     
      synchronized (lock) {
        if (index.lastEntry() >= maxDimension) {
          maxDimension = index.lastEntry() + 1;
          setBarDimension(maxDimension);
        }
      }
    }
   
View Full Code Here

    String statusText = "";
   
    int dim0 = dim0Bar.getValue();
    int dim1 = dim1Bar.getValue();
   
    Index v;
    synchronized (this) {
      if (! (dim0 == dim1 && x != y)) {
        EvalData data;
        v = new FastIndex();
        v = v.set(dim0, x);
        v = v.set(dim1, y);
       
        synchronized (contributionPanel.valueMap) {
          data = contributionPanel.valueMap.get(v);
        }
        if (data != null) {
View Full Code Here

        } else if (integrand instanceof Evaluator) {
          dimension = ((Evaluator) integrand).dimension();
        }
      }
    } else if (data instanceof IndexContribution) {
      Index index = ((IndexContribution) data).index;
      boolean repaint = false;
     
      synchronized (lock) {
        for (IntEntry entry : index) {
          if (entry.getValue() > extent.get(entry.getNumber())) {
            extent.set(entry.getNumber(), entry.getValue());
            repaint = true;
          }
        }
       
        if (index.sum() > maxSum) {
          maxSum = index.sum();
          repaint = true;
        }
      }
     
      if (repaint) {
View Full Code Here

TOP

Related Classes of de.torstennahm.integrate.sparse.index.Index

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.