PERF: Remove false sharing across threads

During multi-threading, false sharing of
variables across threads occurs when
adjacent memory locations exist in the same
cache line, and this results in extraorinary
performance penalty as each cache line is
uncessarily invalidated by other threads.

This patch focuses on the regitration metrics
where the cache sharing was most obvious to
identify with the Intel VTune Performance
analyzers.

The following conformance rules were applied uniformly
across all locations to ease future maintenance of the
code

Rules Applied:
(S) Add Struct to CorrelationMetricPerThread  Mainstruct suffixed as PerThreadStruct
(M) Add main class variable with PerThreadVariables suffix
(P) Add Padding Macro
(A) Add Alignment Macro
(V) Make mutable std::vector m_ member variable

These classes were made consistent:
SMPAV itkCorrelationImageToImageMetricv4HelperThreader.h
SMPAV itkMattesMutualInformationImageToImageMetric.h
SMPAV itkCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h
SMPAV itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h
SMPAV itkJointHistogramMutualInformationComputeJointPDFThreaderBase.h
SMPAV itkJointHistogramMutualInformationGetValueAndDerivativeThreader.h

A good description of false sharing can be found at:
http://software.intel.com/en-us/articles/avoiding-and-identifying-false-sharing-among-threads

Change-Id: I1c823f03612958a43cc25860c8d7c9727e635f11
PERF: Avoid smart pointer registration penalty

The smart pointer generation was unnecessarily being
called many times.  It resulted in a very large performance
penalty that greatly affected registration performance.

Returning a raw pointer rather than a smart pointer to the
internal type.  If calling environment places the returned
value on a a smart pointer, reference counting is preserved,
but in cases when a raw pointer is sufficient, these raw
pointers can be a significant speed improvement.

Also set const correctness more judiciously, and
propogated use of const pointers through code wherever
possible.

Change-Id: I20424e1fb6a05a831bcd47148fdba93209011b44
PERF: Avoid vector copy, and prefer multiplication

Performance analysis indicated a very high CPI (Cycle per instruction)
count for this code.  By converting the division to multiplication the
performance analysis indicates a 10% speedup of CPU time needed for the
registration test case (ANTs SyN registration for 5 iterations).

Change-Id: I3375d2080da8db7a3251dd7a30cdee08ec0f8ccd
PERF: Reviewing code for facilitating compiler optimizations

The itkLinearInterpolateImageFunction.h is such a core
function, it deserves special attention for gaining
any amount of speed improvement can help
improve the speed of many programs.

Change-Id: Ibba6caa0468e850ab6b487565943d07af9f82f8c
PERF: Avoid upcasting from float to double

Use the typedef to match the proper computation type
to avoid an unnecessary casting to double when
all the data types are capable of being represented
in floating point.  The main potential benefit is that
the compiler may be able to more aggressivly
optimize or vectorize code.

The tolerance for a normed difference needs to be greater
than the tolerance for each individual item, so a new
tolerance value was added.

Change-Id: I97f194eb3bd15595c486e2e705f563041c9f3608
DOC: Fix issues in Transform and TransformBaseTemplate

In Transform, explicit newlines in the class documentation comment to
cause the HTML documentation text to layout properly.

In TransformBaseTemplate, the template parameter should be named TScalar,
both for style correctness, and to cause the Doxygen inheritance diagram
to properly generate.

Change-Id: Id407b2f3be7eff77e807eed1dbaf618ed135c689
Merge topic 'PerformanceImprovementPart3'

2d4bcc8 PERF: Avoid upcasting from float to double
b5e114f PERF: Reviewing code for facilitating compiler optimizations
c4e78f1 PERF: Avoid vector copy, and prefer multiplication
5265728 PERF: Avoid smart pointer registration penalty
f1fe8dc PERF: Remove false sharing across threads
Merge topic 'Doc-Transform'

85b2abd DOC: Fix issues in Transform and TransformBaseTemplate