BinaryLogicApplications - billbreit/BitWiseApps GitHub Wiki

Uses of Bitwise Operations

There is a standard set of usages for bitwise operations such as:

  • cryptography,
  • network masks,
  • image processing
  • other machine level operations on various data structures.

There also seems to be a less recognized category called 'binary indexing', which is often used to refer to Fenwick Trees. Another use of the term is indexing of binary ( one-in, two-out ) node trees for improved performance, similar to some high performance implementations of the Rete algorithm in rule-base systems.

An almost forgotten use is in seismology for feature extraction and analysis in the late-70s. The science of seismic analysis is far beyond me, but as a very primitive example, one might have a set of three classifications, say high/medium/low density ( or whatever ), with features based on ranges of values for intensity and duration of the received signals.

For example, a set of features (conditions) might be:

  • [ intensity < 12.3 ]
  • [ intensity > 17.2 ]
  • [ duration < 5.5 ]
  • [ duration > 27.6 ]

A set of conditions such as [ intensity < 12.3 ] AND [ duration < 5.5 ] might indicate that the density is 'low'. This would encode as 0101, representing ( from the right ) slots [ 0, 2 ] in the feature set.

density conditions bit encoding
low [ intensity < 12.3 ] AND [ duration < 5.5 ] 0101
medium [ intensity > 17.2 ] AND [ duration < 5.5 ] 0110
high [ intensity > 17.2 ] AND [ duration > 27.6 ] 1010

For the values were intensity=18.6 and duration=33.1, the conditions would be 1010 and the test using bitwise operation ( bit encoding for high density & conditions ) == ( bit encoding for high density ), would match and yield True, inferring that density='high'.

If the values were intensity=14.6 and duration=33.1, the conditions would 1000, inferring that no conclusion is possible.

This mechanism of using integers to map into a list can provide the foundation of something like a minimal logic engine, in this case inferring density from intensity and duration. In the late 70s, applications like this ran reasonably well on machines that would hardly be called computers or even micro-controllers today.

The example is highly flawed geologically, but it illustrates the basic idea.

See:


⚠️ **GitHub.com Fallback** ⚠️