Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Source/Result? Chunks Sizes
- Following cases should checked:
- SAME:
- source_chunk_count == result_chunk_count - source and result chunks have same sizes (just change overlap, for example. See next article for details)
- ALIGNED-INCREASE:
- source_chunk_count > result_chunk_count
- exists whole positive number a (a < source_chunk_count) with (result_chunk_count * a == source_chunk_count)
- ALIGNED-DECREASE:
- source_chunk_count < result_chunk_count
- exists whole position number a (a < result_chunk_count) with (result_chunk_count == source_chunk_count * a)
- NOT-ALIGNED:
- source_chunk_count != result_chunk_count
- not exist whole positive numbers a (a < source_chunk_count) and b (b < result_chunk_count) with (result_chunk_count * a == source_chunk_count * b)
- PARTIALLY-ALIGNED':
- source_chunk_count != result_chunk_count
- not exists whole positive numbers a (a > 1 and a < source_chunk_count) and b (b > 1 and b < result_chunk_count) with (result_chunk_count * a == source_chunk_count) and (result_chunk_count == source_chunk_count * b)
- exists whole positive numbers c (c < source_chunk_count) and b (b < result_chunk_count) with (result_chunk_count * c == source_chunk_count * d)
- Overlap
- Following cases should be checked:
- OVERLAP-NONE - no overlap in source and result.
- OVERLAP-SAME - source and result have same overlap.
- OVERLAP-ADD - source has not overlap, result has
- OVERLAP-REMOVE - source has overlap, result has not
- OVERLAP-INCREASE - result overlap bigger than source overlap
- OVERLAP-DECREASE - result overlap smaller than source overlap
- def get_overlap(overlap):
- value= 1
- lesser= value * 2
- greater= value * 3
- d= {
- OVERLAP_NONE: { SOURCE: 0, RESULT: 0 },
- OVERLAP_SAME: { SOURCE: value, RESULT: value },
- OVERLAP_ADD: { SOURCE: 0, RESULT: value },
- OVERLAP_REMOVE: { SOURCE: value, RESULT: 0 },
- OVERLAP_INCREASE: { SOURCE: lesser, RESULT: greater },
- OVERLAP_DECREASE: { SOURCE: greater, RESULT: lesser }
- }
- return d[overlap]
- # chunks sizes
- SAME='same'
- ALIGNED_INCREASE='aligned_increase'
- ALIGNED_DECREASE='aligned_decrease'
- NOT_ALIGNED='not_aligned'
- PARTIALLY_ALIGNED='partially_aligned'
- CHUNK_SIZES_LIST=[SAME, ALIGNED_INCREASE, ALIGNED_DECREASE, NOT_ALIGNED, PARTIALLY_ALIGNED]
- # overlap
- OVERLAP_SAME='overlap_same'
- OVERLAP_NONE='overlap_none'
- OVERLAP_ADD='overlap_add'
- OVERLAP_REMOVE='overlap_remove'
- OVERLAP_INCREASE='overlap_increase'
- OVERLAP_DECREASE='overlap_decrease'
- OVERLAP_LIST=[OVERLAP_ADD, OVERLAP_REMOVE, OVERLAP_INCREASE, OVERLAP_DECREASE]
- def get_chunk_settings(chunk_sizes):
- value= 2
- lesser= value
- greater= value * 2
- coprime_first= 2
- coprime_second= 3
- d= {
- SAME: { SIZE: { SOURCE: value, RESULT: value },
- COUNT: { SOURCE: value, RESULT: value } },
- ALIGNED_INCREASE: { SIZE: { SOURCE: lesser, RESULT: greater },
- COUNT: { SOURCE: greater, RESULT: lesser } },
- ALIGNED_DECREASE: { SIZE: { SOURCE: greater, RESULT: lesser },
- COUNT: { SOURCE: lesser, RESULT: greater } },
- NOT_ALIGNED: { SIZE: { SOURCE: coprime_first, RESULT: comprime_second },
- COUNT: { SOURCE: coprime_second, RESULT: comprime_first } },
- PARTIALLY_ALIGNED: { SIZE: { SOURCE: comprime_first*2, RESULT: coprime_second*2 },
- COUNT: { SOURCE: comprime_second*2, RESULT: comprime_first*2 } }
- }
- return d[overlap]
Advertisement
Add Comment
Please, Sign In to add comment