Browse Source

Add implementation of forEachTransition to MDPSparse.

This accesses the MDP storage directly, rather than via getTransitionsIterator.
Not really used at the moment since methods that need to be fast, like matrix-vector
multiplication, are directly implemented already.
accumulation-v4.7
Dave Parker 5 years ago
parent
commit
378fc14233
  1. 8
      prism/src/explicit/MDPSparse.java

8
prism/src/explicit/MDPSparse.java

@ -586,6 +586,14 @@ public class MDPSparse extends MDPExplicit
return choiceStarts[rowStarts[s] + i + 1] - choiceStarts[rowStarts[s] + i];
}
@Override
public void forEachTransition(int s, int i, TransitionConsumer c)
{
for (int col = choiceStarts[rowStarts[s] + i], stop = choiceStarts[rowStarts[s] + i + 1]; col < stop; col++) {
c.accept(s, cols[col], nonZeros[col]);
}
}
@Override
public Iterator<Entry<Integer, Double>> getTransitionsIterator(final int s, final int i)
{

Loading…
Cancel
Save