  Matched filtering is a commonly used technique in gravitational wave searches
for signals from compact binary systems and from rapidly rotating neutron
stars. A common issue in these searches is dealing with four extrinsic
parameters which do not affect the phase evolution of the system: the overall
amplitude, initial phase, and two angles determining the overall orientation of
the system. The F-statistic maximizes the likelihood function analytically over
these parameters, while the B-statistic marginalizes over them. The
B-statistic, while potentially more powerful and capable of incorporating
astrophysical priors, is not as widely used because of the computational
difficulty of performing the marginalization. In this paper we address this
difficulty and show how the marginalization can be done analytically by
combining the four parameters into a set of complex amplitudes. The results of
this paper are applicable to both transient non-precessing binary coalescence
events, and to long lived signals from rapidly rotating neutron stars.
