Package cern.colt.bitvector

Examples of cern.colt.bitvector.BitVector


  }
 
  @Test
  public final void testIntersects()
  {
    BitVector A=new BitVector(100),B=new BitVector(100);
    Assert.assertFalse(GDLearnerGraph.intersects(A, B));
    A.set(10);
    Assert.assertFalse(GDLearnerGraph.intersects(A, B));
    B.set(10);
    Assert.assertTrue(GDLearnerGraph.intersects(A, B));
    A.clear(10);
    A.set(71);A.set(72);B.set(72);
    Assert.assertTrue(GDLearnerGraph.intersects(A, B));
    A.clear(72);
    Assert.assertFalse(GDLearnerGraph.intersects(A, B));
  }
View Full Code Here


    Map<Label,Integer> inputToInt = new TreeMap<Label,Integer>();
                for(Label str:getAlphabet()) inputToInt.put(str, num++);
    for(Entry<CmpVertex,Map<Label,TARGET_A_TYPE>> entry:graph.transitionMatrix.entrySet())
      if (filter.stateToConsider(entry.getKey()))
      {// ignoring irrelevant-states, for efficiency
        BitVector
          acceptVector = new BitVector(getAlphabet().size()),
          rejectVector = new BitVector(getAlphabet().size());
        for(Entry<Label,TARGET_A_TYPE> transition:entry.getValue().entrySet())
          for(CmpVertex vert:graph.getTargets(transition.getValue()))
          {
           
            if (!vert.isAccept())
              rejectVector.set(inputToInt.get(transition.getKey()));
            else
              acceptVector.set(inputToInt.get(transition.getKey()));
          }
        inputsAccepted.put(entry.getKey(), acceptVector);
        inputsRejected.put(entry.getKey(), rejectVector);
View Full Code Here

      @Override
      public void handleEntry(Entry<CmpVertex, Map<Label, List<CmpVertex>>> entryA, @SuppressWarnings("unused") int threadNo)
      {// we are never called with entryA which has been filtered out.
        Collection<Entry<Label,List<CmpVertex>>> rowA_collection = matrixInverse.transitionMatrix.get(entryA.getKey()).entrySet();// the "inverse" row
        BitVector inputsAcceptedFromA = inputsAccepted.get(entryA.getKey()), inputsRejectedFromA = inputsRejected.get(entryA.getKey());
       
        // Now iterate through states, pre-filtered during construction of matrixInverse but in the same order
        // because they are ordered by their IDs and we are using a TreeMap to store 'em.
        Iterator<Entry<CmpVertex,Map<Label,List<CmpVertex>>>> stateB_It = matrixInverse.transitionMatrix.entrySet().iterator();
        while(stateB_It.hasNext())
        {
          Entry<CmpVertex,Map<Label,List<CmpVertex>>> stateB = stateB_It.next();// stateB should not have been filtered out by construction of matrixInverse
          int currentStatePair = vertexToIntNR(stateB.getKey(),entryA.getKey());
          assert prevStatePairNumber < 0 || currentStatePair == prevStatePairNumber+1;prevStatePairNumber=currentStatePair;
         
          // Note that we are iterating state pairs consecutively in an increasing order and
          // different threads handle non-intersecting ranges of them, hence most of the time,
          // there should be no "cache thrashing".
          BitVector B_accepted=inputsAccepted.get(stateB.getKey()),B_rejected=inputsRejected.get(stateB.getKey());
          if (!AbstractLearnerGraph.checkCompatible(stateB.getKey(), entryA.getKey(), pairCompatibility) ||// relevant in two cases:
              // (A) if we do not filter any states initially; this is the case where there are states
              // without outgoing transitions which may be incompatible due to different labelling.
              // (B) some pairs of states are recorded as incompatible
              intersects(inputsAcceptedFromA,B_rejected) || intersects(inputsRejectedFromA,B_accepted))
View Full Code Here

    int num =0;
    Map<String,Integer> inputToInt = new TreeMap<String,Integer>();for(String str:getAlphabet()) inputToInt.put(str, num++);
    for(Entry<CmpVertex,Map<String,TARGET_A_TYPE>> entry:graph.transitionMatrix.entrySet())
      if (filter.stateToConsider(entry.getKey()))
      {// ignoring irrelevant-states, for efficiency
        BitVector
          acceptVector = new BitVector(getAlphabet().size()),
          rejectVector = new BitVector(getAlphabet().size());
        for(Entry<String,TARGET_A_TYPE> transition:entry.getValue().entrySet())
          for(CmpVertex vert:graph.getTargets(transition.getValue()))
          {
           
            if (!vert.isAccept())
              rejectVector.set(inputToInt.get(transition.getKey()));
            else
              acceptVector.set(inputToInt.get(transition.getKey()));
          }
        inputsAccepted.put(entry.getKey(), acceptVector);
        inputsRejected.put(entry.getKey(), rejectVector);
View Full Code Here

      @Override
      public void handleEntry(Entry<CmpVertex, Map<String, List<CmpVertex>>> entryA, @SuppressWarnings("unused") int threadNo)
      {// we are never called with entryA which has been filtered out.
        Collection<Entry<String,List<CmpVertex>>> rowA_collection = matrixInverse.transitionMatrix.get(entryA.getKey()).entrySet();// the "inverse" row
        BitVector inputsAcceptedFromA = inputsAccepted.get(entryA.getKey()), inputsRejectedFromA = inputsRejected.get(entryA.getKey());
       
        // Now iterate through states, pre-filtered during construction of matrixInverse but in the same order
        // because they are ordered by their IDs and we are using a TreeMap to store 'em.
        Iterator<Entry<CmpVertex,Map<String,List<CmpVertex>>>> stateB_It = matrixInverse.transitionMatrix.entrySet().iterator();
        while(stateB_It.hasNext())
        {
          Entry<CmpVertex,Map<String,List<CmpVertex>>> stateB = stateB_It.next();// stateB should not have been filtered out by construction of matrixInverse
          int currentStatePair = vertexToIntNR(stateB.getKey(),entryA.getKey());
          assert prevStatePairNumber < 0 || currentStatePair == prevStatePairNumber+1;prevStatePairNumber=currentStatePair;
         
          // Note that we are iterating state pairs consecutively in an increasing order and
          // different threads handle non-intersecting ranges of them, hence most of the time,
          // there should be no "cache thrashing".
          BitVector B_accepted=inputsAccepted.get(stateB.getKey()),B_rejected=inputsRejected.get(stateB.getKey());
          if (!AbstractLearnerGraph.checkCompatible(stateB.getKey(), entryA.getKey(), pairCompatibility) ||// relevant in two cases:
              // (A) if we do not filter any states initially; this is the case where there are states
              // without outgoing transitions which may be incompatible due to different labelling.
              // (B) some pairs of states are recorded as incompatible
              intersects(inputsAcceptedFromA,B_rejected) || intersects(inputsRejectedFromA,B_accepted))
View Full Code Here

  }
 
  @Test
  public final void testIntersects()
  {
    BitVector A=new BitVector(100),B=new BitVector(100);
    Assert.assertFalse(GDLearnerGraph.intersects(A, B));
    A.set(10);
    Assert.assertFalse(GDLearnerGraph.intersects(A, B));
    B.set(10);
    Assert.assertTrue(GDLearnerGraph.intersects(A, B));
    A.clear(10);
    A.set(71);A.set(72);B.set(72);
    Assert.assertTrue(GDLearnerGraph.intersects(A, B));
    A.clear(72);
    Assert.assertFalse(GDLearnerGraph.intersects(A, B));
  }
View Full Code Here

    int num =0;
    Map<String,Integer> inputToInt = new TreeMap<String,Integer>();for(String str:getAlphabet()) inputToInt.put(str, num++);
    for(Entry<CmpVertex,Map<String,TARGET_A_TYPE>> entry:graph.transitionMatrix.entrySet())
      if (filter.stateToConsider(entry.getKey()))
      {// ignoring irrelevant-states, for efficiency
        BitVector
          acceptVector = new BitVector(getAlphabet().size()),
          rejectVector = new BitVector(getAlphabet().size());
        for(Entry<String,TARGET_A_TYPE> transition:entry.getValue().entrySet())
          for(CmpVertex vert:graph.getTargets(transition.getValue()))
          {
           
            if (!vert.isAccept())
              rejectVector.set(inputToInt.get(transition.getKey()));
            else
              acceptVector.set(inputToInt.get(transition.getKey()));
          }
        inputsAccepted.put(entry.getKey(), acceptVector);
        inputsRejected.put(entry.getKey(), rejectVector);
View Full Code Here

      int prevStatePairNumber =-1;

      public void handleEntry(Entry<CmpVertex, Map<String, List<CmpVertex>>> entryA, @SuppressWarnings("unused") int threadNo)
      {// we are never called with entryA which has been filtered out.
        Collection<Entry<String,List<CmpVertex>>> rowA_collection = matrixInverse.transitionMatrix.get(entryA.getKey()).entrySet();// the "inverse" row
        BitVector inputsAcceptedFromA = inputsAccepted.get(entryA.getKey()), inputsRejectedFromA = inputsRejected.get(entryA.getKey());
       
        // Now iterate through states, pre-filtered during construction of matrixInverse but in the same order
        // because they are ordered by their IDs and we are using a TreeMap to store 'em.
        Iterator<Entry<CmpVertex,Map<String,List<CmpVertex>>>> stateB_It = matrixInverse.transitionMatrix.entrySet().iterator();
        while(stateB_It.hasNext())
        {
          Entry<CmpVertex,Map<String,List<CmpVertex>>> stateB = stateB_It.next();// stateB should not have been filtered out by construction of matrixInverse
          int currentStatePair = vertexToIntNR(stateB.getKey(),entryA.getKey());
          assert prevStatePairNumber < 0 || currentStatePair == prevStatePairNumber+1;prevStatePairNumber=currentStatePair;
         
          // Note that we are iterating state pairs consecutively in an increasing order and
          // different threads handle non-intersecting ranges of them, hence most of the time,
          // there should be no "cache thrashing".
          BitVector B_accepted=inputsAccepted.get(stateB.getKey()),B_rejected=inputsRejected.get(stateB.getKey());
          if (!AbstractLearnerGraph.checkCompatible(stateB.getKey(), entryA.getKey(), incompatibles) ||// relevant in two cases:
              // (A) if we do not filter any states initially; this is the case where there are states
              // without outgoing transitions which may be incompatible due to different labelling.
              // (B) some pairs of states are recorded as incompatible
              intersects(inputsAcceptedFromA,B_rejected) || intersects(inputsRejectedFromA,B_accepted))
View Full Code Here

    int num =0;
    Map<String,Integer> inputToInt = new TreeMap<String,Integer>();for(String str:getAlphabet()) inputToInt.put(str, num++);
    for(Entry<CmpVertex,Map<String,TARGET_A_TYPE>> entry:graph.transitionMatrix.entrySet())
      if (filter.stateToConsider(entry.getKey()))
      {// ignoring irrelevant-states, for efficiency
        BitVector
          acceptVector = new BitVector(getAlphabet().size()),
          rejectVector = new BitVector(getAlphabet().size());
        for(Entry<String,TARGET_A_TYPE> transition:entry.getValue().entrySet())
          for(CmpVertex vert:graph.getTargets(transition.getValue()))
          {
           
            if (!vert.isAccept())
              rejectVector.set(inputToInt.get(transition.getKey()));
            else
              acceptVector.set(inputToInt.get(transition.getKey()));
          }
        inputsAccepted.put(entry.getKey(), acceptVector);
        inputsRejected.put(entry.getKey(), rejectVector);
View Full Code Here

      @Override
      public void handleEntry(Entry<CmpVertex, Map<String, List<CmpVertex>>> entryA, @SuppressWarnings("unused") int threadNo)
      {// we are never called with entryA which has been filtered out.
        Collection<Entry<String,List<CmpVertex>>> rowA_collection = matrixInverse.transitionMatrix.get(entryA.getKey()).entrySet();// the "inverse" row
        BitVector inputsAcceptedFromA = inputsAccepted.get(entryA.getKey()), inputsRejectedFromA = inputsRejected.get(entryA.getKey());
       
        // Now iterate through states, pre-filtered during construction of matrixInverse but in the same order
        // because they are ordered by their IDs and we are using a TreeMap to store 'em.
        Iterator<Entry<CmpVertex,Map<String,List<CmpVertex>>>> stateB_It = matrixInverse.transitionMatrix.entrySet().iterator();
        while(stateB_It.hasNext())
        {
          Entry<CmpVertex,Map<String,List<CmpVertex>>> stateB = stateB_It.next();// stateB should not have been filtered out by construction of matrixInverse
          int currentStatePair = vertexToIntNR(stateB.getKey(),entryA.getKey());
          assert prevStatePairNumber < 0 || currentStatePair == prevStatePairNumber+1;prevStatePairNumber=currentStatePair;
         
          // Note that we are iterating state pairs consecutively in an increasing order and
          // different threads handle non-intersecting ranges of them, hence most of the time,
          // there should be no "cache thrashing".
          BitVector B_accepted=inputsAccepted.get(stateB.getKey()),B_rejected=inputsRejected.get(stateB.getKey());
          if (!AbstractLearnerGraph.checkCompatible(stateB.getKey(), entryA.getKey(), pairCompatibility) ||// relevant in two cases:
              // (A) if we do not filter any states initially; this is the case where there are states
              // without outgoing transitions which may be incompatible due to different labelling.
              // (B) some pairs of states are recorded as incompatible
              intersects(inputsAcceptedFromA,B_rejected) || intersects(inputsRejectedFromA,B_accepted))
View Full Code Here

TOP

Related Classes of cern.colt.bitvector.BitVector

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.