<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>Efficient Stochastic Template Bank Using Inner Product Inequalities</title></titleStmt>
			<publicationStmt>
				<publisher>The Astrophysical Journal</publisher>
				<date>11/01/2024</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10580402</idno>
					<idno type="doi">10.3847/1538-4357/ad7d87</idno>
					<title level='j'>The Astrophysical Journal</title>
<idno>0004-637X</idno>
<biblScope unit="volume">975</biblScope>
<biblScope unit="issue">2</biblScope>					

					<author>Keisi Kacanja</author><author>Alexander H Nitz</author><author>Shichao Wu</author><author>Marco Cusinato</author><author>Rahul Dhurkunde</author><author>Ian Harry</author><author>Tito Dal_Canton</author><author>Francesco Pannarale</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[<title>Abstract</title> <p>Gravitational wave searches are crucial for studying compact sources such as neutron stars and black holes. Many sensitive modeled searches use matched filtering to compare gravitational strain data to a set of waveform models known as template banks. We introduce a new stochastic placement method for constructing template banks, offering efficiency and flexibility to handle arbitrary parameter spaces, including orbital eccentricity, tidal deformability, and other extrinsic parameters. This method can be computationally limited by the ability to compare proposal templates with the accepted templates in the bank. To alleviate this computational load, we introduce the use of inner product inequalities to reduce the number of required comparisons. We also introduce a novel application of Gaussian Kernel Density Estimation to enhance waveform coverage in sparser regions. Our approach has been employed to search for eccentric binary neutron stars, low-mass neutron stars, primordial black holes, and supermassive black hole binaries. We demonstrate that our method produces self-consistent banks that recover the required minimum fraction of signals. For common parameter spaces, our method shows comparable computational performance and similar template bank sizes to geometric placement methods and stochastic methods, while easily extending to higher-dimensional problems. The time to run a search exceeds the time to generate the bank by a factor of<inline-formula><tex-math><CDATA/></tex-math><math overflow='scroll'><mi class='MJX-tex-calligraphic' mathvariant='script'>O</mi><mo stretchy='false'>(</mo><msup><mrow><mn>10</mn></mrow><mrow><mn>5</mn></mrow></msup><mo stretchy='false'>)</mo></math></inline-formula>for dedicated template banks, such as geometric, mass-only stochastic, and aligned spin cases,<inline-formula><tex-math><CDATA/></tex-math><math overflow='scroll'><mi class='MJX-tex-calligraphic' mathvariant='script'>O</mi><mo stretchy='false'>(</mo><msup><mrow><mn>10</mn></mrow><mrow><mn>4</mn></mrow></msup><mo stretchy='false'>)</mo></math></inline-formula>for eccentric and<inline-formula><tex-math><CDATA/></tex-math><math overflow='scroll'><mi class='MJX-tex-calligraphic' mathvariant='script'>O</mi><mo stretchy='false'>(</mo><msup><mrow><mn>10</mn></mrow><mrow><mn>3</mn></mrow></msup><mo stretchy='false'>)</mo></math></inline-formula>for the tidal deformable bank. With the advent of efficient template bank generation, the primary area for improvement is developing more efficient search methodologies.</p>]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="1.">Introduction</head><p>Gravitational waves (GWs) are distortions in spacetime. One mechanism for generating GWs is accelerating two massive compact objects, such as neutron stars and black holes (A. <ref type="bibr">Einstein 1916</ref><ref type="bibr">Einstein , 1918))</ref>. When these compact objects form a binary system, their mutual gravitational attraction causes them to spiral toward each other, producing GWs that travel outward at the speed of light. We observe these GWs with ground-based detectors, such as the Advanced Laser Interferometer Gravitational-wave Observatory (LIGO) and Advanced Virgo (F. <ref type="bibr">Acernese et al. 2015;</ref><ref type="bibr">LIGO Scientific Collaboration et al. 2015)</ref>. Since the commencement of the advanced detector era in 2015, Advanced LIGO and Virgo have detected ( ) 100 &#61519; GW sources (B. P. <ref type="bibr">Abbott et al. 2019;</ref><ref type="bibr">S. Olsen et al. 2022;</ref><ref type="bibr">R. Abbott et al. 2023b</ref><ref type="bibr">R. Abbott et al. , 2024;;</ref><ref type="bibr">A. K. Mehta et al. 2023;</ref><ref type="bibr">A. H. Nitz et al. 2023)</ref>.</p><p>The initial identification of gravitational-wave sources involves conducting searches (S. A. <ref type="bibr">Usman et al. 2016;</ref><ref type="bibr">C. Messick et al. 2017;</ref><ref type="bibr">Q. Chu et al. 2022</ref>; P. T. H. <ref type="bibr">Pang et al. 2020;</ref><ref type="bibr">F. Aubin et al. 2021;</ref><ref type="bibr">K. Cannon et al. 2021)</ref>. Modelbased searches typically employ matched filtering, which compares the detector data with modeled GW signals <ref type="bibr">(B. Allen et al. 2012;</ref><ref type="bibr">S. Babak et al. 2013)</ref>. Since the properties of a potential source are unknown, a discrete set of template waveforms, known as a template bank, is used.</p><p>Template banks are carefully constructed to ensure minimal loss in the signal-to-noise ratio (SNR; B. S. Sathyaprakash &amp; S. V. Dhurandhar 1991; R. <ref type="bibr">Balasubramanian et al. 1996;</ref><ref type="bibr">B. J. Owen 1996;</ref><ref type="bibr">B. J. Owen &amp; B. S. Sathyaprakash 1999;</ref><ref type="bibr">I. W. Harry et al. 2009;</ref><ref type="bibr">B. Allen et al. 2012;</ref><ref type="bibr">D. A. Brown et al. 2012;</ref><ref type="bibr">T. Dal Canton et al. 2014;</ref><ref type="bibr">S. Roy et al. 2019;</ref><ref type="bibr">C. Hanna et al. 2023</ref>). An ideal template bank contains at least one sufficiently similar template waveform to identify any potential signal within a designated parameter space. A valid template bank algorithm strategically fills the parameter space with templates to limit loss in SNR and minimizes redundant templates. Additionally, it should adapt to the specific characteristics of the gravitational-wave source population studied, allowing the ability to analyze data for a diverse range of astrophysical scenarios.</p><p>Various techniques exist for constructing a template bank. The two main classes of methods are geometric (S. <ref type="bibr">Babak et al. 2006;</ref><ref type="bibr">D. A. Brown et al. 2012;</ref><ref type="bibr">S. Schmidt et al. 2024</ref>) and stochastic placement techniques (S. Babak 2008; I. W. <ref type="bibr">Harry et al. 2009</ref>; G. M. <ref type="bibr">Manca &amp; M. Vallisneri 2010;</ref><ref type="bibr">P. Ajith et al. 2014)</ref>. There also exist hybrid methods that utilizes both approaches. (S. <ref type="bibr">Roy et al. 2017</ref><ref type="bibr">Roy et al. , 2019))</ref>. Geometric methods typically place template waveforms using a lattice technique; this generally requires a known metric, which directly quantifies the similarity of signals. Afterwards, the templates are converted into a physical parameter space. This approach guarantees that every template captures a predefined minimum percentage of the signal (B. J. Owen 2017b; R. <ref type="bibr">Prix 2007)</ref>. One challenge is that the metric may only be flat in the nonphysical space. This may result in over-placing templates near and outside the physical space boundaries. These templates need to be included because they may be better at recovering signals near the boundary than the templates within the physical space (T. <ref type="bibr">Cokelaer 2007;</ref><ref type="bibr">D. A. Brown et al. 2012;</ref><ref type="bibr">A. Coogan et al. 2022)</ref>. Consequently, since the computational cost of a search is proportional to the number of templates produced from any method, including these templates can lead to an excess in the template count, making the search more expensive to perform. This approach is not optimal for complicated boundaries, unknown metrics, or for more intricate detection studies requiring nontrivial parameter spaces.</p><p>An alternative approach is a stochastic placement technique. This method can work without an explicit metric and does not attempt to construct a lattice to place templates. Instead, templates are placed directly in the physical space and iteratively added to the bank until the parameter space is sufficiently well covered. There are several approaches for stochastic template proposals and how templates are evaluated for inclusion in a bank. Stochastic methods typically propose templates either randomly or according to a probability distribution (S. <ref type="bibr">Privitera et al. 2014;</ref><ref type="bibr">N. Indik et al. 2017)</ref>. Various template acceptance strategies exist, such as rejecting templates that retrieve more than a predetermined percentage of the SNR. Alternatively, some methods gauge the density of templates; if the volume of templates surpasses a specified threshold, the template bank is deemed adequately covered (I. W. <ref type="bibr">Harry et al. 2009)</ref>. Unlike geometric methods, stochastic methods provide less stringent guarantees on the completeness of the template bank, sometimes resulting in banks with small holes with lower accuracy of SNR reconstruction. However, stochastic methods in general offer a higher degree of flexibility than geometric methods and allow the ability to perform searches for many varieties of circumstances, such as eccentric or deformable sources.</p><p>In a broader scientific context, the construction of template banks can be likened to the principles of experimental design, where the goal is to efficiently sample a high-dimensional parameter space, similar to methods used in statistics, computer science, and manufacturing for uncertainty quantification and optimization (J. <ref type="bibr">Sacks et al. 1989)</ref>. Each experiment in these fields corresponds to a specific set of input parameters, and the objective is often to understand the variation of a quantity of interest (QoI) based on these parameters, ensuring adequate space-filling to capture the underlying behavior of the system (J. <ref type="bibr">Sacks et al. 1989)</ref>. Similarly, template banks for GW detection aim to cover the parameter space as fully as possible to maximize detection efficiency and minimize missed signals.</p><p>In this paper, we present a new stochastic placement method. We show that this method produces selfconsistent banks that recover the SNR of any potential signal within a target search space, with losses below a chosen threshold. We also show that this method has already been used to conduct various searches, such as (low-mass and eccentric) neutron stars, (supermassive and primordial) black holes, and neutron star-black hole binaries that produce gamma-ray bursts. Finally, we show how the number of parameters in a bank scales the time to complete a search by generating different banks with varying intrinsic parameters, such as spin, eccentricity, and or tidal deformability.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.">Evaluation of Template Bank Coverage</head><p>We assess the effectiveness of a template bank by determining the fraction of SNR that its best matching template can recover for a given source, known as the fitting factor (FF; T. A. <ref type="bibr">Apostolatos 1995)</ref>. To quantify the similarity between template waveforms and the ability of one GW waveform to recover the SNR of another, we define the overlap between waveforms to be</p><p>The noise-weighted inner product (h 0 |h 1 ) is the fraction of signal power extracted from a modeled signal h 1 with the waveform model h 0 , defined as</p><p>Where S n ( f ) is noise power spectral density and f is frequency. Since an overall phase and the absolute time of arrival are typically nuisance parameters in a search, we define the phase and time maximized overlap to be the match &#61517;. This formalism is for a nonprecessing signal. For precessing signals, refer to I. <ref type="bibr">Harry et al. (2016)</ref>.</p><p>The match measures how well the observed waveform correlates with the expected waveform for a given detector sensitivity. The maximum match for a potential signal h i with all the templates in a bank h tb is the fitting factor. The same waveform approximant is used for both templates when testing the coverage of the bank.</p><p>The FF represents the fraction of the SNR that is recovered by the template bank for a given signal. For instance, consider a template bank constructed with a minimal match of 0.95. This bank is expected to recover signals with FFs of 0.95, such that up to 5% of a signal's SNR or a maximum of 14% of the total number of signals may be sacrificed. FFs less than 0.95 indicate regions within the bank where templates cannot fully recover the SNR of a reference signal, suggesting potential gaps in coverage. FFs at 0.95 and above signify that the bank is adequately populated with templates, capable of recovering at least 95% of the SNR.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.">Methods: Stochastic Template Bank Algorithm</head><p>Our method uses a stochastic approach to place templates directly in the physical space and enables the generation of templates that cover a wide variety of parameter spaces, including those parameterized by mass, spin, tidal deformability, and eccentricity. If templates include detector responses, this method can also cover those extrinsic parameters. A diagram of the algorithm is illustrated in Figure <ref type="figure">1</ref>, where it is divided into two main processes: the mechanism that proposes templates (discussed in Section 3.1), and the optimized procedure that determines whether a proposed template should be included into the bank (discussed in Section 3.2). Overall, this method proposes templates and determines whether the inclusion of the templates sufficiently covers the parameter space to recover any potential signal and will repeat until the desired coverage is achieved.</p><p>The bank is sufficiently covered under two termination criteria: minimal match and tolerance. Tolerance is the termination criteria threshold defined by the user. When the tolerance falls below the acceptance fraction, i.e., the fraction of accepted versus the proposed templates, the region of a template bank is considered to be completed. This criterion determines how many templates must be drawn to sufficiently cover the bank. Lower tolerance values generate banks with more templates to cover the parameter space adequately, while larger tolerance values do the opposite. The minimal match is the minimum percentage of SNR that at least one template in the bank can recover any fiducial signal. We use this criterion to accept or reject proposal templates. If the match between the proposal and the accepted templates is less than the minimal match, that proposed template will be added to the bank. If the template has a match greater than the minimal match condition, sufficient templates exist in the bank to recover any given signal in that region.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.1.">Template Sampling Algorithm</head><p>In this section, we detail the template sampling method, the first stage of our stochastic template bank method. We first initialize the method with a set of user-defined parameters, such as properties of the source, the lower frequency cutoff, and the PSD model. The sample templates are drawn within the bounds of chirp time. Chirp time (&#964; 0 ), known as the zeroth order signal Points are randomly sampled from the prior distribution and within distinct bins defined by chirp time &#964; 0 . Waveforms are then generated with a reduced frequency model. When a template is proposed, we assess if including the proposal in the template bank will improve the coverage of the desired parameter space. This assessment is outlined in the blue box and involves comparing the proposed template with the nearest neighboring templates in chirp time. Templates are added to the bank if the match between the proposed template and the accepted templates falls below the minimal match condition. If the match exceeds the minimal match condition, the bank is deemed adequately covered in that region. Match calculations are stored to streamline the process and avoid redundant computations for new proposed templates, utilizing a triangle inequality for efficient comparisons. Upon completing comparisons and reaching the minimal match threshold, tolerance checks, outlined in red, ensure the bank's coverage adequacy. If the tolerance condition is unmet, additional samples are drawn, either stochastically from the prior distribution or with a Gaussian Kernel Density Estimation method. The methods are swapped if one technique performs better than the other, as depicted in the beige box. Proposals are once again compared with the accepted templates. Once the tolerance condition is satisfied, accepted templates are saved and the process iterates for subsequent bins until the entire bank is sufficiently covered. The red arrows represent the checks and repetition in method required to fulfill either tolerance or minimal match conditions. duration in time, defines the regions of template placement (S. <ref type="bibr">Babak et al. 2006)</ref>. We utilize &#964; 0 bins for sampling nearby templates because significant differences in chirp time between signals would lead to higher mismatches. Moreover, stochastic methods struggle to parallelize the physical space sampling over multiple cores because splitting up the parameter space can be challenging (A. <ref type="bibr">Coogan et al. 2022)</ref>. Utilizing &#964; 0 boundaries facilitates faster template bank generation by parallelizing different &#964; 0 bins along different cores. &#964; 0 is defined as follows</p><p>where a 0 is</p><p>where m 1 and m 2 is the mass of primary and secondary, respectively.</p><p>To define the &#964; 0 boundaries, we calculate the chirp time defined above using a default lower chirp time frequency of 15 Hz for the minimum and maximum mass range corresponding to the start and end &#964; 0 . The start &#964; 0 will correspond to the highest masses in the space and the end will correspond to the lowest mass pair. The crawl parameter determines the width of each bin. Once the &#964; 0 boundaries are defined, we draw the first set of points from the prior distribution of the parameters within the first &#964; 0 bin. The sampled templates are either accepted or rejected into the bank (elaborated in Section 3.2).</p><p>The objective of an effective stochastic proposal is to ensure comprehensive coverage of the parameter space, minimizing gaps and undercoverage. An ideal stochastic proposal would be one proportional to the final template density, which is uniform in metric space. In general, one may not know this distribution a priori. To approximate the ideal distribution, and minimize the chance of gaps, holes, or undercoverage, we utilize a Gaussian Kernel Density Estimate (KDE). We construct the KDE from the most recently accepted template parameters after a sufficiently large population is collected using a chosen prior proposal distribution. The KDE distribution updates as new points are accepted and can then evolve toward the ideal distribution. However, the KDE alone cannot fully resolve issues arising from complex boundaries within the parameter space. Hence, the algorithm switches between drawing uniformly from the prior proposal and the KDE-based proposal based on which is more efficient at the time. Once the first &#964; 0 bin has been sufficiently filled with templates and the tolerance criteria are achieved, we begin sampling in the next &#964; 0 bin overlapping 50% with the previous strip. Figure <ref type="figure">2</ref> shows how the &#964; 0 strips overlap with each bin as the sampler proceeds to cover the entire parameter space.</p><p>To parallelize the bank generation, we divide the parameter space into sub-banks, each of which can be processed independently. To achieve efficient parallelization, each subbank is run over a set of independent &#964; 0 bins, chosen so that the match between templates across boundaries of adjacent subbanks remains below the minimal match threshold. Because templates are compared across &#964; 0 bins within the generation of each sub-bank, overcoverage only occurs in the bounding &#964; 0 bins as they are not compared to templates across shared boundaries with other sub-banks. This means that if each subbank has 50 &#964; 0 bins, then the overcoverage is limited to less than &#8764;2%. For most analyzes, we consider this excess to be negligible.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.2.">Optimizing Template Proposal Acceptance</head><p>Once a template is proposed, we must determine if it should be added to the template bank to enhance its coverage of the target parameter space. This is done by determining the FF of our proposed template against the current set of templates in the bank to assess the similarity. Templates with FFs less than the minimal match condition are not sufficiently similar and need to be added to the bank. Templates exceeding the minimal match condition are similar and do not need to be included in the bank. To start, we generate a reduced frequency waveform model, inspired by the methodology detailed in P. <ref type="bibr">Ajith et al. (2014)</ref> and C. <ref type="bibr">Capano et al. (2016)</ref>. This model significantly reduces the computational load required for generating waveforms for the match calculations. PSD fluctuations that typically occur during an observing run have been found to have minimal impact on template placement and coverage; standard searches use a template bank generated on the expected or average noise curve of an observing run (S. A. <ref type="bibr">Usman et al. 2016)</ref>. Next, we evaluate the matches between the proposed waveform models and the closest templates in chirp time, storing these values. To rule out templates where the match is clearly above the minimal match criterion, we make use of previously stored matches. We further optimize this procedure using triangle inequality, which states that the sum of any two sides of any triangle will be greater than the third side. If we compare the distances between templates, we will automatically know that the third distance between the templates will be smaller. For example, consider the mismatch (1 -&#61517;), which represents the distance of the templates, between waveform A and waveform B, and between waveform B and waveform C. If the sum of mismatches between A and B, and B and C is smaller than the predefined 1-FF threshold, then we can skip the direct calculation of the match between A and C.</p><p>We iteratively compare the matches between templates until all waveforms are checked or a template exceeding the minimal match condition is found. We then return to the sampling procedure in Section 3.1 to conduct tolerance checks. If these checks are unmet, we repeat sampling more potential templates until the &#964; 0 bin is sufficiently covered. If the checks are met, we proceed to the next bin or finish executing if the final bin has been filled.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.">Bank Verification</head><p>To demonstrate that our method produces valid template banks, we choose a fiducial parameter space and use our method to generate template banks. We perform the FF calculations described in Section 2 and verify that the stochastic method generates selfconsistent banks. We generated five separate template banks of ( ) 10 4 &#61519; points with fixed mass and spin range for all the banks. Masses are fixed from 2 to 10 M e . Spins are fixed to be between -0.2 and 0.2. We also fixed the approximant to be IMRPhenomD, the lower frequency for the waveform to be 20 Hz, and the PSD to be the Advanced LIGO final design sensitivity (S. <ref type="bibr">Husa et al. 2016</ref>; S. <ref type="bibr">Khan et al. 2016;</ref><ref type="bibr">A. Buikema et al. 2020</ref>). To showcase the effects of tolerance choices on the bank, we generate three banks with varying tolerances, i.e., 0.05, 0.01, and 0.005, for a fixed minimal match of 0.95. We also showcase the effects of minimal match by generating the last two banks with varying minimal matches of 0.8, 0.9, and 0.95 reused from the previous bank, with a fixed tolerance of 0.01. We compare our method to another stochastic method (P. <ref type="bibr">Ajith et al. 2014;</ref><ref type="bibr">C. Capano et al. 2016</ref>) by generating a bank with same parameter space, minimal match of 0.95, and a convergence value of 1000. From each of these banks, we calculated the match of the templates with random fiducial waveforms for the same approximant and parameter range defined above. We successfully reconstruct a template bank that agrees with the tolerance and minimal match conditions. Figure <ref type="figure">3</ref> shows the cumulative distribution of the recovered FF The minimal matches are fixed to be 0.8, 0.9, and 0.95 in the colored vertical lines and a fixed tolerance of 0.01 in the red horizontal. The tolerances for the bottom plot vary from 0.05, 0.01, and 0.005 in colored vertical dashed lines and a fixed minimal match of 0.95 in a red horizontal line. All plots achieve tolerance at the minimal match condition or before minimal match. We compare how our method performs with an existing stochastic method (P. <ref type="bibr">Ajith et al. 2014;</ref><ref type="bibr">C. Capano et al. 2016</ref>) by choosing the same parameter space, minimal match of 0.95, and a convergence criteria of 1000. This bank is comparable to our method generated with a tolerance of 0.01. values for all six banks. All five banks generated with our method, are able to recover the fiducial signals before the minimal match and tolerance are met.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.">Computational Scaling</head><p>The cost of a search linearly scales with the size of the template bank. We conduct an analysis to test how the time to generate different banks compares to the time for completing the bank's respective search. To explain the computational costs associated for searching different astrophysical populations, we conducted an analysis on six distinct banks, four characterized by different parameters (i.e., mass, spin, eccentricity, and deformability) generated using our method, one bank using a nonspinning geometric method (D. A. <ref type="bibr">Brown et al. 2012)</ref> to compare how a geometric bank search will perform, and one mass-only bank generated using an existing stochastic method (P. <ref type="bibr">Ajith et al. 2014;</ref><ref type="bibr">C. Capano et al. 2016)</ref>. All banks were standardized with fixed equal component masses spanning [1, 10] M e . Additionally, we maintained a consistent minimal match threshold of 0.95 across all banks and a tolerance of 0.01 for the stochastic banks. The lower frequency for the templates was uniformly set to 20 Hz, the upper frequency was 1000 Hz for each bank, and parameters such as &#964; 0 start, crawl, and remained constant across the stochastic banks. For the other stochastic method, we choose the convergence criteria to be 1000 since that was the most comparable to our banks with a tolerance of 0.01 (showcased in Figure <ref type="figure">3</ref>). For aligned spins, each of the component spins was constrained to [-0.5, 0.5]. For banks accounting for orbital eccentricity (e), e was set to vary from [0, 0.2] for a reference frequency of 20 Hz, using the same spin range defined above. For the deformable bank, we set the tidal deformability &#955; to be [0, 5000], also using the same aligned-spin parameters. Except for the three banks only considering mass, we parallelized three of the banks across six distinct &#964; 0 bins to speed up the bank generation in wall clock time.</p><p>As we increase the number of parameters, we see that the banks take a longer time to generate and the number of templates increase by roughly ( ) 10 &#61519; for every additional pair of parameter incorporated. Explicitly looking at the TaylorF2 waveform banks, mass only had ( ) 10 4 &#61519; and adding a pair of spin parameters drove the bank size up to ( ) 10 5 &#61519; and the tidal deformability banks was of size ( ) 10 6 &#61519; . The eccentric bank and the tidal deformability bank took the longest to generate and had the most amount of templates.</p><p>We find that our method performs similarly to existing stochastic and geometric methods in generating a twoparameter mass-only bank. The geometric method produced the bank in the shortest time and the second largest bank. The existing stochastic method produced the most templates, but also took the longest to generate a bank. However, the comparable cost to complete the search was the lowest for sbank. Overall, our method performs just as well as existing methods. The main advantage of our method is its ability to efficiently construct high-dimensional parameter spaces (N &gt; 4), in which these other methods are unable to do so. Utilizing the inner product inequality significantly enhances efficiency, particularly for larger, higher-dimensional parameter spaces. To quantify the impact of this efficiency, we estimate the proportion of matches excluded by the inner product inequality. For instance, in one of the largest tidal deformable sub-banks, we observed a &#8764;40&#215; reduction in the number of required matches.</p><p>Given a fiducial search analyzing a year of data for a threedetector configuration, with each core capable of processing 5000 templates in real time, we estimate and compare the time required for generating the template bank and running the search (A. H. <ref type="bibr">Nitz et al. 2018</ref>). We present these results of the CPU time scaling for all banks in Table <ref type="table">1</ref>.</p><p>We estimate the computational cost for running a nonspinning search is ( ) 10 5 &#61519; times greater than the bank generation costs, indicating that the speed of a template bank is negligible. We also find that the geometric bank had more templates and generated 2.3 times faster than our stochastic method. However, the search over time ratio is 2.58 times higher for geometric methods than our stochastic method, depicting that faster algorithms are not beneficial toward running the search and the excess number of templates negatively effects the speed of the search. The eccentric and deformable template banks Note. The bolded parameters correspond to template banks generated using our method. The first three banks share the same mass-only parameter space but differ in the methods used: the geometric bank (D. A. <ref type="bibr">Brown et al. 2012</ref>), an existing stochastic method (P. <ref type="bibr">Ajith et al. 2014;</ref><ref type="bibr">C. Capano et al. 2016)</ref>, and our method, respectively. Our method produces comparable sized banks to the other methods in similar times. However, unlike the geometric and existing stochastic method, our method can generate banks with higher-dimensional spaces that include eccentricity, deformability, and so on. The last three rows use our method to construct template banks with spin, eccentricity, and tidal deformability parameters. For searches, we assume one core processes 5000 templates in real time and estimate the time required to analyze one year of data from three detectors. The time it takes to complete a search is a factor of O(10 5 ) more than the time to complete the bank generation for the nonspinning and only spin aligned case, O(10 4 ) for the eccentric bank, and O(10 3 ) for the tidal deformable case. The nonspinning geometric technique generates banks faster than the stochastic methods for mass-only banks. However, the time ratio is the largest for geometric methods, implying that currently template bank generations are a negligible cost to running a search, and faster search methods should be investigated. For larger parameter spaces, the banks generated in around 30-60 core days. The fraction of search time over bank generation time was the lowest for these scenarios. Overall, the most time consuming process is the search. The cost of generating the banks is trivial to the cost of running the search and faster search methodologies should be developed.</p><p>took the longest to complete at around 55 core days. In comparison to the search, the fraction of search time over bank time is ( ) 10 4 &#61519; and ( ) 10 3 &#61519; less, despite having more templates. Since these banks are parallelizable, the cost of generating a bank can always be reduced in wall clock time. Overall, we find that template bank generation is already a negligible computational component of a search, even for high-dimensional spaces with millions of templates. Currently, efforts to generate fast template placement algorithms are less necessary than developing more efficient search methodologies, especially for multiparameter searches.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="6.">Examples</head><p>In this section, we present various applications of our stochastic method in different astrophysical searches. The stochastic method has been instrumental in constructing template banks for several types of gravitational-wave searches by utilizing the varying freedom of choice in the parameter space. Below, we discuss specific examples where this method has been successfully implemented.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="6.1.">Primordial Black Hole and Subsolar Mass Binary Neutron Star</head><p>Detecting low-mass black holes will verify the existence of primordial black holes (PBHs) and provide insights on dark matter distributions (P. Searching for low-mass neutron stars requires a similar template bank as the PBHs search. However, these systems requires consideration for the tidal deformability parameter instead of the eccentricity because the eccentricity in these systems is expected to be negligible. Discovering neutron stars in the subsolar mass range could challenge our understanding of their formation or potentially reveal a new class of stars (V. <ref type="bibr">Doroshenko et al. 2022)</ref>. Previous searches neglected the tidal deformability parameter &#955;, which lost up to 78.4% of the total signals (A. <ref type="bibr">Bandopadhyay et al. 2023)</ref>. This bank was constructed with tidal deformability ranging from [0, 10,000] for both &#955; 1 and &#955; 2 to account for the loss in SNR, primary mass ranging [0.1,2] M e , secondary mass ranging [0.1, 1] M e , both aligned spin &#967; 1z and &#967; 2z ranged from [-0.05, 0.05], and the approximant was chosen to be TaylorF2 (B. S. Sathyaprakash &amp; S. V. Dhurandhar 1991; S. <ref type="bibr">Droz et al. 1999;</ref><ref type="bibr">L. Blanchet 2002;</ref><ref type="bibr">G. Faye et al. 2012)</ref>. Similarly to the PBH search, this bank had the template waveforms fixed to 512 seconds to speed up the search. Figure <ref type="figure">4</ref> illustrates the varying lower frequencies of the waveforms used to maintain this duration. Overall, the bank consisted of 1.01 &#215; 10 7 templates.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="6.2.">Eccentric NSBH and BNS Search</head><p>Measuring the orbital eccentricity of a binary provides insights into its formation history (K. <ref type="bibr">Belczynski et al. 2001</ref>  <ref type="bibr">Nitz (2023)</ref> utilized the flexible bank generation method described in this work to incorporate eccentricity in the template bank. The template bank comprised of six parameters: component masses (m 1 , m 2 ), aligned component spins (s 1z , s 2z ), orbital eccentricity e 20 (defined at 20 Hz), and an additional angle to account for the orientation of the elliptical orbit w.r.t an observer. Signals within the targeted search region are reliably searched using the inspiral-only TaylorF2Ecc model B. <ref type="bibr">Moore et al. (2016)</ref> because the merger phase falls outside the sensitive range of current detectors. The template bank for the search consisted of approximately 6 million templates, and its generation took about a week to complete using 20 cores.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="6.3.">Binary Neutron Star Confusion Noise Cleaning</head><p>In the next decade, next-generation ground-based detectors, such as the Einstein Telescope (ET; S. <ref type="bibr">Hild et al. 2010;</ref><ref type="bibr">M. Punturo et al. 2010)</ref> and Cosmic Explorer (CE; D. <ref type="bibr">Reitze et al. 2019)</ref>, will be available. These detectors will not just be one order of magnitude more sensitive than the current Advanced LIGO and Virgo detectors but also can reach 2 or 3 Hz, making the signals of binary neutron stars last several hours or even several days. According to GWTC-3 population results (R. <ref type="bibr">Abbott et al. 2023a</ref>), S. <ref type="bibr">Wu &amp; A. H. Nitz (2023)</ref> simulates the mock data for those next-generation groundbased detectors and finds that these BNS signals will form the foreground noise to reduce the detection range of detectors if not removed. This BNS confusion noise will affect Cosmic Explorer most by raising the power spectrum density around 10 Hz and introducing a noise correlation in the detector network. S. <ref type="bibr">Wu &amp; A. H. Nitz (2023)</ref> demonstrate a foreground cleaning method using the stochastic template bank for BNS. For bank generation, they choose [2.4, 60] M e as the detectorframe total mass range and [1, 1.636] as the mass ratio range according to the BNS population model. With a mismatch of 0.97 using the design sensitivities of ET and CE, the foreground noise-cleaning banks contain 9.57 &#215; 10 4 and 1.53 &#215; 10 5 templates for CE and ET, respectively. Using these banks to detect and subtract the BNS confusion noise for each detector, they can suppress the total noise to almost the instrument noise level, allowing for near-optimal searches at the following stages. The computational cost of generating and searching with these template banks is lower compared to the full search (A. K. <ref type="bibr">Lenon et al. 2021)</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="6.4.">LISA Supermassive Black Hole Binaries Search and Inference</head><p>There are ongoing efforts to extend PyCBC to do LISA data analysis, C. R. <ref type="bibr">Weaving et al. (2024)</ref> demonstrates how to use the stochastic template bank method described in this paper to find supermassive black hole binaries (SMBHBs) and use the corresponding high SNR template as the reference signal in the following heterodyning parameter estimation. Previously, people thought the template-based analysis was not viable for LISA data analysis due to the huge parameter space (I. W. <ref type="bibr">Harry et al. 2008</ref>), but C. R. <ref type="bibr">Weaving et al. (2024)</ref> demonstrates that we can still use a sparse template bank to find all SMBHB signals in the LISA mock data set Sangria. Different from ground-based detectors, LISA waveforms also need to take the orbital motion of spacecraft and time-delay interferometry (TDI) into account, so these make LISA waveforms much more complex. C. R. <ref type="bibr">Weaving et al. (2024)</ref> use the BBHx (M. L. <ref type="bibr">Katz et al. 2020)</ref> package to generate the LISA-TDI version of the IMRPhenomD waveform and choose an eight-dimensional parameter space (i.e., detector-frame total mass, mass ratio, two aligned spins, ecliptic latitude, ecliptic longitude, polarization angle, and inclination angle) that covers the parameters of SMBHBs in the Sangria data set. Due to the high SNR of these SMBHB signals and almost equal sensitivities of TDI-A and TDI-E channels, they just generate the TDI-A channel&#700;s template bank and use a mismatch threshold of 0.9 to get the SMBHB template bank consisting of around 50 templates. Finally, they successfully detected all the SMBHB signals in the Sangria data set.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="6.5.">Open Gravitational-wave Catalog Search for Compactbinary Mergers</head><p>The fourth open gravitational-wave catalog (OGC) contains the observation of nearly 100 compact-binary mergers (A. H. <ref type="bibr">Nitz et al. 2023)</ref>. The search covers a parameter space from neutron-star binaries through heavy binary black holes (up to &#8764;1000 M e ). The OGC search search splits the analysis into four subregions, covering BNS, NSBH, BBH, and a focused BBH region where the largest numbers of signals are observed. The analysis is based on the open source PyCBC toolkit (S. A. <ref type="bibr">Usman et al. 2016;</ref><ref type="bibr">G. S. Davies et al. 2020</ref>) and makes use of the flexible template bank generation introduced in this work. This enables the use of multiple waveform approximants depending on the suitability for different parts of parameter space, e.g., the use of TaylorF2 (B. S. Sathyaprakash &amp; S. V. Dhurandhar 1991; S. <ref type="bibr">Droz et al. 1999;</ref><ref type="bibr">L. Blanchet 2002;</ref><ref type="bibr">G. Faye et al. 2012)</ref> for neutron-star binaries, and IMRPhenomD (S. <ref type="bibr">Husa et al. 2016;</ref><ref type="bibr">S. Khan et al. 2016</ref>) and SEOBNRv4 for BBH signals <ref type="bibr">(A. Taracchini et al. 2014;</ref><ref type="bibr">A. Boh&#233; et al. 2017)</ref>. The stochastic placement algorithm allows for the iterative generation of a larger template bank by adding to a pre-existing template bank. This allows for regions of parameter space that adapt to different requirements, e.g., a higher minimal match for the focused BBH region of 0.995 or the inclusion of tidal deformability for binary neutron-star templates.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="6.6.">Binaries that Contain a Neutron Star as Gamma-Ray Burst Progenitors</head><p>Mergers of binary neutron star and neutron-star-black hole systems have long been suspected to be the production sites of short duration gamma-ray bursts (S. I. <ref type="bibr">Blinnikov et al. 1984;</ref><ref type="bibr">B. Paczynski 1986;</ref><ref type="bibr">D. Eichler et al. 1989;</ref><ref type="bibr">B. Paczynski 1991;</ref><ref type="bibr">R. Narayan et al. 1992;</ref><ref type="bibr">E. NAKAR 2007;</ref><ref type="bibr">E. Berger 2014)</ref>. In the case of binary neutron stars, this hypothesis was confirmed by the simultaneous detection of GW event GW170817 and its gamma-ray burst counterpart GRB 170817A (B. P. <ref type="bibr">Abbott et al. 2017)</ref>. The main mechanisms invoked to launch the relativistic jet responsible for the gamma-ray emission involve neutrino pair annihilation or the presence of strong magnetic fields. Both scenarios require a remnant constituted by a central compact object accreting from a dense torus of matter surrounding it that develops immediately after the merger event. In the case of two binary neutron stars, the formation of the remnant torus is fueled by the collision of the two neutron stars, while for neutron-star-black hole mergers the presence of the torus depends on the parameters of the system, (see, e.g., K. <ref type="bibr">Kyutoku et al. 2021;</ref><ref type="bibr">A. Gonzalez et al. 2023</ref>, for examples of numerical simulations).</p><p>When constructing template banks for searches that aim at uncovering GW signals compatible with the time and sky location of gamma-ray bursts (I. W. Harry &amp; S. Fairhurst 2011; A. R. <ref type="bibr">Williamson et al. 2014</ref>), the goal is to include all binary neutron star mergers and only those neutron-star-black hole mergers that result in the formation of an accretion torus, as suggested in F. <ref type="bibr">Pannarale &amp; F. Ohme (2014)</ref>. These are referred to as "EM-bright" template banks. To discriminate between neutron-star-black hole systems that produce matter surrounding the central remnant black hole and ones that do not, the PyCBC toolkit implements a formula that predicts the remnant mass left behind in the postmerger. This formula was obtained in F. <ref type="bibr">Foucart et al. (2018)</ref> by fitting results of numerical-relativity neutron-star-black hole merger simulations; it returns the remnant mass M rem given the following parameters of the binary system: its symmetric mass ratio, the radius of the black hole's innermost stable circular orbit, and the neutron star's compactness (see Equation (7) in F. <ref type="bibr">Foucart et al. 2018, for details)</ref>. These banks are therefore built by prescribing priors for masses and spins of neutron stars and black holes, and applying the constraint that the remnant mass surrounding the central black hole is nonvanishing in the case of neutron-star-black hole systems. Given a draw from the priors, there are two operations in this process that depend on the neutron star equation of state: (1) Deciding whether or not each compact object is a neutron star, so that binary neutron stars are added to the bank if necessary, and binary black holes are discarded, and (2) In the case of a neutron-star-black hole binary draw, determining the neutron star compactness corresponding to its mass in order to apply the constraint M rem &gt; 0. Building an EM-bright bank therefore also requires an additional input in the form of a table with mass and compactness values that represent a nonrotating<ref type="foot">foot_1</ref> neutron star equilibrium configuration; this needs to be built externally by the user, see, e.g., <ref type="url">https://compose.obspm.fr/</ref>. Finally, in the case of black hole spins that are not aligned to the orbital angular momentum, we replace the radius of the innermost stable circular orbit with its tilted analog, the radius of the innermost stable spherical orbit, as detailed in Appendix A of N. <ref type="bibr">Stone et al. (2013)</ref>.</p><p>Two neutron-star-black hole banks were produced: one with the EM-bright constraint and one without it. The design parameters were the same for both banks, with the exception of the remnant mass, which was fixed to be strictly greater than zero for the EM-bright bank. In this case, the 2H piecewise polytropic equation of state (J. S. <ref type="bibr">Read et al. 2009</ref>) was adopted. This choice was driven by the fact that this equation of state sets a high maximum neutron star mass (&#8764;2.83 M e ) and it favors tidal disruption because of the high neutron star compactness values it yields, compared to other equations of state. In this sense it is a conservative choice, i.e., it makes the EM-bright constraint as loose as possible. The black hole mass and spin spanned from 2.83 M e to 25 M e and from 0.0 to 0.98, respectively. The neutron star mass ranged from 1.0 M e to 2.83 M e , while the aligned spin range was 0.0-0.05. All priors in these intervals were taken to be uniform. Additionally, we used a minimal match of 0.97 and a lower frequency of 27.0 Hz, and we set the PSD to be the theoretical Advanced LIGO O4 sensitivity (B. P. <ref type="bibr">Abbott et al. 2020)</ref>. The full bank consisted of 193,235 templates, while the EM-bright bank had 143,530 templates, resulting in the exclusion of 49,705 neutron-star-black hole templates representing the portion of parameter space where merger events do not produce a torus as a remnant.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="7.">Conclusion</head><p>We introduce an efficient and flexible method for stochastic template bank generation that produces selfconsistent banks for varying tolerance and minimal match conditions. Our method has already been used for various searches for GWs from different types of compact-binary sources, such as eccentric BNSs and NSBHs (R.  <ref type="bibr">Nitz et al. 2023)</ref>. We find that existing methods are robust and versatile enough for various unique astrophysical scenarios.</p><p>We have demonstrated how the number of parameters in a search scales the computational cost. Compared to a nonspinning bank with only two parameters (masses only), we find an increase of up to ( ) 10 2 &#61519; templates as additional parameters are included in the bank. For future observatories, aligned-spin banks will get bigger by up to two orders of magnitude compared to the current banks (R. <ref type="bibr">Dhurkunde &amp; A. H. Nitz 2022)</ref>. Fast bank generation algorithms alone will not inherently lead to faster searches. The most pressing need for improvement is developing faster or optimizing existing search methods. Ongoing efforts to utilize various hierarchical methods could make current searches up to 20 times faster (R. <ref type="bibr">Dhurkunde et al. 2022;</ref><ref type="bibr">K. Soni et al. 2022)</ref>. If efforts to procure faster searches succeed, the cost of template banks will once again become considerable and efforts to create faster methods will become critical.</p><p>In conclusion, while our method demonstrates significant improvements in template bank generation, it is important to consider the limitations and potential optimizations for utilizing our method for future optimized searches. Stochastic methods can be limited when the waveform approximant takes a long time to generate because the time to generate a waveform linearly scales with the template bank. If the waveform generation time is comparable to the search time, geometric methods might be more appropriate. However, if a search requires a nontrivial parameter space and utilizes slow waveform approximants, optimizing stochastic bank methods becomes necessary. Our method is currently written for CPU use. This method could potentially be optimized by parallelizing the template acceptance proposals on GPUs to help speed up the generation. This optimization might help offset the additional time required for slow waveform approximants.</p><p>The bank generation code pycbc_brute_bank, which uses the method described in this paper, is available at <ref type="url">https://github</ref>. com/gwastro/pycbc/blob/master/bin/bank/pycbc_brute_bank.</p></div><note xmlns="http://www.tei-c.org/ns/1.0" place="foot" xml:id="foot_0"><p>The Astrophysical Journal, 975:212 (10pp), 2024 November 10 Kacanja et al.</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="8" xml:id="foot_1"><p>Recall that the M rem formula does not depend on the neutron star spin.</p></note>
		</body>
		</text>
</TEI>
