Efficient generation and optimization of stochastic template banks by a neighboring cell algorithm
EEfficient generation and optimization of stochastic template banks by a neighboring cell algorithm
Henning Fehrmann ∗ and Holger J. Pletsch † Max-Planck-Institut f¨ur Gravitationsphysik (Albert-Einstein-Institut), D-30167 Hannover, Germany, andInstitut f¨ur Gravitationsphysik, Leibniz Universit¨at Hannover, D-30167 Hannover, Germany (Dated: October 17, 2018)Placing signal templates (grid points) as efficiently as possible to cover a multi-dimensional parameter spaceis crucial in computing-intensive matched-filtering searches for gravitational waves, but also in similar searchesin other fields of astronomy. To generate efficient coverings of arbitrary parameter spaces, stochastic templatebanks have been advocated, where templates are placed at random while rejecting those too close to others.However, in this simple scheme, for each new random point its distance to every template in the existing bank iscomputed. This rapidly increasing number of distance computations can render the acceptance of new templatescomputationally prohibitive, particularly for wide parameter spaces or in large dimensions. This work presentsa neighboring cell algorithm that can dramatically improve the efficiency of constructing a stochastic templatebank. By dividing the parameter space into sub-volumes (cells), for an arbitrary point an efficient hashingtechnique is exploited to obtain the index of its enclosing cell along with the parameters of its neighboringtemplates. Hence only distances to these neighboring templates in the bank are computed, massively loweringthe overall computing cost, as demonstrated in simple examples. Furthermore, we propose a novel methodbased on this technique to increase the fraction of covered parameter space solely by directed template shifts,without adding any templates. As is demonstrated in examples, this method can be highly effective.
PACS numbers: 02.60.Pn, 04.30.Db, 04.80.Nn, 07.05.Kf
I. INTRODUCTION
In searches for gravitational-wave signals using matched-filtering methods or similar detection statistics, efficient tem-plate banks play an essential role [1–6] when analyzing datafrom the ground-based detector instruments such as LIGO[7, 8], Virgo [9], GEO600 [10, 11] and TAMA [12], as well asfuture space-based detectors [13]. Searches for signals basedon template banks are also relevant in neighboring researchfields of astronomy, for example in binary pulsar searchesof radio data from the Arecibo radio telescope [14, 15] orgamma-ray data from the
Fermi satellite [16].In the standard procedure of matched-filtering searches, theinstrumental data is correlated with a template that has theform of the expected signal. Because the parameters of thesignal are unknown a priori, the data must be correlated witha bank (or grid) of possible signal templates (grid points)that have distinct parameter values [17, 18]. In particularfor wide search parameter spaces, methods for constructingtemplate banks that minimize the computational burden with-out decreasing the signal detectability are essential. This canbe achieved by placing the templates more optimally, suchthat fewer are required at the same level of signal detectabil-ity. Different strategies for improved template placement havebeen studied in previous work, e.g. see [19] and referencestherein.For Euclidean spaces, the problem of finding an optimal lattice coverings is well studied [e.g., 20] and is related toperiodic crystalline structures. For up to 5 dimensions, theso-called A ∗ n lattice turns out to cover the space with the least ∗ Electronic address: [email protected] † Electronic address: [email protected] number of templates [21, 22]. For more than 5 dimensions,other lattice structures are also known which have a bettercovering behavior than A ∗ n lattices [21]. However, a crys-talline structure is often not optimal if either a covering frac-tion of less than one is desired, or the parameter space is notEuclidean or has large dimensionality.To address such cases, alternative schemes for arbitrary pa-rameter spaces have been considered by Messenger et al. [23],where templates are simply placed at random. Such random template banks show superior covering behavior in higherdimensions compared to relaxed (less than 100% coveringfraction) A ∗ n lattices. In low dimensions, Manca and Vallis-neri [19] showed that the covering of random template bankscan be improved by exploiting Sobol quasi random sequences[24–26]. However, with an increasing number of dimensionsthe resulting improvement becomes less pronounced.In stochastic template banks that have been suggested byHarry, Allen and Sathyaprakash [27] (hereafter HAS09) aswell as by Babak [28] (hereafter B08), templates are pickedat random too, but only those are added to the bank whichhave a distance larger than a certain predefined value (cov-ering radius) to any of those templates already in the bank.This procedure is to continue until no more new template canbe added to the bank. Compared to (fully) random templateplacement, the filtering stage done for a stochastic templatebank thus results in a more diluted template bank, leading inturn to a more efficient search since much fewer templateshave to be evaluated. As HAS09 note, for this approach thenumber of templates to reach a covering fraction of one (i.e.full coverage) is actually finite.However, a major drawback of the existing stochastic tem-plate bank algorithms is the severe computational complex-ity involved in the bank construction. This is mainly becausethe distance between each new candidate template and every other template already part of the bank has to be computedand compared to the covering radius before acceptance. Es- a r X i v : . [ a s t r o - ph . I M ] N ov pecially for covering fractions approaching one, the computa-tional cost for accepting a new template to the bank increasesmuch more rapidly than quadratically, and can in fact becomeprohibitive for large or high-dimensional parameter spaces.In this work, we present a solution to this problem by di-viding the parameter space into smaller sub-volumes (cells) todrastically reduce the aforementioned computational burden.This basic idea is hardly new, but inspired by previous work[29, 30], and also alluded to in HAS09. Here we develop anefficient concept, which we refer to as the neighboring cell al-gorithm (NCA), and study its performance improvements. Inaddition, we describe a new method to significantly increasethe covering fraction of a stochastic template bank without having to add further templates to bank, but performing sys-tematic shifts of the templates in the bank.This paper is organized as follows. To set the stage, Sec. IIdescribes the standard stochastic template bank generationalgorithm along with some general properties of stochas-tic banks. Section III presents the NCA algorithm to effi-ciently generate stochastic template banks and also demon-strates its computational performance. Building on this, inSec. IV we show how the NCA can also be exploited to opti-mize a stochastic template bank by purely shifting the exist-ing templates of a bank, leading to a significantly increasedcovering fraction without additional templates. Section Villustrates two example applications for different parameterspaces. In Sec. VI, we describe a scheme to further gener-alize the NCA to arbitrarily complicated parameter spaces bycombining cells to adaptive virtual cells. Finally, this is fol-lowed by a conclusion and discussion of future directions inSec. VII. II. STOCHASTIC TEMPLATE PLACEMENT
To set the notation, let M label the d -dimensional signalmanifold, which we refer to as parameter space. We also as-sume the availability of a positive-definite distance functionfor two points in M . Thus, a template bank consisting of N points in parameter space is said to completely cover M withcovering radius r if every point in M lies within a distance r of at least one of the N points of the template bank. An op-timal template bank covering M with radius r would be mosteconomical, i.e. having the minimum number of points.The standard algorithm for stochastic template placementthat has been proposed in HAS09 (and B08) uses the follow-ing principal scheme, beginning with an empty template bank:(1) Draw a random point in M and add it to the templatebank.(2) Draw another random point in M and add it to the tem-plate bank only if its distance is greater than r to every other already accepted point of the template bank.(3) Repeat the previous step until the number of points intemplate bank stops changing, or other termination cri-teria are fulfilled. In general, the distance between two points in M (or twonormalized signals) measures their overlap (i.e. match ). An-other way to think of it, is that one of the two points is a tem-plate and the other is a signal, so that the distance reflects thefractional loss in signal-to-noise ratio (SNR) due to the pa-rameter offsets (i.e. mismatch ) between the template and thesignal.The key difference between the methods of HAS09 and B08is the distance computation between points. Whereas B08uses the exact overlap to compute the distances, HAS09 ex-ploit a computationally less expensive approximation to theoverlap via the geometric concept of a metric on parameterspace [31, 32]. This metric tensor is obtained by Taylor-expanding the fractional loss in squared SNR to quadratic or-der in the parameter offsets. Hence, for problems where areliable analytic metric is available across M , the cost of dis-tance calculations can be significantly reduced. Additional ef-ficiency can be achieved in such cases by also modulating thedistribution of random candidate templates according to thevolume element given by the metric, as discussed in HAS09.However, whether or not using a metric approximation isused, in either case the total number of required distance com-parisons in step (2) of this basic scheme can quickly renderthe entire construction process computationally intractable.The NCA proposed here presents a solution to this problemto significantly reduce the number of distance computationsneeded, as will be described in Sec. III C.To assess the efficiency of a template covering, typicallyits thickness Θ or its normalized thickness θ are consid-ered. We follow [20, 23, 27] and refer to the thickness Θ as the average number of templates covering any parameter-space point. The normalized thickness is just θ = Θ /V d ,where V d is the volume of a d -dimensional unit sphere, V d = π − d/ Γ( d + 1) . Both, Θ and θ are invariant proper-ties of the covering, independent of r . The total number oftemplates, N = θ r − d V M , is thus directly proportional to thenormalized thickness (where V M is the proper volume of M ).As outlined in HAS09, one can obtain theoretical upperand lower bounds for the required number of templates fora stochastic bank with complete covering. A theoretical up-per bound follows from the sphere packing problem by con-sidering how many non-overlapping spheres with radius r/ can be packed into a certain volume. As the center of suchhard spheres are separated by r , these are possible positionsfor a stochastic template bank. Thus, we use the results ofthe sphere packing problem given in [20] to obtain the upperbounds on the normalized thickness shown in Fig. 1 A theo-retical lower bound on the number of required templates fora complete coverage is V M / ( V d r d ) , which is the ratio of theparameter-space volume and the volume of one template withradius r . Therefore, the best possible thickness is Θ = 1 ,i.e. the best possible normalized thickness is θ = 1 /V d . Inpractice however it is impossible to reach this for d > [20].For Euclidean spaces E d with d dimensions a large body ofliterature exists [20] seeking to find the lattice with minimumpossible thickness, such that when placing a d -dimensionalsphere with radius r at each lattice point, the set of allsuch spheres completely covers E d . Figure 1 shows the Number of dimensions d N o r m a li ze d t h i c kn e ss θ −1 HypercubicA n *Lower boundUpper boundStochastic bank FIG. 1: The normalized thickness θ as a function of the number ofdimensions d for a stochastic template bank in E d (crosses). In ad-dition, the lower and upper bounds for stochastic template banks areshown, derived from the known minimum and maximum possiblenormalized thickness values for the sphere packing problem [20, 21]as described in the text. For comparison, also lattice placement algo-rithms (hyper-cubical and A ∗ n ) are displayed. known minimum possible normalized thickness values aslisted in [21]. For comparison, the performance of two otherlattice algorithms is displayed, the hyper-cubical lattice andthe so-called A ∗ n lattice [20]. Notice that a hyper-cubical lat-tice in dimensions d > for unit covering fraction does notsatisfy the conditions of a stochastic template bank.Extending Fig. 1 of HAS09, we are also able to computethe normalized thickness for a stochastic template bank forup to 10 dimensions. This calculation was only made pos-sible owing to the significantly improved computational effi-ciency of the NCA algorithm presented in this work. Due tocomputational limitations, in HAS09 the results for only upto 4 dimensions have been reported. For dimensions higherthan 3, the stochastic bank increasingly improves in perfor-mance compared to the simple hyper-cubical lattice. Thoughthe stochastic bank with complete coverage appears to be lessefficient than the A ∗ n lattice. However, any such lattice cov-erings and constructions algorithms are only defined for thecases of flat parameter spaces. In contrast, the stochastic tem-plate bank generation with the NCA in principle can be donefor any parameter space and thus can prove especially usefulfor non-flat parameter spaces.When generating a stochastic template bank, it is useful todefine the covering fraction f ∈ [0 , , which denotes the fac-tion of V M that is covered by the union of all template vol-umes. As HAS09 note, f is also related to the computationalcomplexity to populate the stochastic template bank, becausethe expected number of candidate templates required to acceptone template to the bank increases as / (1 − f ) . III. THE NEIGHBORING CELL ALGORITHMA. Key elements and requirements of the NCA
In the following we describe the key elements and basicrequirements of the NCA in order to efficiently generate astochastic template bank:(1) The entire parameter space is divided into non-overlapping sub-volumes that we denote as cells . Forsimplicity and ease of computing, we employ hyper-cubical cells in a Cartesian coordinate system. Anyother regular or non-regular structure is also possible.(2) Each cell must be uniquely indexed.(3) Generally, two cells are neighbors if at least one com-mon parameter-space point of one cell and a templatecovering volume exists where the template lies insidethe other cell. In Cartesian coordinates and hyper-cubical cells neighboring cells have at least one borderpoint in common. For a given cell index, the indices ofthe neighboring cells can be computed.(4) Each template must be uniquely indexed.(5) Each template index is mapped to a cell index that labelsthe cell in which the template position lies.(6) Given a parameter-space position of a template, the in-dex of its enclosing cell is readily computed by a hash-ing algorithm. For a hyper-cubical cell lattice this is ac-complished by a fast rounding or truncating operationon the parameter values of the template position.(7) The parameter-space covered by a template only over-laps with the space of the enclosing cell and the neigh-boring cells. It must not overlap with the space of non-neighboring cells. This is ensured by either choosinga small enough covering radius of the templates, or bydesigning the cells sufficiently large.The NCA requires two different tables to be kept in mem-ory. First, the template table , which stores the indices and theparameter-space positions of all templates. Second, the celltable , which contains all cell indices and the list of templateindices of template positions lying within each cell. Figure 2shows a simplified example for the contents of the cell table.
B. Stochastic template placement with the NCA
The following procedure describes how to generate astochastic template bank with covering fraction f using the For maximum efficiency in curved (i.e. non-flat) parameter spaces, it itsrecommended to adapt the cells sizes to follow the local metric approxima-tion. See Sec. V for an example. For complicated curved parameter spaces(e.g. where widely separated cells would have high overlap), a possiblealternative is outlined in Sec. VI using the concept of virtual cells.
Cell tableCell index Template indices a bc d FIG. 2: Exemplary illustration of the cell table, which contains allcell indices and the list of template indices of template positions lyingwithin each cell. Shown on the left are four templates (black circles)labeled by indices { , , , } . The cells (red boxes) are labeled bythe indices { a, b, c, d } . NCA. Starting with an empty template bank, the process foradding new templates to the bank is as follows:(1) Draw a random point in M as a candidate template foraddition to the bank.(2) Determine the cell the candidate template falls into bycalculating its cell index i C .(3) Compute the cell indices of all neighboring cells. Werefer to the resulting list of neighboring cells includingthe enclosing cell i C as the neighboring-cell (NC) list.Note that a cell that is a d -dimensional hypercube, has( d − ) neighboring cells.(4) Sort the NC list in order of increasing distance. Startwith i C and proceed with the closest neighboring cells.The distance between two cells is defined as the dis-tance between the centers of the cells. For illustrativepurposes, Fig. 3 shows an example for the NC list.(5) Retrieve a list of all template indices associated with thecells of the NC list.(6) For all retrieved template indices obtain the templatepositions from the template table.(7) Compute the distance between the candidate templateand every other template position of those obtained inthe previous step. Start with the templates located incells nearest to cell i C . If all computed distances ex-ceed the predefined covering radius, accept this candi-date template as a new template and assign it the nextconsecutive template index.(8) If the candidate template has been accepted, update thetemplate table: Append the position of the acceptedcandidate template to the template table. Also updatethe cell table: Append the template index to the list oftemplate indices pertaining to the cell i C in the cell ta-ble. A pseudo-, quasi or real random number generator may be used. As de-scribed in HAS09, when an analytic metric is available across M , it isadvisable to modulate the distribution of random points according to thevolume element given by the metric for maximum efficiency. a b cd e fg h i
12 2112 1 20
NC listCell index Distance e d, b, f, h a, c, i, g √ FIG. 3: Schematic illustration of the distances between neighboringcells of the NC list. The letters { a, b, c, d, e, f, g, h, i } represent thecell indices. The numbers shown are the distances from the centerof the cell labeled by e to each center of the other cells shown. Formaximum efficiency, the NC list is sorted by increasing order of thisdistance as explained in the text. (9) Repeat this procedure starting from step (1) until thecovering fraction f has reached the desired value. C. Computational cost improvements from the NCA
A major drawback of the standard stochastic template bankalgorithm by HAS09 is the computational complexity whichcan become even prohibitive. This is because for each newcandidate template its distance to every other template of theexisting bank has to be computed and compared to the cov-ering radius before eventual acceptance to the bank. With in-creasing covering fraction the probability of accepting a can-didate template decreases. At the beginning, when the cover-ing fraction substantially less than one, the estimated compu-tational cost for accepting a new candidate template increasesapproximately quadratically with the number of templates inthe bank, since almost no templates are rejected. For coveringfractions closer to one the computational cost increases muchfaster than quadratically with the number of templates in thebank, because the rejection of candidate templates dominates.It is this prohibitive computing cost that can quickly renderthe acceptance of new templates computationally intractablein the standard stochastic template bank algorithm.In order to demonstrate the significant computational effi-ciency improvement of the NCA over the standard algorithm,we consider the generation of a stochastic template bank in a3-dimensional Euclidean space with periodic boundary con-ditions, where each coordinate lies within [0 , . The templatecovering radius r is chosen, such that the bank contains . million templates at a covering fraction of f = 99 . , whichis given by r = 1 / and implies a normalized thicknessof about . . To compare the computational costs of bothalgorithms when constructing this bank, we count the totalnumber of distance computations required in either case. Fig-ure 4 shows the results of this comparison study. With theNCA, the total number of distance computations is massivelyreduced and about five orders of magnitude lower comparedto the standard algorithm. This gain factor is not surprisingbut straightforward to understand: It is simply the ratio of thetotal volume of the considered parameter space to the volume Covering fraction f N u m b e r o f d i s t a n ce c o m pu t a ti on s Accepted templates (Standard algorithm)Rejected templates (Standard algorithm)Total (Standard algorithm)Accepted templates (NCA)Rejected templates (NCA)Total (NCA)Total ratio
FIG. 4: Comparison the computing cost (measured by the number ofdistance computations) between the standard algorithm and the NCAto generate a stochastic template bank in E . Shown as a function ofthe covering fraction f for each method is the number of distancecomputations for candidate templates that have been accepted (thinsolid) and rejected (thin dotted-dashed), as well as the total number(thick dashed). With the NCA, the total number of distance compu-tations is massively reduced, by more than five orders of magnitudeas shown by the dotted curve. enclosed by a single cell and its (3 − neighboring cells,which gives / ≈ × in this example.Figure 4 also shows the shares in the total number of dis-tance computations separately for rejected and accepted can-didate templates. As can be seen, at the beginning for lowcovering fractions, the computing cost is dominated by thedistance computations for accepted candidate templates. Asthe template bank is getting more populated at higher cov-ering fractions, a turnover occurs, where the computing coststarts being dominated by the distance computations due torejections and increases much more rapidly. As can be seen,compared to the standard algorithm for the NCA this turnovertakes place at a larger covering fraction. This is mainly dueto the NCA’s much more efficient rejection of candidate tem-plates, as described in the following.Sorting the NC list of neighboring cells is crucial for theefficiency of the NCA, specifically in view rejecting candi-date templates. This sorting [done in step (4) in Sec. III Cabove] as part of the NCA stochastic template bank generationconsiderably reduces the average number of distance compu-tations needed before a candidate template is eventually re-jected. As illustrated in Fig. 3, this is obvious, because onaverage the overlapping volume of the candidate template ishighest with the own cell and decreases for the neighboringcells. Therefore, the probability for rejecting a candidate tem-plate is the highest when comparing to those templates locatedin the same cell. Hence, the sorting of the NC list by distanceof step (4) can also be seen as sorting by decreasing order ofprobability of rejection, which thus overall minimizes the av-erage number of distance computations. This is also seen inthat the gain factor between the NCA and the standard scheme (dotted curve in Fig. 4) is mostly constant but increases forcovering fractions closer to one, where the rejections of can-didate templates dominate.With higher dimensions this effect gains even more impor-tance, because the number of neighboring cells increases ex-ponentially with dimension. For example, if d = 3 the num-ber of considered cells is = 27 . Without sorting and acell addressing scheme as shown in Fig. 3, the cell containingthe candidate would be on average the (3 + 1) / thcell considered. After sorting, the cell enclosing the tem-plate candidate is considered first. Hence, this sorting candecrease the number of distance computations by a factor al-most . Whereas, if d = 10 the number of considered cellsis = 59049 . The cell containing the candidate in absenceof sorting would be the (3 + 1) / th cell consid-ered. Therefore, sorting the NC list can decrease the numberof distance computations in d = 10 by almost
30 000 ! Thisefficiency gain has greatest importance for covering fractionsnearing one, where the majority of candidate templates is re-jected (see Fig. 4).The NCA also significantly facilitates evaluating the cover-ing fraction at the different stages of the stochastic bank gen-eration. The covering fraction is typically obtained via MonteCarlo integration using a sufficient number of sample points(as also done in HAS09). The standard algorithm by HAS09has to compute the distances between a sample point and alltemplates in the bank, which is inefficient. The NCA insteadreadily can provide a list of the subset of templates closestto a given sample point, and only the distances to those arecomputed. This way, wasteful distance computations for tem-plates far away from the sample-point location are avoided, asthose templates will obviously have no overlap with the sam-ple point.
IV. INCREASING THE COVERING FRACTION BYSHIFTING TEMPLATES
The generation of stochastic template banks with coveringfractions nearing unity can become quickly computationallyprohibitive (cf. Fig. 4). This is due to the enormous numberof candidate templates to be tested before a new template isaccepted to the bank. Here, we present a possible and efficientalternative solution to this problem. The idea is to first gener-ate a stochastic template bank with initially smaller coveringfraction and then increase the covered space by only shifting the positions of the templates, instead of adding new ones.
A. Barycentric template shifts
In what follows, we describe a scheme to effectively shiftthe templates in the bank with the goal of increasing the over-all covering fraction. One such shift optimization stage beginswith the first template in bank:(1) Determine a set of points uniformly distributed on theboundary of the covering volume of the template. Notethat the boundary of a covering volume is the set ofpoints which have distance r (the covering radius) tothe template position.(2) Check whether each of these points is covered or not byanother template. If covered the boundary point getsthe zero weight, otherwise a weight of unity. In casea boundary point lies outside of the relevant parameterspace this point gets also zero weight.(3) From the set of boundary points with unit weight, cal-culate the barycenter of these points.(4) If the distance between the template position and thebarycenter is smaller then a certain maximum dis-tance (cid:15) , the template is moved to coincide with thebarycenter. If the distance is larger than (cid:15) , the tem-plate position moved in the direction of the barycenterby only (cid:15) .(5) Carry out the procedure starting from step (1) for thenext template until done for all templates in the bank.The above scheme (forming a single optimization stage) is tobe repeated until the covering fraction does not increase any-more (or any other terminating condition is met). In general,step (4) will increase the fraction of covered parameter space.However, it might also happen that occasionally a template isshifted towards an existing template, leading to an undesirednewly created overlap. To mitigate this effect, we thereforerecommend to set the maximum shift distance (cid:15) at a fractionof r . Within this work we found that choosing a maximumshift of (cid:15) = 0 . r provides overall satisfactory results. B. Choice of boundary points and computing cost
The actual number of boundary points used is a tradeoff be-tween accuracy of the barycentric shift and computational ef-ficiency. As a lower bound, to be able to shift the template po-sition into any direction in a d -dimensional parameter space,the minimum number of points should is d . More boundarypoints will improve the accuracy of the shift, but also decreasethe computational efficiency of a single optimization stage.While a more detailed study of these aspects is beyond thescope of this paper, one scheme we found to work sufficientlywell for our purposes is choosing twice as many boundarypoints as there are neighboring cells, i.e. × (3 d − points.One way to place the set of boundary points as required instep (1) is the following approach, first presented in [33, 34].In a d -dimensional Euclidean space with spherical templatevolumes, a uniformly distributed set of boundary points can One way to do this is described in detail in Sec. IV B. Notice that this can be accomplished by treating each boundary point likecandidate template as described in Sec. III. (cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1) (cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1) (cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)(cid:1)
FIG. 5: Schematic illustration of the barycentric template shifts toincrease the covering fraction. Left: Illustration of the generation ofthe boundary points. In the enclosing cube around the sphere ran-dom points are placed uniformly. The points falling outside of thetemplate volume (small hollow points) are ignored. The points areinside the sphere (small filled black points) they are projected ontothe boundary of the template volume, providing the boundary points.Right: The thick red lines shows points on the boundary of a tem-plate covering volume that have weight one. These points are notcovered by any neighboring template. All other boundary points getthe weight zero. Using these weights we can compute the barycenterof the boundary points. The arrow points from the current positionof the template to the center of mass of the unit-weight (red thick)boundary points. The resulting shift of the template position towardsthis barycenter thus increases the covering fraction. be obtained by placing random points uniformly into the en-veloping hyper-cubical box. As illustrated in Fig. 5, then allpoints lying outside of the sphere are discarded and those in-side the sphere are projected onto the boundary to provide thedesired set of boundary points.The computational cost of this optimization scheme is againdominated by the number of distance computations. In thismethod, the number of needed distance computations D issimply the product D = N O × N B × N S × N × , where N O is the number of optimization stages, N B is the number ofboundary points, N S is the average number of templates inthe considered within the subvolume of the neighboring cells,and N is the total number of templates. As mentioned above, N B can be taken as × (3 d − . Moreover, N S is estimatedas the normalized thickness θ times the number of neighbor-ing cells plus the own cell giving d . The value of N O de-pends on the used shifting method, while typically we reachedconvergence after N O = 20 stages. Thus, for example inthree dimensions, the number of required distance computa-tions using the normalized thickness of the optimal coveringis D = 20 × × . × N ≈ × N . It is worth notingthat since the computational cost is only linear in the totalnumber of templates N , this proposed scheme is feasible alsofor a relatively large template banks. C. Performance demonstration
Figure 6 illustrates the optimization effect from barycen-tric template shifting for a stochastic template bank in a 2- (a) (b) (c)
FIG. 6: Illustration of different optimization stages of a -dimensional stochastic template bank in Euclidean space with a normalized thicknessof . . The individual panels are: (a) Unoptimized template bank that has a covering faction of . ; (b) Template bank after optimizationstages (template shifting) that has a covering fraction of . ; (c) Template bank after optimization stages that has a covering fractionof . . dimensional Euclidean space. Here, we repeatedly apply thetemplate shifting optimization to the bank. With an increasingnumber of such optimization steps it becomes apparent thatthe template bank approaches an A ∗ lattice structure. Since inthis simple example the chosen parameter space is quadraticwith periodic boundary conditions, a perfect A ∗ cannot be ob-tained, therefore defects are expected. This can be avoided bychoosing an appropriate size of the parameter space. Suchan example choice for length l and width w in 2 dimensionswould be l/w = √ / and a covering radius of the templatesthat is an integer fraction of w/ √ .To evaluate the performance of the template shifting opti-mization method, we study the increase in covering fraction f .Again, for simplicity we consider the Euclidean space E d withup to d = 8 dimensions. For all dimensions, we choose again r = 1 template shifts are limited to at most of the cov-ering radius, so that (cid:15) = 0 . . The resulting reduction ofnon-covered parameter space (i.e. increasing f ) is presentedin Fig. 7. As can be seen from the figure, after a few opti-mization steps of collective template shifting the non-coveredfraction of space (that is − f ) can be significantly reduced.Ultimately after a sufficient number of optimization steps thefraction of non-covered can be decreased by two orders ofmagnitude compared to the standard stochastic template bank(corresponding to zero optimization steps). Recall that thisachievement has been made without the addition of any extratemplates to the bank. Further improvements could eventuallybe made by varying or adapting (cid:15) during the run time, achiev-ing a faster convergence or better covering. Similarly, replac-ing the barycentric “fixed-size” template shift with some sim-plex or gradient driven downhill method could better take intoaccount the overlapping volume of nearby templates and en-able even more effective template shifts. V. FURTHER EXAMPLES TO TEST THE NCA
For maximum efficiency of the NCA, the cells should beconstructed to adapt to the parameter space structure, e.g.following the local metric approximation. In particular forcurved parameter spaces the cell construction and the deter-
Number of optimization stages N on − c ov e r e d fr ac ti on ( − f ) d=2d=3d=4d=5d=6d=7d=8 FIG. 7: The decreasing fraction of non-covered parameter space(that is just − f ) with the number of optimization stages. At eachstage, the barycentric template shifting method is applied using max-imum shifts of (cid:15) = 0 . . The different curves are for Euclideanspaces E d with dimensions from d = 2 up to d = 8 , using periodicboundary conditions and a template covering radius r = 1 . mination of neighboring cells requires care and can be dif-ficult, in particular in higher dimensions since the numberof neighboring cells grows exponentially with the dimension.However, when it is not possible to determine the exact setof neighboring cells it always is save to just use a somewhatlarger set of cells (that is simpler to determine, but does in-clude cells which are not strict neighbors). This would onlyslightly reduce the performance since distances between moretemplates have to be computed than actually necessary. On theother hand, missing neighboring cells could lead to a more se-vere issue, since this would lead to over-covering of templatesin the regions of the missed neighboring cells. In what fol-lows, we show further exemplary applications of the NCA,one related to the choice of coordinates on parameter space,and one for a parameter space that is curved. -0.4-0.200.20.4 -0.4 -0.2 0 0.2 0.4 y x (a) -0.4-0.200.20.4 -0.4 -0.2 0 0.2 0.4 y x -0.4-0.200.20.4 -0.4 -0.2 0 0.2 0.4 y x -0.4-0.200.20.4 -0.4 -0.2 0 0.2 0.4 y x (b) N o n - o v e r e d f r a t i o n ( - f ) optimisation steps0.010.1 0 5 10 15 20 25 30 N o n - o v e r e d f r a t i o n ( - f ) optimisation stepsCartesian oordinatespolar oordinatesCartesian oordinatespolar oordinates (c) FIG. 8: Example application of the NCA for Cartesian and polar coordinates. The individual panels are: (b) Schematic illustration of cellconstruction when using Cartesian coordinates. (b) Schematic illustration of cell construction when using polar coordinates. (c) Comparison ofthe non-covered fraction (1 − f ) for Cartesian and polar coordinates. In this comparison, we employed a template covering radius of r = 0 . and a total number of templates N = 4000 . To determine the non-covered fraction we used Monte Carlo points.
A. Choice of coordinates
In principle, the NCA and the optimization are independentof the choice of the coordinates. This is demonstrated in thefollowing example. Figure 8 illustrates the parameter spacesplitting (cell construction) for the NCA in Cartesian ( x, y ) and in polar coordinates ( ρ, φ ) . The coordinate transforma-tion is given by x = ρ cos φ , y = ρ sin φ and the distance iscomputed as d = (cid:0) x + y (cid:1) / . It is obvious that in polarcoordinates the cells are obtained by dividing the parameterspace into rings of width r , where r is the covering fractionof the templates. Each ring is fragmented so that a templatecovering volume reaches only the neighboring cells and neverthe cells beyond. The neighboring cells are the adjacent cellsin the same ring and any cell in the adjacent rings which canbe “reached” by the covering volume of any template in lyinginside the considered cell. This can also include cells whichhave no common boundary points with the considered cell. Fi-nally, the results of from applying the NCA for both choicesof coordinates are also presented in Fig. 8, showing that thenon-covered fraction as a function of the number optimizationstages (using barycentric shifts, see Sec. IV), is effectively thesame for both choices of coordinates. B. Curved parameter space
To illustrate the applicability of the NCA for a curved (i.e.non-flat) parameter space, we consider generating a stochas-tic template bank on the sphere – an example that was alsoused in HAS09. A sphere here means a set of points with thesame distance to a center point, where unit distance is used forsimplicity in the present example. Thus the length element isdefined as dl = dθ + dφ cos θ were − π/ ≤ θ ≤ π/ and ≤ φ < π . The cells in parameter space are constructed,using uniform spacings in the θ -direction. The cell sizes ∆ φ in the φ direction should depend on θ . Because thecell construction should be such that the covering volumesof templates overlap only with neighboring cells, we choose ∆ φ = r/ cos θ b , where θ b minimizes cos θ within this cell.Making ∆ φ smaller would result in template volumes whichcould reach into non-neighboring cells. In this example, deter-mining the neighboring cells works similar as described abovefor polar coordinates. For a given θ one has to find all cellswhich could have an overlap with any template inside the con-sidered cell. In Fig. 9, the cell construction in parameter spaceis displayed, along with the stochastic template generated bythe NCA, as well as the optimized template bank using thebarycentric shift method introduced in Sec. IV. VI. GENERALIZATION OF THE NCA
In this section, we describe a conceptual idea how to gener-alize the NCA for application even to arbitrarily “ill-behaved”parameter spaces. In general, the smaller the average numberof templates per cell the smaller the number of required dis-tance computations needed by the NCA. However, for certainparameter spaces, the shape or the size of the template vol-umes might be unknown or vary strongly across the space.This might represent a non-negligible problem in order tomeet requirement (7) of Sec. III A, as one has to choose thesize of the cells to be sufficiently large. It may even lead toextreme situations, where the efficiency gain from the NCAcan melt away.To address this problem of ill-behaved parameter spaces,we suggest the following strategy. To begin with, set up thecells with a smaller size that actually violates the require-ment (7) of Sec. III A. Then notice that in some regions ofparameter space, a template overlaps with many cells andnot only with neighboring ones. Therefore, one can combinethese cells to form a single virtual cell. Those virtual cellsthen again meet all requirements for the NCA as outlined inSec. III A. This basic idea is illustrated in Fig. 10. To combinecells the following recipe is proposed: • Start with the first cell and place a template inside thiscell at a random position. Form the first virtual cell la-beled A , which contains that first cell. φ / π θ/π (a) φ / π θ/π (b) φ / π θ/π (c) FIG. 9: Example application of the NCA to place templates on the sphere, parameterized by the polar angle θ and the azimuth angle φ . Here θ = 0 denotes the equatorial plane. The individual panels are: (a) Illustration of cell construction in parameter space. (b) Stochastic templatebank from the NCA containing templates and having a covering fraction of f = 0 . . (c) Optimized template bank by the NCA with animproved covering fraction of f = 0 . for the same number of templates. The template covering radius has been chosen as r = 0 . in thisexample. • Consider the next cell and place a second template in-side. If the first and second templates are too close toeach other, the second cell also belongs to the same vir-tual cell A . In this case the second template can be dis-carded and the first template is the representing tem-plate for the virtual cell A . On the other hand, if thedistance between the two templates is large enough, thesecond cell forms another virtual cell labeled B , con-taining the second cell. In this case, the first templaterepresents A and the second represents B . • Continue this scheme subsequently for all other cellsand test whether the considered cell belongs to one ofthe existing virtual cells. If not, the considered cellsforms a new virtual cell. • Keep a list in memory which maps all cells to their vir-tual cells. • A virtual cell inherits the neighbors of its containingcells. Note that if an inherited neighboring cell is also apart of the same virtual cell, this cell has to be removedfrom the list of neighbors.This procedure will create a map of virtual cells which coverthe entire parameter space. While not guaranteed to gener-ate the smallest possible virtual cells meeting condition (7) inSec. III A, this method is a viable solution and more flexiblethan the basic version of the NCA described in Sec. III. Tocheck whether a specific point in parameter space is coveredby one of the templates, one proceeds as follows:(1) Compute the cell index for the parameter-space point.(2) Map the cell to the virtual cell and read out the indicesfor the neighbored virtual cells.(3) Collect all templates from the template lists of the ownand the neighbored virtual cells and compute all dis-tances between the examined point and these templates.(4) If one of the computed distances is smaller than the de-sired covering radius, the point is covered. For illustrative purposes, Fig. 10 shows a simplified exampleto which above method is applied.
VII. CONCLUSIONS
This paper presents a neighboring cell algorithm (in shortNCA) to efficiently construct stochastic template banks cover-ing multidimensional parameter spaces. A core improvementfrom the NCA is the dramatic reduction in the number dis-tance computations, achieved by dividing the parameter spaceinto separate cells (neighboring cells). For any point in param-eter space we exploit an efficient hashing technique to obtainthe index of the enclosing cell (and thus the parameters of itsneighboring templates). This way, to test if a new candidatetemplate should be added to the bank, only templates locatedwithin the own and neighboring cells have to be considered.Previous methods [27, 28] required comparison (i.e. distancecomputation) with all templates already in the bank and thuswere considerably more computational expensive and eventu-ally prohibitive for large (or also high-dimensional) parame-ter spaces. We have demonstrated that compared to the stan-dard stochastic template bank algorithm, the NCA can reducethe number of distance computations in a -dimensional Eu-clidean space by about five orders of magnitude. In addition,based on the NCA we have described a new method to signifi-cantly increase the covered fraction of parameter space, solelythrough systematic shifts of the template positions – withoutadding further templates to the bank.The NCA is guaranteed to work efficiently if the averagenumber of templates per neighboring cell is small. For cases,where the shape and size of the template volumes vary dras-tically across parameter space, this can be eventually becomedifficult to achieve. To address this problem, we have pre-sented a method to generalize the NCA by combining manyneighboring cells to form so-called virtual neighboring cells.The arrangement of the virtual neighboring cells can adapt ad-equately to the local parameter-space structure (the shape ofthe covered template volumes).0 C DA BE F a bc de f
Cell 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16Virtual cells A A A B A C C C A C D D E E E F
Virtual cell A B C D E FNeighbors B,C,E A,C A,B,D,E C,E,F A,C,D D,ETemplates a b c d e f
FIG. 10: Illustration of NCA generalization by combining cells to form virtual cells for arbitrary parameter-space structures. The cellindices are indicated by Arabic numbers. The virtual-cell indices are labeled with red capital letters. The templates are denoted by lower-caseletters. The left panel illustrates schematically the borders of the templates, cells, and virtual cells. The right top table shows a table for thecorresponding cell to virtual-cell mapping. The right bottom table presents a table that lists the neighbors of the virtual cells.
Apart from generating template banks, it should be pointedout that the NCA can also be used to efficiently validate theproduced bank. This is usually done by searching syntheticdata sets containing simulated signals and determining the re-sulting minimum mismatch in each case. The NCA consider-ably accelerates this process by avoiding the need of having tothe search the entire template bank for every simulated-signaldata set. Instead, for any given parameter-space position ofa simulated signal, the NCA can readily provide the subsetof templates closest to the signal position, which are the onlyones relevant. Templates further away from the signal locationare irrelevant, since those will obviously have high mismatchwith the signal. Iterating this procedure for a large numberof simulated signals across the parameter space, gives rise toa mismatch histogram to validate the efficiency of the entiretemplate bank.The NCA, including the generalized version presented, hasapplicability in different areas of astronomy. For example ingravitational-wave searches for inspiral or continuous-wavesources [5, 6], exploiting the NCA can potentially offer greatefficiency gains. In the field of gamma-ray pulsar astronomy,the NCA has already been successfully used to construct anoptimized stochastic template bank to search data from the
Fermi
Large Area Telescope for a pulsar binary system [16].Further details involved and results from these applications ofthe NCA are subject to forthcoming work.Directions for a future work also include technical andmethodological improvements. In this work, we implementedthe NCA in a parallel algorithm using
OpenMP and executed the program on a single system. However, it might be worth-while to port to an MPI version which runs on many com-pute nodes or use remote databases to hold the template andthe cell table. The practicability of such algorithms has tobe investigated, particularly since random access on the en-tire table ranges is required. Finally, a further improvement ofthe optimization method could be achieved by replacing thebarycentric “fixed-size” template shift with some simplex orgradient driven downhill method. This approach would bettertake into account the overlapping volume of nearby templatesand enable even more effective template shifts.
VIII. ACKNOWLEDGMENTS
We thank Bruce Allen for discussions of the basic ideasbehind this work and for pointing out to us open ques-tions concerning the convergence behavior of stochastic tem-plate banks. We are grateful for fruitful discussions withReinhard Prix, Chris Messenger, Oliver Bock and CarstenAulbert. We thank Benjamin Knispel and Gian Mario Mancafor discussing possible further applications and some fu-ture directions of this work. The concept of hash algo-rithms in numerical physics we owe to Bogdan Damski. Thiswork was supported by the Max-Planck-Gesellschaft (MPG),as well as by the Deutsche Forschungsgemeinschaft (DFG)through an Emmy Noether research grant PL 710/1-1 (PI:Holger J. Pletsch). [1] B. S. Sathyaprakash and S. V. Dhurandhar, Phys. Rev. D ,3819 (1991).[2] S. V. Dhurandhar and B. S. Sathyaprakash, Phys. Rev. D ,1707 (1994).[3] C. Cutler and E. E. Flanagan, Phys. Rev. D , 2658 (1994).[4] P. Jaranowski and A. Kr´olak, Living Reviews in Relativity , 3(2005).[5] S. Babak, et al. Phys. Rev. D , 024033 (2012).[6] J. Aasi, J. Abadie, B. P. Abbott, et al. (2012). [7] B. Abbott et al., Nuclear Instruments and Methods in PhysicsResearch A , 154 (2004).[8] A. Abramovici et al., Science , 325 (1992).[9] F. Acernese et al., Class. Quant. Grav. , 635 (2006).[10] S. Gossler et al., Class. Quant. Grav. , 1835 (2002).[11] B. Willke et al., Class. Quant. Grav. , 1377 (2002).[12] H. Takahashi et al. (TAMA Collaboration), Class. Quant. Grav. , 697 (2004).[13] K. Danzmann and the LISA Study Team, Max-Planck-Institut f¨ur Quantenoptik, Report MPQ , 233 (1998).[14] B. Knispel et al., Science , 1305 (2010).[15] B. Allen et al., The Astrophysical Journal , 91 (2013).[16] H. J. Pletsch et al., Science , 1314 (2012).[17] C. W. Helstrom, Statistical Theroy of Signal Detection (Perga-mon Press, 1968).[18] A. D. Whalen,
Detection of Signals in Noise (Academic Press,New York and London, 1971).[19] G. M. Manca and M. Vallisneri, Phys. Rev. D , 024004(2010).[20] J. Conway and N. Sloane, Sphere Packings, Lattices andGroups (Springer-Verlag, New York, 1993).[21] A. Sch¨urmann and F. Vallentin,
Geometry of lattices andalgorithms , .[22] F. Vallentin, Ph.D. thesis, Technische Universit¨at M¨unchen,Zentrum Mathematik (2003).[23] C. Messenger, R. Prix, and M. A. Papa, Phys. Rev. D ,104017 (2009).[24] I. M. Sobol, USSR computational mathematics and mathemat- ical physics , 86 (1967).[25] I. M. Sobol, USSR computational mathematics and mathemat-ical physics , 236 (1976).[26] J. P. Lampert, International Series of Numerical Mathematics , 273 (1988).[27] I. W. Harry, B. Allen, and B. S. Sathyaprakash, Phys. Rev. D , 104014 (2009).[28] S. Babak, Class. Quant. Grav. (2008).[29] B. Allen and E. P. S. Shellard, Phys. Rev. Lett. , 119 (1990).[30] B. Abbott et al. (LIGO Scientific Collaboration), Phys. Rev. D , 022001 (2009).[31] R. Balasubramanian, B. S. Sathyaprakash, and S. V. Dhurand-har, Phys. Rev. D , 3033 (1996).[32] B. J. Owen, Phys. Rev. D , 6749 (1996).[33] J. von Neumann, NBS Applied Mathematics Series , 36(1951).[34] J. M. Cook, Mathematical Tables and Other Aids to Computa-tion11