Fast Joint entropy and histogram calculation for N-D images
This uses no for-loops - only index manipulation. Intended use is for iterative programs where increased speed pays off, but works just fine for individually controlled use as well - though in this case the user may want to adjust the function to include various parameters as input variables (for iterative programs these are usually constant, so they are set to typical values within the function).
No error checking is used, as that could slow things down and is generally unnecessary for an iterative program presumably using fixed image sizes and pixel values.