Debian Codegraph @

pll/makenewzGenericSpecial.c

raw symbols SCIP
1 /**
2 * PLL (version 1.0.0) a software library for phylogenetic inference
3 * Copyright (C) 2013 Tomas Flouri and Alexandros Stamatakis
4 *
5 * Derived from
6 * RAxML-HPC, a program for sequential and parallel estimation of phylogenetic
7 * trees by Alexandros Stamatakis
8 *
9 * This program is free software: you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the Free
11 * Software Foundation, either version 3 of the License, or (at your option)
12 * any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18 *
19 * You should have received a copy of the GNU General Public License along with
20 * this program. If not, see <http://www.gnu.org/licenses/>.
21 *
22 * For any other enquiries send an Email to Tomas Flouri
23 * [email protected]
24 *
25 * When publishing work that uses PLL please cite PLL
26 *
27 * @file bipartitionList.c
28 */
29 #include "mem_alloc.h"cxx . . $ `<file>/pll/mem_alloc.h`/
30 #include "systypes.h"cxx . . $ `<file>/pll/systypes.h`/
31
32 #include <math.h>
33 #include <time.h>
34 #include <stdlib.h>
35 #include <stdio.h>
36 #include <ctype.h>
37 #include <string.h>
38 #include <assert.h>
39
40 #include "pll.h"cxx . . $ `<file>/pll/pll.h`/
41 #include "pllInternal.h"cxx . . $ `<file>/pll/pllInternal.h`/
42
43 #ifdef __SSE3cxx . . $ `<built-in>:421:9`!
44 #if defined(__ARM_NEON)
45 #include "utils/sse2neon.h"
46 #else
47 #include <xmmintrin.h>
48 #include <pmmintrin.h>
49 /*#include <tmmintrin.h>*/
50 #endif
51 #endif
52
53 #ifdef __MIC_NATIVE
54 #include "mic_native.h"
55 #endif
56
57
58 /** @file makenewzGenericSpecial.c
59 *
60 * @brief Branch length optimization
61 */
62
63
64
65 /* pointers to reduction buffers for storing and gathering the first and second derivative
66 of the likelihood in Pthreads and MPI */
67
68 #ifdef IS_PARALLELcxx . . $ `pll/genericParallelization.h:53:9`!
69 void branchLength_parallelReducecxx . . $ branchLength_parallelReduce(3ee9120fb64e3575).(pllInstancecxx . . $ pllInstance# *tr, double *dlnLdlz, double *d2lnLdlz2, int numBranches ) ;
70 //extern double *globalResult;
71 #endif
72
73
74 extern const unsigned int mask32cxx . . $ mask32.[32];
75
76 #if (defined(__SSE3cxx . . $ `<built-in>:421:9`!) || defined(__AVX))
77 static void sumGAMMA_BINARYcxx . . $ sumGAMMA_BINARY(5111b26dbc8fb27).(int tipCase, double *sumtable, double *x1_start, double *x2_start, double *tipVector,
78 unsigned char *tipX1, unsigned char *tipX2, int n);
79 static void coreGTRGAMMA_BINARYcxx . . $ coreGTRGAMMA_BINARY(c0a820a3f2225259).(const int upper, double *sumtable,
80 volatile double *d1, volatile double *d2, double *EIGN, double *gammaRates, double lz, int *wrptr);
81 static void coreGTRCAT_BINARYcxx . . $ coreGTRCAT_BINARY(25aa5d1ffb96ce3c).(int upper, int numberOfCategories, double *sum,
82 volatile double *d1, volatile double *d2,
83 double *rptr, double *EIGN, int *cptr, double lz, int *wgt);
84 static void sumCAT_BINARYcxx . . $ sumCAT_BINARY(5111b26dbc8fb27).(int tipCase, double *sum, double *x1_start, double *x2_start, double *tipVector,
85 unsigned char *tipX1, unsigned char *tipX2, int n);
86 #endif
87
88 /*******************/
89
90
91 /* generic function to get the required pointers to the data associated with the left and right node that define a branch */
92
93 static void getVectscxx . . $ getVects(8fc2518e497ffab1).(pllInstancecxx . . $ pllInstance# *tr,
94 partitionListcxx . . $ partitionList# *pr,
95 unsigned char **tipX1, unsigned char **tipX2,
96 double **x1_start, double **x2_start,
97 int *tipCase,
98 int model,
99 double **x1_gapColumn, double **x2_gapColumn,
100 unsigned int **x1_gap, unsigned int **x2_gap,
101 double ** x1_start_asc,
102 double ** x2_start_asc)
103 {
104 int
105 rateHet = (int)discreteRateCategoriescxx . . $ discreteRateCategories(c104ebd7d68b2193).(tr->rateHetModelcxx . . $ $anonymous_type_5cae24b3841b71ea_10#rateHetModel.),
106 states = pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->statescxx . . $ $anonymous_type_5cae24b3841b71ea_7#states.,
107 pNumber,
108 qNumber;
109
110 /* get the left and right node number of the nodes defining the branch we want to optimize */
111
112 pNumber = tr->tdcxx . . $ $anonymous_type_5cae24b3841b71ea_10#td.[0].ticxx . . $ $anonymous_type_5cae24b3841b71ea_3#ti.[0].pNumbercxx . . $ $anonymous_type_5cae24b3841b71ea_2#pNumber.;
113 qNumber = tr->tdcxx . . $ $anonymous_type_5cae24b3841b71ea_10#td.[0].ticxx . . $ $anonymous_type_5cae24b3841b71ea_3#ti.[0].qNumbercxx . . $ $anonymous_type_5cae24b3841b71ea_2#qNumber.;
114
115 /* get the index where the ancestral vector is expected to be found */
116 int p_slot, q_slot;
117 if(tr->useRecomcxx . . $ $anonymous_type_5cae24b3841b71ea_10#useRecom.)
118 {
119 p_slot = tr->tdcxx . . $ $anonymous_type_5cae24b3841b71ea_10#td.[0].ticxx . . $ $anonymous_type_5cae24b3841b71ea_3#ti.[0].slot_pcxx . . $ $anonymous_type_5cae24b3841b71ea_2#slot_p.;
120 q_slot = tr->tdcxx . . $ $anonymous_type_5cae24b3841b71ea_10#td.[0].ticxx . . $ $anonymous_type_5cae24b3841b71ea_3#ti.[0].slot_qcxx . . $ $anonymous_type_5cae24b3841b71ea_2#slot_q.;
121 }
122 else
123 {
124 p_slot = pNumber - tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips. - 1;
125 q_slot = qNumber - tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips. - 1;
126 }
127
128
129 /* initialize to NULL */
130
131 *x1_start = (double*)NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
132 *x2_start = (double*)NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
133
134 *tipX1 = (unsigned char*)NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
135 *tipX2 = (unsigned char*)NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
136
137 *x1_start_asc = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
138 *x2_start_asc = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
139
140 /* switch over the different tip cases again here */
141
142 if(isTipcxx . . $ isTip(9b79fb6aee4c0440).(pNumber, tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips.) || isTipcxx . . $ isTip(9b79fb6aee4c0440).(qNumber, tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips.))
143 {
144 if(!( isTipcxx . . $ isTip(9b79fb6aee4c0440).(pNumber, tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips.) && isTipcxx . . $ isTip(9b79fb6aee4c0440).(qNumber, tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips.)) )
145 {
146 *tipCase = PLL_TIP_INNERcxx . . $ `pll/pll.h:245:9`!;
147 if(isTipcxx . . $ isTip(9b79fb6aee4c0440).(qNumber, tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips.))
148 {
149 *tipX1 = pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->yVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#yVector.[qNumber];
150 *x2_start = pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->xVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#xVector.[p_slot];
151
152 #if (defined(_FINE_GRAIN_MPI) || defined(_USE_PTHREADScxx . . $ `<built-in>:420:9`!))
153 if(pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascBiascxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascBias. && tr->threadIDcxx . . $ $anonymous_type_5cae24b3841b71ea_10#threadID. == 0)
154 #else
155 if(pr->partitionData[model]->ascBias)
156 #endif
157 {
158 *x2_start_asc = &pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascVector.[(pNumber - tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips. - 1) * pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascOffsetcxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascOffset.];
159 }
160
161 if(tr->saveMemorycxx . . $ $anonymous_type_5cae24b3841b71ea_10#saveMemory.)
162 {
163 *x2_gap = &(pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->gapVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#gapVector.[pNumber * pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->gapVectorLengthcxx . . $ $anonymous_type_5cae24b3841b71ea_7#gapVectorLength.]);
164 *x2_gapColumn = &pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->gapColumncxx . . $ $anonymous_type_5cae24b3841b71ea_7#gapColumn.[(pNumber - tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips. - 1) * states * rateHet];
165 }
166 }
167 else
168 {
169 *tipX1 = pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->yVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#yVector.[pNumber];
170 *x2_start = pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->xVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#xVector.[q_slot];
171
172 #if (defined(_FINE_GRAIN_MPI) || defined(_USE_PTHREADScxx . . $ `<built-in>:420:9`!))
173 if(pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascBiascxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascBias. && tr->threadIDcxx . . $ $anonymous_type_5cae24b3841b71ea_10#threadID. == 0)
174 #else
175 if(pr->partitionData[model]->ascBias)
176 #endif
177 {
178 *x2_start_asc = &pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascVector.[(qNumber - tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips. - 1) * pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascOffsetcxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascOffset.];
179 }
180
181 if(tr->saveMemorycxx . . $ $anonymous_type_5cae24b3841b71ea_10#saveMemory.)
182 {
183 *x2_gap = &(pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->gapVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#gapVector.[qNumber * pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->gapVectorLengthcxx . . $ $anonymous_type_5cae24b3841b71ea_7#gapVectorLength.]);
184 *x2_gapColumn = &pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->gapColumncxx . . $ $anonymous_type_5cae24b3841b71ea_7#gapColumn.[(qNumber - tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips. - 1) * states * rateHet];
185 }
186 }
187 }
188 else
189 {
190 /* note that tip tip should normally not occur since this means that we are trying to optimize
191 a branch in a two-taxon tree. However, this has been inherited be some RAxML function
192 that optimized pair-wise distances between all taxa in a tree */
193
194 *tipCase = PLL_TIP_TIPcxx . . $ `pll/pll.h:244:9`!;
195 *tipX1 = pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->yVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#yVector.[pNumber];
196 *tipX2 = pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->yVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#yVector.[qNumber];
197 }
198 }
199 else
200 {
201 *tipCase = PLL_INNER_INNERcxx . . $ `pll/pll.h:246:9`!;
202
203 *x1_start = pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->xVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#xVector.[p_slot];
204 *x2_start = pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->xVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#xVector.[q_slot];
205
206 #if (defined(_FINE_GRAIN_MPI) || defined(_USE_PTHREADScxx . . $ `<built-in>:420:9`!))
207 if(pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascBiascxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascBias. && tr->threadIDcxx . . $ $anonymous_type_5cae24b3841b71ea_10#threadID. == 0)
208 #else
209 if(pr->partitionData[model]->ascBias)
210 #endif
211 {
212 *x1_start_asc = &pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascVector.[(pNumber - tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips. - 1) * pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascOffsetcxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascOffset.];
213 *x2_start_asc = &pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascVector.[(qNumber - tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips. - 1) * pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascOffsetcxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascOffset.];
214 }
215 if(tr->saveMemorycxx . . $ $anonymous_type_5cae24b3841b71ea_10#saveMemory.)
216 {
217 *x1_gap = &(pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->gapVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#gapVector.[pNumber * pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->gapVectorLengthcxx . . $ $anonymous_type_5cae24b3841b71ea_7#gapVectorLength.]);
218 *x1_gapColumn = &pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->gapColumncxx . . $ $anonymous_type_5cae24b3841b71ea_7#gapColumn.[(pNumber - tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips. - 1) * states * rateHet];
219
220 *x2_gap = &(pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->gapVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#gapVector.[qNumber * pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->gapVectorLengthcxx . . $ $anonymous_type_5cae24b3841b71ea_7#gapVectorLength.]);
221 *x2_gapColumn = &pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->gapColumncxx . . $ $anonymous_type_5cae24b3841b71ea_7#gapColumn.[(qNumber - tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips. - 1) * states * rateHet];
222 }
223 }
224
225 }
226
227
228 /* this is actually a pre-computation and storage of values that remain constant while we change the value of the branch length
229 we want to adapt. the target pointer sumtable is a single pre-allocated array that has the same
230 size as a conditional likelihood vector at an inner node.
231
232 So if we want to do a Newton-Raphson optimization we only execute this function once in the beginning for each new branch we are considering !
233 */
234
235 #if (!defined(__SSE3cxx . . $ `<built-in>:421:9`!) && !defined(__AVX))
236 static void sumCAT_FLEX(int tipCase, double *sumtable, double *x1, double *x2, double *tipVector,
237 unsigned char *tipX1, unsigned char *tipX2, int n, const int states)
238 {
239 int
240 i,
241 l;
242
243 double
244 *sum,
245 *left,
246 *right;
247
248 switch(tipCase)
249 {
250
251 /* switch over possible configurations of the nodes p and q defining the branch */
252
253 case PLL_TIP_TIP:
254 for (i = 0; i < n; i++)
255 {
256 left = &(tipVector[states * tipX1[i]]);
257 right = &(tipVector[states * tipX2[i]]);
258 sum = &sumtable[states * i];
259
260 /* just multiply the values with each other for each site, note the similarity with evaluate()
261 we precompute the product which will remain constant and then just multiply this pre-computed
262 product with the changing P matrix exponentaions that depend on the branch lengths */
263
264 for(l = 0; l < states; l++)
265 sum[l] = left[l] * right[l];
266 }
267 break;
268 case PLL_TIP_INNER:
269
270 /* same as for PLL_TIP_TIP only that
271 we now access on tip vector and one
272 inner vector.
273
274 You may also observe that we do not consider using scaling vectors anywhere here.
275
276 This is because we are interested in the first and second derivatives of the likelihood and
277 hence the addition of the log() of the scaling factor times the number of scaling events
278 becomes obsolete through the derivative */
279
280 for (i = 0; i < n; i++)
281 {
282 left = &(tipVector[states * tipX1[i]]);
283 right = &x2[states * i];
284 sum = &sumtable[states * i];
285
286 for(l = 0; l < states; l++)
287 sum[l] = left[l] * right[l];
288 }
289 break;
290 case PLL_INNER_INNER:
291 for (i = 0; i < n; i++)
292 {
293 left = &x1[states * i];
294 right = &x2[states * i];
295 sum = &sumtable[states * i];
296
297 for(l = 0; l < states; l++)
298 sum[l] = left[l] * right[l];
299 }
300 break;
301 default:
302 assert(0);
303 }
304 }
305 #endif
306
307
308
309 #if (!defined(__SSE3cxx . . $ `<built-in>:421:9`!) && !defined(__AVX))
310
311 /* same thing for GAMMA models. The only noteworthy thing here is that we have an additional inner loop over the
312 number of discrete gamma rates. The data access pattern is also different since for tip vector accesses through our
313 lookup table, we do not distnguish between rates
314
315 Note the different access pattern in PLL_TIP_INNER:
316
317 left = &(tipVector[states * tipX1[i]]);
318 right = &(x2[span * i + l * states]);
319
320 */
321
322 static void sumGAMMA_FLEX(int tipCase, double *sumtable, double *x1, double *x2, double *tipVector,
323 unsigned char *tipX1, unsigned char *tipX2, int n, const int states)
324 {
325 int
326 i,
327 l,
328 k;
329
330 const int
331 span = 4 * states;
332
333 double
334 *left,
335 *right,
336 *sum;
337
338
339
340
341 switch(tipCase)
342 {
343 case PLL_TIP_TIP:
344 for(i = 0; i < n; i++)
345 {
346 left = &(tipVector[states * tipX1[i]]);
347 right = &(tipVector[states * tipX2[i]]);
348
349 for(l = 0; l < 4; l++)
350 {
351 sum = &sumtable[i * span + l * states];
352
353 for(k = 0; k < states; k++)
354 sum[k] = left[k] * right[k];
355
356 }
357 }
358 break;
359 case PLL_TIP_INNER:
360 //reorder_back( x2, n, span );
361 for(i = 0; i < n; i++)
362 {
363 left = &(tipVector[states * tipX1[i]]);
364
365 for(l = 0; l < 4; l++)
366 {
367 right = &(x2[span * i + l * states]);
368 sum = &sumtable[i * span + l * states];
369
370 for(k = 0; k < states; k++)
371 sum[k] = left[k] * right[k];
372
373 }
374 }
375 //reorder( x2, n, span );
376 break;
377 case PLL_INNER_INNER:
378 //reorder_back( x1, n, span );
379 //reorder_back( x2, n, span );
380 for(i = 0; i < n; i++)
381 {
382 for(l = 0; l < 4; l++)
383 {
384 left = &(x1[span * i + l * states]);
385 right = &(x2[span * i + l * states]);
386 sum = &(sumtable[i * span + l * states]);
387
388
389 for(k = 0; k < states; k++)
390 sum[k] = left[k] * right[k];
391 }
392 }
393 //reorder( x1, n, span );
394 //reorder( x2, n, span );
395 break;
396 default:
397 assert(0);
398 }
399 }
400 #endif
401
402 /* optimized functions for branch length optimization */
403
404
405 #if (defined(__SSE3cxx . . $ `<built-in>:421:9`!) || defined(__AVX))
406
407 static void sumCAT_SAVEcxx . . $ sumCAT_SAVE(c21ac5ae73f5a996).(int tipCase, double *sum, double *x1_start, double *x2_start, double *tipVector,
408 unsigned char *tipX1, unsigned char *tipX2, int n, double *x1_gapColumn, double *x2_gapColumn, unsigned int *x1_gap, unsigned int *x2_gap);
409
410 static void sumGAMMA_GAPPED_SAVEcxx . . $ sumGAMMA_GAPPED_SAVE(c21ac5ae73f5a996).(int tipCase, double *sumtable, double *x1_start, double *x2_start, double *tipVector,
411 unsigned char *tipX1, unsigned char *tipX2, int n,
412 double *x1_gapColumn, double *x2_gapColumn, unsigned int *x1_gap, unsigned int *x2_gap);
413
414 static void sumGAMMAcxx . . $ sumGAMMA(5111b26dbc8fb27).(int tipCase, double *sumtable, double *x1_start, double *x2_start, double *tipVector,
415 unsigned char *tipX1, unsigned char *tipX2, int n);
416
417 static void sumCATcxx . . $ sumCAT(5111b26dbc8fb27).(int tipCase, double *sum, double *x1_start, double *x2_start, double *tipVector,
418 unsigned char *tipX1, unsigned char *tipX2, int n);
419
420 static void sumGAMMAPROT_GAPPED_SAVEcxx . . $ sumGAMMAPROT_GAPPED_SAVE(c21ac5ae73f5a996).(int tipCase, double *sumtable, double *x1, double *x2, double *tipVector,
421 unsigned char *tipX1, unsigned char *tipX2, int n,
422 double *x1_gapColumn, double *x2_gapColumn, unsigned int *x1_gap, unsigned int *x2_gap);
423
424 static void sumGAMMAPROT_LG4cxx . . $ sumGAMMAPROT_LG4(101081f4e3ed5496).(int tipCase, double *sumtable, double *x1, double *x2, double *tipVector[4],
425 unsigned char *tipX1, unsigned char *tipX2, int n);
426
427 static void sumGAMMAPROTcxx . . $ sumGAMMAPROT(5111b26dbc8fb27).(int tipCase, double *sumtable, double *x1, double *x2, double *tipVector,
428 unsigned char *tipX1, unsigned char *tipX2, int n);
429
430 static void sumGTRCATPROTcxx . . $ sumGTRCATPROT(5111b26dbc8fb27).(int tipCase, double *sumtable, double *x1, double *x2, double *tipVector,
431 unsigned char *tipX1, unsigned char *tipX2, int n);
432
433 static void sumGTRCATPROT_SAVEcxx . . $ sumGTRCATPROT_SAVE(c21ac5ae73f5a996).(int tipCase, double *sumtable, double *x1, double *x2, double *tipVector,
434 unsigned char *tipX1, unsigned char *tipX2, int n,
435 double *x1_gapColumn, double *x2_gapColumn, unsigned int *x1_gap, unsigned int *x2_gap);
436
437 static void coreGTRGAMMAPROT_LG4cxx . . $ coreGTRGAMMAPROT_LG4(b7457016642a760a).(double *gammaRates, double *EIGN[4], double *sumtable, int upper, int *wrptr,
438 volatile double *ext_dlnLdlz, volatile double *ext_d2lnLdlz2, double lz,
439 double * lg4_weights);
440
441 static void coreGTRGAMMAcxx . . $ coreGTRGAMMA(c0a820a3f2225259).(const int upper, double *sumtable,
442 volatile double *ext_dlnLdlz, volatile double *ext_d2lnLdlz2, double *EIGN, double *gammaRates, double lz, int *wrptr);
443
444 static void coreGTRCATcxx . . $ coreGTRCAT(ce8aafcb1e86b883).(int upper, int numberOfCategories, double *sum,
445 volatile double *d1, volatile double *d2, int *wgt,
446 double *rptr, double *EIGN, int *cptr, double lz);
447
448
449 static void coreGTRGAMMAPROTcxx . . $ coreGTRGAMMAPROT(51b4f202b4cc753d).(double *gammaRates, double *EIGN, double *sumtable, int upper, int *wrptr,
450 volatile double *ext_dlnLdlz, volatile double *ext_d2lnLdlz2, double lz);
451
452 static void coreGTRCATPROTcxx . . $ coreGTRCATPROT(7a64fe835b18a73f).(double *EIGN, double lz, int numberOfCategories, double *rptr, int *cptr, int upper,
453 int *wgt, volatile double *ext_dlnLdlz, volatile double *ext_d2lnLdlz2, double *sumtable);
454
455 #endif
456
457
458 /* now this is the core function of the newton-Raphson based branch length optimization that actually computes
459 the first and second derivative of the likelihood given a new proposed branch length lz */
460
461 static void ascertainmentBiasSequencecxx . . $ ascertainmentBiasSequence(fc0f0e1646c32816).(unsigned char tip[32], int numStates)
462 {
463 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(numStates <= 32 && numStates > 1);
464
465 switch(numStates)
466 {
467 case 2:
468 tip[0] = 1;
469 tip[1] = 2;
470 break;
471 case 4:
472 tip[0] = 1;
473 tip[1] = 2;
474 tip[2] = 4;
475 tip[3] = 8;
476 break;
477 default:
478 {
479 int
480 i;
481 for(i = 0; i < numStates; i++)
482 {
483 tip[i] = i;
484 //printf("%c ", inverseMeaningPROT[i]);
485 }
486 //printf("\n");
487 }
488 break;
489 }
490 }
491
492 static double coreCatAsccxx . . $ coreCatAsc(35538ba82643c0cf).(double *EIGN, double *sumtable, int upper,
493 volatile double *ext_dlnLdlz, volatile double *ext_d2lnLdlz2, double lz, const int numStates,
494 double *ascScaler)
495 {
496 double
497 diagptable[1024],
498 lh = 0.0,
499 dlnLdlz = 0.0,
500 d2lnLdlz2 = 0.0,
501 ki,
502 kisqr;
503
504 int
505 i,
506 l;
507
508
509 ki = 1.0;
510 kisqr = 1.0;
511
512 for(l = 1; l < numStates; l++)
513 {
514 diagptable[l * 4] = exp(EIGN[l-1] * ki * lz);
515 diagptable[l * 4 + 1] = EIGN[l-1] * ki;
516 diagptable[l * 4 + 2] = EIGN[l-1] * EIGN[l-1] * kisqr;
517 }
518
519 for (i = 0; i < upper; i++)
520 {
521 double
522 *sum = &sumtable[i * numStates],
523 tmp,
524 inv_Li = 0.0,
525 dlnLidlz = 0.0,
526 d2lnLidlz2 = 0.0;
527
528
529 inv_Li += sum[0];
530
531 for(l = 1; l < numStates; l++)
532 {
533 inv_Li += (tmp = diagptable[l * 4] * sum[l]);
534 dlnLidlz += tmp * diagptable[l * 4 + 1];
535 d2lnLidlz2 += tmp * diagptable[l * 4 + 2];
536 }
537
538 inv_Li = fabs(inv_Li);
539
540 lh += inv_Li * ascScaler[i];
541 dlnLdlz += dlnLidlz * ascScaler[i];
542 d2lnLdlz2 += d2lnLidlz2 * ascScaler[i];
543 }
544
545 *ext_dlnLdlz = (dlnLdlz / (lh - 1.0));
546 *ext_d2lnLdlz2 = (((lh - 1.0) * (d2lnLdlz2) - (dlnLdlz * dlnLdlz)) / ((lh - 1.0) * (lh - 1.0)));
547
548 return lh;
549 }
550
551
552 static double coreGammaAsccxx . . $ coreGammaAsc(f76c7caf2958752).(double *gammaRates, double *EIGN, double *sumtable, int upper,
553 volatile double *ext_dlnLdlz, volatile double *ext_d2lnLdlz2, double lz, const int numStates,
554 double *ascScaler)
555 {
556 double
557 diagptable[1024],
558 lh = 0.0,
559 dlnLdlz = 0.0,
560 d2lnLdlz2 = 0.0,
561 ki,
562 kisqr;
563
564 int
565 i,
566 j,
567 l;
568
569 const int
570 gammaStates = 4 * numStates;
571
572 for(i = 0; i < 4; i++)
573 {
574 ki = gammaRates[i];
575 kisqr = ki * ki;
576
577 for(l = 1; l < numStates; l++)
578 {
579 diagptable[i * gammaStates + l * 4] = exp(EIGN[l-1] * ki * lz);
580 diagptable[i * gammaStates + l * 4 + 1] = EIGN[l-1] * ki;
581 diagptable[i * gammaStates + l * 4 + 2] = EIGN[l-1] * EIGN[l-1] * kisqr;
582 }
583 }
584
585 for (i = 0; i < upper; i++)
586 {
587 double
588 *sum = &sumtable[i * gammaStates],
589 tmp,
590 inv_Li = 0.0,
591 dlnLidlz = 0.0,
592 d2lnLidlz2 = 0.0;
593
594 for(j = 0; j < 4; j++)
595 {
596 inv_Li += sum[j * numStates];
597
598 for(l = 1; l < numStates; l++)
599 {
600 inv_Li += (tmp = diagptable[j * gammaStates + l * 4] * sum[j * numStates + l]);
601 dlnLidlz += tmp * diagptable[j * gammaStates + l * 4 + 1];
602 d2lnLidlz2 += tmp * diagptable[j * gammaStates + l * 4 + 2];
603 }
604 }
605
606 inv_Li = 0.25 * fabs(inv_Li);
607 dlnLidlz *= 0.25;
608 d2lnLidlz2 *= 0.25;
609
610 lh += inv_Li * ascScaler[i];
611 dlnLdlz += dlnLidlz * ascScaler[i];
612 d2lnLdlz2 += d2lnLidlz2 * ascScaler[i];
613 }
614
615 *ext_dlnLdlz = (dlnLdlz / (lh - 1.0));
616 *ext_d2lnLdlz2 = (((lh - 1.0) * (d2lnLdlz2) - (dlnLdlz * dlnLdlz)) / ((lh - 1.0) * (lh - 1.0)));
617
618 return lh;
619 }
620
621 static void sumCatAsccxx . . $ sumCatAsc(2435bd35d946ee68).(int tipCase, double *sumtable, double *x1, double *x2, double *tipVector,
622 int n, const int numStates)
623 {
624 int i, k;
625 double *left, *right, *sum;
626
627 unsigned char
628 tip[32];
629
630 ascertainmentBiasSequencecxx . . $ ascertainmentBiasSequence(fc0f0e1646c32816).(tip, numStates);
631
632 switch(tipCase)
633 {
634 case PLL_TIP_TIPcxx . . $ `pll/pll.h:244:9`!:
635 for(i = 0; i < n; i++)
636 {
637 left = &(tipVector[numStates * tip[i]]);
638 right = &(tipVector[numStates * tip[i]]);
639
640
641 sum = &sumtable[i * numStates];
642
643 for(k = 0; k < numStates; k++)
644 sum[k] = left[k] * right[k];
645 }
646 break;
647 case PLL_TIP_INNERcxx . . $ `pll/pll.h:245:9`!:
648 for(i = 0; i < n; i++)
649 {
650 left = &(tipVector[numStates * tip[i]]);
651
652
653 right = &(x2[i * numStates]);
654 sum = &sumtable[i * numStates];
655
656 for(k = 0; k < numStates; k++)
657 sum[k] = left[k] * right[k];
658 }
659 break;
660 case PLL_INNER_INNERcxx . . $ `pll/pll.h:246:9`!:
661 for(i = 0; i < n; i++)
662 {
663 left = &(x1[i * numStates]);
664 right = &(x2[i * numStates]);
665 sum = &(sumtable[i * numStates]);
666
667 for(k = 0; k < numStates; k++)
668 sum[k] = left[k] * right[k];
669 }
670 break;
671 default:
672 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0);
673 }
674 }
675
676 static void sumGammaAsccxx . . $ sumGammaAsc(2435bd35d946ee68).(int tipCase, double *sumtable, double *x1, double *x2, double *tipVector,
677 int n, const int numStates)
678 {
679 int i, l, k;
680 double *left, *right, *sum;
681
682 const int gammaStates = numStates * 4;
683
684 unsigned char
685 tip[32];
686
687 ascertainmentBiasSequencecxx . . $ ascertainmentBiasSequence(fc0f0e1646c32816).(tip, numStates);
688
689 switch(tipCase)
690 {
691 case PLL_TIP_TIPcxx . . $ `pll/pll.h:244:9`!:
692 for(i = 0; i < n; i++)
693 {
694 left = &(tipVector[numStates * tip[i]]);
695 right = &(tipVector[numStates * tip[i]]);
696
697 for(l = 0; l < 4; l++)
698 {
699 sum = &sumtable[i * gammaStates + l * numStates];
700 for(k = 0; k < numStates; k++)
701 sum[k] = left[k] * right[k];
702 }
703 }
704 break;
705 case PLL_TIP_INNERcxx . . $ `pll/pll.h:245:9`!:
706 for(i = 0; i < n; i++)
707 {
708 left = &(tipVector[numStates * tip[i]]);
709
710 for(l = 0; l < 4; l++)
711 {
712 right = &(x2[gammaStates * i + l * numStates]);
713 sum = &sumtable[i * gammaStates + l * numStates];
714
715 for(k = 0; k < numStates; k++)
716 sum[k] = left[k] * right[k];
717 }
718 }
719 break;
720 case PLL_INNER_INNERcxx . . $ `pll/pll.h:246:9`!:
721 for(i = 0; i < n; i++)
722 {
723 for(l = 0; l < 4; l++)
724 {
725 left = &(x1[gammaStates * i + l * numStates]);
726 right = &(x2[gammaStates * i + l * numStates]);
727 sum = &(sumtable[i * gammaStates + l * numStates]);
728
729 for(k = 0; k < numStates; k++)
730 sum[k] = left[k] * right[k];
731 }
732 }
733 break;
734 default:
735 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0);
736 }
737 }
738
739
740
741
742 #if (!defined(__AVX) && !defined(__SSE3cxx . . $ `<built-in>:421:9`!))
743 static void coreCAT_FLEX(int upper, int numberOfCategories, double *sum,
744 volatile double *d1, volatile double *d2, int *wgt,
745 double *rptr, double *EIGN, int *cptr, double lz, const int states)
746 /* rptr perSiteRates pointer, cptr rateCategory pointer */
747 {
748 int
749 i,
750 l;
751
752 double
753 *d,
754
755 /* arrays to store stuff we can pre-compute */
756 *d_start = NULL,
757 *e = NULL,
758 *s = NULL,
759 *dd = NULL,
760 inv_Li,
761 dlnLidlz,
762 d2lnLidlz2,
763 dlnLdlz = 0.0,
764 d2lnLdlz2 = 0.0;
765
766 rax_posix_memalign ((void **) &d_start, PLL_BYTE_ALIGNMENT, numberOfCategories * states * sizeof(double));
767 rax_posix_memalign ((void **) &e, PLL_BYTE_ALIGNMENT, (states * sizeof(double)));
768 rax_posix_memalign ((void **) &s, PLL_BYTE_ALIGNMENT, states * sizeof(double));
769 rax_posix_memalign ((void **) &dd, PLL_BYTE_ALIGNMENT, states * sizeof(double)),
770 d = d_start;
771
772 e[0] = 0.0;
773 s[0] = 0.0;
774 dd[0] = 0.0;
775
776
777 /* we are pre-computing values for computing the first and second derivative of P(lz)
778 since this requires an exponetial that the only thing we really have to derive here */
779
780 for(l = 1; l < states; l++)
781 {
782 s[l] = EIGN[l];
783 e[l] = EIGN[l] * EIGN[l];
784 dd[l] = s[l] * lz;
785 }
786
787 /* compute the P matrices and their derivatives for
788 all per-site rate categories */
789
790 for(i = 0; i < numberOfCategories; i++)
791 {
792 d[states * i] = 1.0;
793 for(l = 1; l < states; l++)
794 d[states * i + l] = exp(dd[l] * rptr[i]);
795 }
796
797
798 /* now loop over the sites in this partition to obtain the per-site 1st and 2nd derivatives */
799
800 for (i = 0; i < upper; i++)
801 {
802 /* get the correct p matrix for the rate at the current site i */
803
804 d = &d_start[states * cptr[i]];
805
806 /* this is the likelihood at site i, NOT the log likelihood, we don't need the log
807 likelihood to compute derivatives ! */
808
809 inv_Li = sum[states * i];
810
811 /* those are for storing the first and second derivative of the Likelihood at site i */
812
813 dlnLidlz = 0.0;
814 d2lnLidlz2 = 0.0;
815
816 /* now multiply the likelihood and the first and second derivative with the
817 appropriate derivatives of P(lz) */
818
819 for(l = 1; l < states; l++)
820 {
821 double
822 tmpv = d[l] * sum[states * i + l];
823
824 inv_Li += tmpv;
825 dlnLidlz += tmpv * s[l];
826 d2lnLidlz2 += tmpv * e[l];
827 }
828
829 /* below we are implementing the other mathematical operations that are required
830 to obtain the deirivatives */
831
832 inv_Li = 1.0 / fabs (inv_Li);
833
834 dlnLidlz *= inv_Li;
835 d2lnLidlz2 *= inv_Li;
836
837 /* compute the accumulated first and second derivatives of this site */
838
839 dlnLdlz += wgt[i] * rptr[cptr[i]] * dlnLidlz;
840 d2lnLdlz2 += wgt[i] * rptr[cptr[i]] * rptr[cptr[i]] * (d2lnLidlz2 - dlnLidlz * dlnLidlz);
841 }
842
843 /*
844 set the result values, i.e., the sum of the per-site first and second derivatives of the likelihood function
845 for this partition.
846 */
847
848 *d1 = dlnLdlz;
849 *d2 = d2lnLdlz2;
850
851 /* free the temporary arrays */
852
853 rax_free(d_start);
854 rax_free(e);
855 rax_free(s);
856 rax_free(dd);
857 }
858
859 static void coreGAMMA_FLEX(int upper, double *sumtable, volatile double *ext_dlnLdlz, volatile double *ext_d2lnLdlz2,
860 double *EIGN, double *gammaRates, double lz, int *wrptr, const int states)
861 {
862 double
863 *sum,
864 diagptable[1024], /* TODO make this dynamic */
865 dlnLdlz = 0.0,
866 d2lnLdlz2 = 0.0,
867 ki,
868 kisqr,
869 tmp,
870 inv_Li,
871 dlnLidlz,
872 d2lnLidlz2;
873
874 int
875 i,
876 j,
877 l;
878
879 const int
880 gammaStates = 4 * states;
881
882 /* pre-compute the derivatives of the P matrix for all discrete GAMMA rates */
883
884 for(i = 0; i < 4; i++)
885 {
886 ki = gammaRates[i];
887 kisqr = ki * ki;
888
889 for(l = 1; l < states; l++)
890 {
891 diagptable[i * gammaStates + l * 4] = exp(EIGN[l] * ki * lz);
892 diagptable[i * gammaStates + l * 4 + 1] = EIGN[l] * ki;
893 diagptable[i * gammaStates + l * 4 + 2] = EIGN[l] * EIGN[l] * kisqr;
894 }
895 }
896
897 /* loop over sites in this partition */
898
899 for (i = 0; i < upper; i++)
900 {
901 /* access the array with pre-computed values */
902 sum = &sumtable[i * gammaStates];
903
904 /* initial per-site likelihood and 1st and 2nd derivatives */
905
906 inv_Li = 0.0;
907 dlnLidlz = 0.0;
908 d2lnLidlz2 = 0.0;
909
910 /* loop over discrete GAMMA rates */
911
912 for(j = 0; j < 4; j++)
913 {
914 inv_Li += sum[j * states];
915
916 for(l = 1; l < states; l++)
917 {
918 inv_Li += (tmp = diagptable[j * gammaStates + l * 4] * sum[j * states + l]);
919 dlnLidlz += tmp * diagptable[j * gammaStates + l * 4 + 1];
920 d2lnLidlz2 += tmp * diagptable[j * gammaStates + l * 4 + 2];
921 }
922 }
923
924 /* finalize derivative computation */
925 /* note that wrptr[] here unlike in CAT above is the
926 integer weight vector of the current site
927
928 The operations:
929
930 EIGN[l] * ki;
931 EIGN[l] * EIGN[l] * kisqr;
932
933 that are hidden in CAT in wrptr (at least the * ki and * ki *ki part of them
934 are done explicitely here
935
936 */
937
938 inv_Li = 1.0 / fabs (inv_Li);
939
940 dlnLidlz *= inv_Li;
941 d2lnLidlz2 *= inv_Li;
942
943 dlnLdlz += wrptr[i] * dlnLidlz;
944 d2lnLdlz2 += wrptr[i] * (d2lnLidlz2 - dlnLidlz * dlnLidlz);
945 }
946
947 *ext_dlnLdlz = dlnLdlz;
948 *ext_d2lnLdlz2 = d2lnLdlz2;
949
950 }
951 #endif
952
953 //void sumGAMMA_FLEX_reorder(int tipCase, double *sumtable, double *x1, double *x2, double *tipVector,
954 // unsigned char *tipX1, unsigned char *tipX2, int n, const int states);
955
956 /** @brief Precompute values (sumtable) from the 2 likelihood vectors of a given branch
957 *
958 * @warning These precomputations are stored in \a tr->partitionData[model].sumBuffer, which is used by function \a execCore
959 *
960 * @param tr
961 * Library instance
962 *
963 * @warning the given branch is implicitly defined in \a tr by these nodes:
964 * pNumber = tr->td[0].ti[0].pNumber;
965 * qNumber = tr->td[0].ti[0].qNumber;
966 *
967 *
968 * @note This function should be called only once at the very beginning of each Newton-Raphson procedure for optimizing barnch lengths. It initially invokes an iterative newview call to get a consistent pair of vectors at the left and the right end of the branch and thereafter invokes the one-time only precomputation of values (sumtable) that can be re-used in each Newton-Raphson iteration. Once this function has been called we can execute the actual NR procedure
969 *
970 *
971 */
972 void makenewzIterativecxx . . $ makenewzIterative(cd932907150aaa55).(pllInstancecxx . . $ pllInstance# *tr, partitionListcxx . . $ partitionList# * pr)
973 {
974 int
975 model,
976 tipCase;
977
978 double
979 *x1_start = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
980 *x2_start = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
981 *x1_start_asc = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
982 *x2_start_asc = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
983
984
985 unsigned char
986 *tipX1,
987 *tipX2;
988
989 double
990 *x1_gapColumn = (double*)NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
991 *x2_gapColumn = (double*)NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
992
993 unsigned int
994 *x1_gap = (unsigned int*)NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
995 *x2_gap = (unsigned int*)NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
996
997 /* call newvieIterative to get the likelihood arrays to the left and right of the branch */
998
999 pllNewviewIterativecxx . . $ pllNewviewIterative(d7242fe58f893e85).(tr, pr, 1);
1000
1001
1002 /*
1003 loop over all partoitions to do the precomputation of the sumTable buffer
1004 This is analogous to the pllNewviewIterative() and pllEvaluateIterative()
1005 implementations.
1006 */
1007
1008 for(model = 0; model < pr->numberOfPartitionscxx . . $ $anonymous_type_5cae24b3841b71ea_8#numberOfPartitions.; model++)
1009 {
1010 int
1011 width = pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->widthcxx . . $ $anonymous_type_5cae24b3841b71ea_7#width.;
1012
1013 if(tr->tdcxx . . $ $anonymous_type_5cae24b3841b71ea_10#td.[0].executeModelcxx . . $ $anonymous_type_5cae24b3841b71ea_3#executeModel.[model] && width > 0)
1014 {
1015 int
1016 states = pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->statescxx . . $ $anonymous_type_5cae24b3841b71ea_7#states.;
1017
1018
1019 getVectscxx . . $ getVects(8fc2518e497ffab1).(tr, pr, &tipX1, &tipX2, &x1_start, &x2_start, &tipCase, model, &x1_gapColumn, &x2_gapColumn, &x1_gap, &x2_gap, &x1_start_asc, &x2_start_asc);
1020
1021 #if (!defined(__SSE3cxx . . $ `<built-in>:421:9`!) && !defined(__AVX) && !defined(__MIC_NATIVE))
1022 assert(!tr->saveMemory);
1023 if(tr->rateHetModel == PLL_CAT)
1024 sumCAT_FLEX(tipCase, pr->partitionData[model]->sumBuffer, x1_start, x2_start, pr->partitionData[model]->tipVector, tipX1, tipX2,
1025 width, states);
1026 else
1027 //sumGAMMA_FLEX_reorder(tipCase, pr->partitionData[model]->sumBuffer, x1_start, x2_start, pr->partitionData[model]->tipVector, tipX1, tipX2,
1028 sumGAMMA_FLEX(tipCase, pr->partitionData[model]->sumBuffer, x1_start, x2_start, pr->partitionData[model]->tipVector, tipX1, tipX2,
1029 width, states);
1030 #else
1031 switch(states)
1032 {
1033 case 2: /* BINARY */
1034 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(!tr->saveMemory);
1035 if (tr->rateHetModelcxx . . $ $anonymous_type_5cae24b3841b71ea_10#rateHetModel. == PLL_CATcxx . . $ `pll/pll.h:291:9`!)
1036 sumCAT_BINARYcxx . . $ sumCAT_BINARY(5111b26dbc8fb27).(tipCase, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->sumBuffercxx . . $ $anonymous_type_5cae24b3841b71ea_7#sumBuffer., x1_start, x2_start, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->tipVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#tipVector., tipX1, tipX2,
1037 width);
1038 else
1039 sumGAMMA_BINARYcxx . . $ sumGAMMA_BINARY(5111b26dbc8fb27).(tipCase, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->sumBuffercxx . . $ $anonymous_type_5cae24b3841b71ea_7#sumBuffer., x1_start, x2_start, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->tipVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#tipVector., tipX1, tipX2,
1040 width);
1041 break;
1042 case 4: /* DNA */
1043 #ifdef __MIC_NATIVE
1044 assert(!tr->saveMemory);
1045 assert(tr->rateHetModel == PLL_GAMMA);
1046
1047 sumGTRGAMMA_MIC(tipCase, pr->partitionData[model]->sumBuffer, x1_start, x2_start, pr->partitionData[model]->tipVector, tipX1, tipX2,
1048 width);
1049 #else
1050 if(tr->rateHetModelcxx . . $ $anonymous_type_5cae24b3841b71ea_10#rateHetModel. == PLL_CATcxx . . $ `pll/pll.h:291:9`!)
1051 {
1052 if(tr->saveMemorycxx . . $ $anonymous_type_5cae24b3841b71ea_10#saveMemory.)
1053 sumCAT_SAVEcxx . . $ sumCAT_SAVE(c21ac5ae73f5a996).(tipCase, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->sumBuffercxx . . $ $anonymous_type_5cae24b3841b71ea_7#sumBuffer., x1_start, x2_start, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->tipVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#tipVector., tipX1, tipX2,
1054 width, x1_gapColumn, x2_gapColumn, x1_gap, x2_gap);
1055 else
1056 sumCATcxx . . $ sumCAT(5111b26dbc8fb27).(tipCase, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->sumBuffercxx . . $ $anonymous_type_5cae24b3841b71ea_7#sumBuffer., x1_start, x2_start, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->tipVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#tipVector., tipX1, tipX2,
1057 width);
1058 }
1059 else
1060 {
1061 if(tr->saveMemorycxx . . $ $anonymous_type_5cae24b3841b71ea_10#saveMemory.)
1062 sumGAMMA_GAPPED_SAVEcxx . . $ sumGAMMA_GAPPED_SAVE(c21ac5ae73f5a996).(tipCase, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->sumBuffercxx . . $ $anonymous_type_5cae24b3841b71ea_7#sumBuffer., x1_start, x2_start, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->tipVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#tipVector., tipX1, tipX2,
1063 width, x1_gapColumn, x2_gapColumn, x1_gap, x2_gap);
1064 else
1065 sumGAMMAcxx . . $ sumGAMMA(5111b26dbc8fb27).(tipCase, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->sumBuffercxx . . $ $anonymous_type_5cae24b3841b71ea_7#sumBuffer., x1_start, x2_start, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->tipVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#tipVector., tipX1, tipX2,
1066 width);
1067 }
1068 #endif
1069 break;
1070 case 20: /* proteins */
1071 #ifdef __MIC_NATIVE
1072 assert(!tr->saveMemory);
1073 assert(tr->rateHetModel == PLL_GAMMA);
1074
1075 if(pr->partitionData[model]->protModels == PLL_LG4M || pr->partitionData[model]->protModels == PLL_LG4X)
1076 sumGTRGAMMAPROT_LG4_MIC(tipCase, pr->partitionData[model]->sumBuffer, x1_start, x2_start, pr->partitionData[model]->tipVector_LG4, tipX1, tipX2,
1077 width);
1078 else
1079 sumGTRGAMMAPROT_MIC(tipCase, pr->partitionData[model]->sumBuffer, x1_start, x2_start, pr->partitionData[model]->tipVector, tipX1, tipX2,
1080 width);
1081 #else
1082
1083 if(tr->rateHetModelcxx . . $ $anonymous_type_5cae24b3841b71ea_10#rateHetModel. == PLL_CATcxx . . $ `pll/pll.h:291:9`!)
1084 {
1085 if(tr->saveMemorycxx . . $ $anonymous_type_5cae24b3841b71ea_10#saveMemory.)
1086 sumGTRCATPROT_SAVEcxx . . $ sumGTRCATPROT_SAVE(c21ac5ae73f5a996).(tipCase, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->sumBuffercxx . . $ $anonymous_type_5cae24b3841b71ea_7#sumBuffer., x1_start, x2_start, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->tipVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#tipVector.,
1087 tipX1, tipX2, width, x1_gapColumn, x2_gapColumn, x1_gap, x2_gap);
1088 else
1089 sumGTRCATPROTcxx . . $ sumGTRCATPROT(5111b26dbc8fb27).(tipCase, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->sumBuffercxx . . $ $anonymous_type_5cae24b3841b71ea_7#sumBuffer., x1_start, x2_start, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->tipVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#tipVector.,
1090 tipX1, tipX2, width);
1091 }
1092 else
1093 {
1094
1095 if(tr->saveMemorycxx . . $ $anonymous_type_5cae24b3841b71ea_10#saveMemory.)
1096 sumGAMMAPROT_GAPPED_SAVEcxx . . $ sumGAMMAPROT_GAPPED_SAVE(c21ac5ae73f5a996).(tipCase, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->sumBuffercxx . . $ $anonymous_type_5cae24b3841b71ea_7#sumBuffer., x1_start, x2_start, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->tipVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#tipVector., tipX1, tipX2,
1097 width, x1_gapColumn, x2_gapColumn, x1_gap, x2_gap);
1098 else
1099 {
1100 if(pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->protModelscxx . . $ $anonymous_type_5cae24b3841b71ea_7#protModels. == PLL_LG4Mcxx . . $ `pll/pll.h:229:9`! || pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->protModelscxx . . $ $anonymous_type_5cae24b3841b71ea_7#protModels. == PLL_LG4Xcxx . . $ `pll/pll.h:230:9`!)
1101 sumGAMMAPROT_LG4cxx . . $ sumGAMMAPROT_LG4(101081f4e3ed5496).(tipCase, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->sumBuffercxx . . $ $anonymous_type_5cae24b3841b71ea_7#sumBuffer., x1_start, x2_start, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->tipVector_LG4cxx . . $ $anonymous_type_5cae24b3841b71ea_7#tipVector_LG4.,
1102 tipX1, tipX2, width);
1103 else
1104 sumGAMMAPROTcxx . . $ sumGAMMAPROT(5111b26dbc8fb27).(tipCase, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->sumBuffercxx . . $ $anonymous_type_5cae24b3841b71ea_7#sumBuffer., x1_start, x2_start, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->tipVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#tipVector.,
1105 tipX1, tipX2, width);
1106 }
1107 }
1108 #endif
1109 break;
1110 default:
1111 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0);
1112 }
1113 #endif
1114 #if (defined(_FINE_GRAIN_MPI) || defined(_USE_PTHREADScxx . . $ `<built-in>:420:9`!))
1115 if (pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascBiascxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascBias. && tr->threadIDcxx . . $ $anonymous_type_5cae24b3841b71ea_10#threadID. == 0)
1116 #else
1117 if (pr->partitionData[model]->ascBias)
1118 #endif
1119 {
1120 int pNumber = tr->tdcxx . . $ $anonymous_type_5cae24b3841b71ea_10#td.[0].ticxx . . $ $anonymous_type_5cae24b3841b71ea_3#ti.[0].pNumbercxx . . $ $anonymous_type_5cae24b3841b71ea_2#pNumber., qNumber =
1121 tr->tdcxx . . $ $anonymous_type_5cae24b3841b71ea_10#td.[0].ticxx . . $ $anonymous_type_5cae24b3841b71ea_3#ti.[0].qNumbercxx . . $ $anonymous_type_5cae24b3841b71ea_2#qNumber., i, *ex1_asc =
1122 &pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascExpVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascExpVector.[(pNumber
1123 - tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips. - 1) * states], *ex2_asc =
1124 &pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascExpVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascExpVector.[(qNumber
1125 - tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips. - 1) * states];
1126 switch (tipCase)
1127 {
1128 case PLL_TIP_TIPcxx . . $ `pll/pll.h:244:9`!:
1129 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0);
1130 break;
1131 case PLL_TIP_INNERcxx . . $ `pll/pll.h:245:9`!:
1132 if (isTipcxx . . $ isTip(9b79fb6aee4c0440).(pNumber, tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips.))
1133 {
1134 for (i = 0; i < states; i++)
1135 pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascScalercxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascScaler.[i] = pow(
1136 PLL_MINLIKELIHOODcxx . . $ `pll/pll.h:125:9`!, (double) ex2_asc[i]);
1137 }
1138 else
1139 {
1140 for (i = 0; i < states; i++)
1141 pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascScalercxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascScaler.[i] = pow(
1142 PLL_MINLIKELIHOODcxx . . $ `pll/pll.h:125:9`!, (double) ex1_asc[i]);
1143 }
1144 break;
1145 case PLL_INNER_INNERcxx . . $ `pll/pll.h:246:9`!:
1146 for (i = 0; i < states; i++)
1147 pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascScalercxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascScaler.[i] = pow(
1148 PLL_MINLIKELIHOODcxx . . $ `pll/pll.h:125:9`!,
1149 (double) (ex1_asc[i] + ex2_asc[i]));
1150 break;
1151 default:
1152 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0);
1153 }
1154 if (tr->rateHetModelcxx . . $ $anonymous_type_5cae24b3841b71ea_10#rateHetModel. == PLL_CATcxx . . $ `pll/pll.h:291:9`!)
1155 sumCatAsccxx . . $ sumCatAsc(2435bd35d946ee68). (tipCase, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascSumBuffercxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascSumBuffer., x1_start_asc, x2_start_asc, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->tipVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#tipVector., states, states);
1156 else
1157 sumGammaAsccxx . . $ sumGammaAsc(2435bd35d946ee68).(tipCase, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascSumBuffercxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascSumBuffer., x1_start_asc, x2_start_asc, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->tipVectorcxx . . $ $anonymous_type_5cae24b3841b71ea_7#tipVector., states, states);
1158 }
1159 }
1160 }
1161 }
1162
1163
1164 /** @brief Compute first and second derivatives of the likelihood with respect to a given branch length
1165 *
1166 * @param tr
1167 * library instance
1168 *
1169 * @param _dlnLdlz
1170 * First derivative dl/dlz
1171 *
1172 * @param _d2lnLdlz2
1173 * Second derivative d(dl/dlz)/dlz
1174 *
1175 * @warning \a makenewzIterative should have been called to precompute \a tr->partitionData[model].sumBuffer at the given branch
1176 *
1177 * @note this function actually computes the first and second derivatives of the likelihood for a given branch stored in tr->coreLZ[model] Note that in the parallel case coreLZ must always be broadcasted together with the traversal descriptor, at least for optimizing branch lengths
1178 *
1179 */
1180 void execCorecxx . . $ execCore(7fe971d31cb933b2).(pllInstancecxx . . $ pllInstance# *tr, partitionListcxx . . $ partitionList# *pr, volatile double *_dlnLdlz, volatile double *_d2lnLdlz2)
1181 {
1182 int model, branchIndex;
1183 int numBranches = pr->perGeneBranchLengthscxx . . $ $anonymous_type_5cae24b3841b71ea_8#perGeneBranchLengths.?pr->numberOfPartitionscxx . . $ $anonymous_type_5cae24b3841b71ea_8#numberOfPartitions.:1;
1184
1185 double lz;
1186
1187 _dlnLdlz[0] = 0.0;
1188 _d2lnLdlz2[0] = 0.0;
1189
1190 /* loop over partitions */
1191
1192 for(model = 0; model < pr->numberOfPartitionscxx . . $ $anonymous_type_5cae24b3841b71ea_8#numberOfPartitions.; model++)
1193 {
1194 int
1195 width = pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->widthcxx . . $ $anonymous_type_5cae24b3841b71ea_7#width.;
1196
1197 /* check if we (the present thread for instance) needs to compute something at
1198 all for the present partition */
1199
1200 if(tr->tdcxx . . $ $anonymous_type_5cae24b3841b71ea_10#td.[0].executeModelcxx . . $ $anonymous_type_5cae24b3841b71ea_3#executeModel.[model] && width > 0)
1201 {
1202 int
1203 states = pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->statescxx . . $ $anonymous_type_5cae24b3841b71ea_7#states.;
1204
1205 double
1206 *sumBuffer = (double*)NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1207
1208
1209 volatile double
1210 dlnLdlz = 0.0,
1211 d2lnLdlz2 = 0.0;
1212
1213 /* set a pointer to the part of the pre-computed sumBuffer we are going to access */
1214
1215 sumBuffer = pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->sumBuffercxx . . $ $anonymous_type_5cae24b3841b71ea_7#sumBuffer.;
1216
1217 /* figure out if we are optimizing branch lengths individually per partition or jointly across
1218 all partitions. If we do this on a per partition basis, we also need to compute and store
1219 the per-partition derivatives of the likelihood separately, otherwise not */
1220
1221 if(numBranches > 1)
1222 {
1223 branchIndex = model;
1224 lz = tr->tdcxx . . $ $anonymous_type_5cae24b3841b71ea_10#td.[0].parameterValuescxx . . $ $anonymous_type_5cae24b3841b71ea_3#parameterValues.[model];
1225 _dlnLdlz[model] = 0.0;
1226 _d2lnLdlz2[model] = 0.0;
1227 }
1228 else
1229 {
1230 branchIndex = 0;
1231 lz = tr->tdcxx . . $ $anonymous_type_5cae24b3841b71ea_10#td.[0].parameterValuescxx . . $ $anonymous_type_5cae24b3841b71ea_3#parameterValues.[0];
1232 }
1233
1234 #if (!defined(__SSE3cxx . . $ `<built-in>:421:9`!) && !defined(__AVX) && !defined(__MIC_NATIVE))
1235 /* compute first and second derivatives with the slow generic functions */
1236
1237 if(tr->rateHetModel == PLL_CAT)
1238 coreCAT_FLEX(width, pr->partitionData[model]->numberOfCategories, sumBuffer,
1239 &dlnLdlz, &d2lnLdlz2, pr->partitionData[model]->wgt,
1240 pr->partitionData[model]->perSiteRates, pr->partitionData[model]->EIGN, pr->partitionData[model]->rateCategory, lz, states);
1241 else
1242 coreGAMMA_FLEX(width, sumBuffer,
1243 &dlnLdlz, &d2lnLdlz2, pr->partitionData[model]->EIGN, pr->partitionData[model]->gammaRates, lz,
1244 pr->partitionData[model]->wgt, states);
1245 #else
1246 switch(states)
1247 {
1248 case 2: /* BINARY */
1249 if (tr->rateHetModelcxx . . $ $anonymous_type_5cae24b3841b71ea_10#rateHetModel. == PLL_CATcxx . . $ `pll/pll.h:291:9`!)
1250 coreGTRCAT_BINARYcxx . . $ coreGTRCAT_BINARY(25aa5d1ffb96ce3c).(width,
1251 pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->numberOfCategoriescxx . . $ $anonymous_type_5cae24b3841b71ea_7#numberOfCategories.,
1252 sumBuffer,
1253 &dlnLdlz,
1254 &d2lnLdlz2,
1255 pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->perSiteRatescxx . . $ $anonymous_type_5cae24b3841b71ea_7#perSiteRates.,
1256 pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->EIGNcxx . . $ $anonymous_type_5cae24b3841b71ea_7#EIGN.,
1257 pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->rateCategorycxx . . $ $anonymous_type_5cae24b3841b71ea_7#rateCategory.,
1258 lz,
1259 pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->wgtcxx . . $ $anonymous_type_5cae24b3841b71ea_7#wgt.);
1260 else
1261 coreGTRGAMMA_BINARYcxx . . $ coreGTRGAMMA_BINARY(c0a820a3f2225259).(width,
1262 sumBuffer,
1263 &dlnLdlz,
1264 &d2lnLdlz2,
1265 pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->EIGNcxx . . $ $anonymous_type_5cae24b3841b71ea_7#EIGN.,
1266 pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->gammaRatescxx . . $ $anonymous_type_5cae24b3841b71ea_7#gammaRates.,
1267 lz,
1268 pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->wgtcxx . . $ $anonymous_type_5cae24b3841b71ea_7#wgt.);
1269 break;
1270 case 4: /* DNA */
1271 #ifdef __MIC_NATIVE
1272 assert(tr->rateHetModel == PLL_GAMMA);
1273
1274 coreGTRGAMMA_MIC(width,
1275 sumBuffer,
1276 &dlnLdlz,
1277 &d2lnLdlz2,
1278 pr->partitionData[model]->EIGN,
1279 pr->partitionData[model]->gammaRates,
1280 lz,
1281 pr->partitionData[model]->wgt);
1282 #else
1283 if(tr->rateHetModelcxx . . $ $anonymous_type_5cae24b3841b71ea_10#rateHetModel. == PLL_CATcxx . . $ `pll/pll.h:291:9`!)
1284 coreGTRCATcxx . . $ coreGTRCAT(ce8aafcb1e86b883).(width, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->numberOfCategoriescxx . . $ $anonymous_type_5cae24b3841b71ea_7#numberOfCategories., sumBuffer,
1285 &dlnLdlz, &d2lnLdlz2, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->wgtcxx . . $ $anonymous_type_5cae24b3841b71ea_7#wgt.,
1286 pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->perSiteRatescxx . . $ $anonymous_type_5cae24b3841b71ea_7#perSiteRates., pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->EIGNcxx . . $ $anonymous_type_5cae24b3841b71ea_7#EIGN., pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->rateCategorycxx . . $ $anonymous_type_5cae24b3841b71ea_7#rateCategory., lz);
1287 else
1288 coreGTRGAMMAcxx . . $ coreGTRGAMMA(c0a820a3f2225259).(width, sumBuffer,
1289 &dlnLdlz, &d2lnLdlz2, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->EIGNcxx . . $ $anonymous_type_5cae24b3841b71ea_7#EIGN., pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->gammaRatescxx . . $ $anonymous_type_5cae24b3841b71ea_7#gammaRates., lz,
1290 pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->wgtcxx . . $ $anonymous_type_5cae24b3841b71ea_7#wgt.);
1291
1292 #endif
1293 break;
1294 case 20: /* proteins */
1295
1296 #ifdef __MIC_NATIVE
1297 assert(tr->rateHetModel == PLL_GAMMA);
1298
1299 if(pr->partitionData[model]->protModels == PLL_LG4M || pr->partitionData[model]->protModels == PLL_LG4X)
1300 coreGTRGAMMAPROT_LG4_MIC(width, sumBuffer,
1301 &dlnLdlz, &d2lnLdlz2, pr->partitionData[model]->EIGN_LG4, pr->partitionData[model]->gammaRates, lz,
1302 pr->partitionData[model]->wgt, pr->partitionData[model]->lg4x_weights);
1303 else
1304 coreGTRGAMMAPROT_MIC(width, sumBuffer,
1305 &dlnLdlz, &d2lnLdlz2, pr->partitionData[model]->EIGN, pr->partitionData[model]->gammaRates, lz,
1306 pr->partitionData[model]->wgt);
1307 #else
1308
1309 if(tr->rateHetModelcxx . . $ $anonymous_type_5cae24b3841b71ea_10#rateHetModel. == PLL_CATcxx . . $ `pll/pll.h:291:9`!)
1310 coreGTRCATPROTcxx . . $ coreGTRCATPROT(7a64fe835b18a73f).(pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->EIGNcxx . . $ $anonymous_type_5cae24b3841b71ea_7#EIGN., lz, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->numberOfCategoriescxx . . $ $anonymous_type_5cae24b3841b71ea_7#numberOfCategories., pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->perSiteRatescxx . . $ $anonymous_type_5cae24b3841b71ea_7#perSiteRates.,
1311 pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->rateCategorycxx . . $ $anonymous_type_5cae24b3841b71ea_7#rateCategory., width,
1312 pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->wgtcxx . . $ $anonymous_type_5cae24b3841b71ea_7#wgt.,
1313 &dlnLdlz, &d2lnLdlz2,
1314 sumBuffer);
1315 else
1316 {
1317 if(pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->protModelscxx . . $ $anonymous_type_5cae24b3841b71ea_7#protModels. == PLL_LG4Mcxx . . $ `pll/pll.h:229:9`! || pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->protModelscxx . . $ $anonymous_type_5cae24b3841b71ea_7#protModels. == PLL_LG4Xcxx . . $ `pll/pll.h:230:9`!)
1318 coreGTRGAMMAPROT_LG4cxx . . $ coreGTRGAMMAPROT_LG4(b7457016642a760a).(pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->gammaRatescxx . . $ $anonymous_type_5cae24b3841b71ea_7#gammaRates., pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->EIGN_LG4cxx . . $ $anonymous_type_5cae24b3841b71ea_7#EIGN_LG4.,
1319 sumBuffer, width, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->wgtcxx . . $ $anonymous_type_5cae24b3841b71ea_7#wgt.,
1320 &dlnLdlz, &d2lnLdlz2, lz, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->lg4x_weightscxx . . $ $anonymous_type_5cae24b3841b71ea_7#lg4x_weights.);
1321 else
1322
1323 coreGTRGAMMAPROTcxx . . $ coreGTRGAMMAPROT(51b4f202b4cc753d).(pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->gammaRatescxx . . $ $anonymous_type_5cae24b3841b71ea_7#gammaRates., pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->EIGNcxx . . $ $anonymous_type_5cae24b3841b71ea_7#EIGN.,
1324 sumBuffer, width, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->wgtcxx . . $ $anonymous_type_5cae24b3841b71ea_7#wgt.,
1325 &dlnLdlz, &d2lnLdlz2, lz);
1326
1327 }
1328 #endif
1329 break;
1330 default:
1331 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0);
1332 }
1333 #endif
1334
1335 /* store first and second derivative */
1336 #if (defined(_FINE_GRAIN_MPI) || defined(_USE_PTHREADScxx . . $ `<built-in>:420:9`!))
1337 if(pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascBiascxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascBias. && tr->threadIDcxx . . $ $anonymous_type_5cae24b3841b71ea_10#threadID. == 0)
1338 #else
1339 if(pr->partitionData[model]->ascBias)
1340 #endif
1341 {
1342 double correction = 0;
1343 int w = 0;
1344
1345 volatile double
1346 d1 = 0.0,
1347 d2 = 0.0;
1348
1349 for(size_t i = (size_t)pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->lowercxx . . $ $anonymous_type_5cae24b3841b71ea_7#lower.; i < (size_t)pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->uppercxx . . $ $anonymous_type_5cae24b3841b71ea_7#upper.; i++)
1350 w += tr->aliaswgtcxx . . $ $anonymous_type_5cae24b3841b71ea_10#aliaswgt.[i];
1351
1352 switch(tr->rateHetModelcxx . . $ $anonymous_type_5cae24b3841b71ea_10#rateHetModel.)
1353 {
1354 case PLL_CATcxx . . $ `pll/pll.h:291:9`!:
1355 correction = coreCatAsccxx . . $ coreCatAsc(35538ba82643c0cf).(pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->EIGNcxx . . $ $anonymous_type_5cae24b3841b71ea_7#EIGN., pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascSumBuffercxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascSumBuffer., states,
1356 &d1, &d2, lz, states, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascScalercxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascScaler.);
1357 break;
1358 case PLL_GAMMAcxx . . $ `pll/pll.h:292:9`!:
1359 correction = coreGammaAsccxx . . $ coreGammaAsc(f76c7caf2958752).(pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->gammaRatescxx . . $ $anonymous_type_5cae24b3841b71ea_7#gammaRates., pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->EIGNcxx . . $ $anonymous_type_5cae24b3841b71ea_7#EIGN., pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascSumBuffercxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascSumBuffer., states,
1360 &d1, &d2, lz, states, pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->ascScalercxx . . $ $anonymous_type_5cae24b3841b71ea_7#ascScaler.);
1361 break;
1362 default:
1363 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0);
1364 }
1365 correction = 1.0 - correction; //Never used!
1366
1367 /* Lewis correction */
1368 _dlnLdlz[branchIndex] = _dlnLdlz[branchIndex] + dlnLdlz - (double)w * d1;
1369 _d2lnLdlz2[branchIndex] = _d2lnLdlz2[branchIndex] + d2lnLdlz2- (double)w * d2;
1370 }
1371 else
1372 {
1373 _dlnLdlz[branchIndex] = _dlnLdlz[branchIndex] + dlnLdlz;
1374 _d2lnLdlz2[branchIndex] = _d2lnLdlz2[branchIndex] + d2lnLdlz2;
1375 }
1376 }
1377 else if(width == 0 && (numBranches > 1)) {
1378 /* set to 0 to make the reduction operation consistent */
1379 _dlnLdlz[model] = 0.0;
1380 _d2lnLdlz2[model] = 0.0;
1381 }
1382 }
1383 }
1384
1385
1386 /* the function below actually implements the iterative Newton-Raphson procedure.
1387 It is particularly messy and hard to read because for the case of per-partition branch length
1388 estimates it needs to keep track of whetehr the Newton Raphson procedure has
1389 converged for each partition individually.
1390
1391 The rational efor doing it like this is also provided in:
1392
1393
1394 A. Stamatakis, M. Ott: "Load Balance in the Phylogenetic Likelihood Kernel". Proceedings of ICPP 2009,
1395
1396 */
1397
1398 static void topLevelMakenewzcxx . . $ topLevelMakenewz(b0667b4757c33fe2).(pllInstancecxx . . $ pllInstance# *tr, partitionListcxx . . $ partitionList# * pr, double *z0, int _maxiter, double *result)
1399 {
1400 double z[PLL_NUM_BRANCHEScxx . . $ `pll/pll.h:138:9`!], zprev[PLL_NUM_BRANCHEScxx . . $ `pll/pll.h:138:9`!], zstep[PLL_NUM_BRANCHEScxx . . $ `pll/pll.h:138:9`!];
1401 volatile double dlnLdlz[PLL_NUM_BRANCHEScxx . . $ `pll/pll.h:138:9`!], d2lnLdlz2[PLL_NUM_BRANCHEScxx . . $ `pll/pll.h:138:9`!];
1402 int i, maxiter[PLL_NUM_BRANCHEScxx . . $ `pll/pll.h:138:9`!], model;
1403 int numBranches = pr->perGeneBranchLengthscxx . . $ $anonymous_type_5cae24b3841b71ea_8#perGeneBranchLengths.?pr->numberOfPartitionscxx . . $ $anonymous_type_5cae24b3841b71ea_8#numberOfPartitions.:1;
1404 pllBooleancxx . . $ pllBoolean# firstIteration = PLL_TRUEcxx . . $ `pll/pll.h:140:9`!;
1405 pllBooleancxx . . $ pllBoolean# outerConverged[PLL_NUM_BRANCHEScxx . . $ `pll/pll.h:138:9`!];
1406 pllBooleancxx . . $ pllBoolean# loopConverged;
1407
1408
1409 /* figure out if this is on a per partition basis or jointly across all partitions */
1410
1411
1412
1413 /* initialize loop convergence variables etc.
1414 maxiter is the maximum number of NR iterations we are going to do before giving up */
1415
1416 for(i = 0; i < numBranches; i++)
1417 {
1418 z[i] = z0[i];
1419 maxiter[i] = _maxiter;
1420 outerConverged[i] = PLL_FALSEcxx . . $ `pll/pll.h:141:9`!;
1421 tr->curvatOKcxx . . $ $anonymous_type_5cae24b3841b71ea_10#curvatOK.[i] = PLL_TRUEcxx . . $ `pll/pll.h:140:9`!;
1422 }
1423
1424
1425 /* nested do while loops of Newton-Raphson */
1426
1427 do
1428 {
1429
1430 /* check if we ar done for partition i or if we need to adapt the branch length again */
1431
1432 for(i = 0; i < numBranches; i++)
1433 {
1434 if(outerConverged[i] == PLL_FALSEcxx . . $ `pll/pll.h:141:9`! && tr->curvatOKcxx . . $ $anonymous_type_5cae24b3841b71ea_10#curvatOK.[i] == PLL_TRUEcxx . . $ `pll/pll.h:140:9`!)
1435 {
1436 tr->curvatOKcxx . . $ $anonymous_type_5cae24b3841b71ea_10#curvatOK.[i] = PLL_FALSEcxx . . $ `pll/pll.h:141:9`!;
1437
1438 zprev[i] = z[i];
1439
1440 zstep[i] = (1.0 - PLL_ZMAXcxx . . $ `pll/pll.h:123:9`!) * z[i] + PLL_ZMINcxx . . $ `pll/pll.h:122:9`!;
1441 }
1442 }
1443
1444 for(i = 0; i < numBranches; i++)
1445 {
1446 /* other case, the outer loop hasn't converged but we are trying to approach
1447 the maximum from the wrong side */
1448
1449 if(outerConverged[i] == PLL_FALSEcxx . . $ `pll/pll.h:141:9`! && tr->curvatOKcxx . . $ $anonymous_type_5cae24b3841b71ea_10#curvatOK.[i] == PLL_FALSEcxx . . $ `pll/pll.h:141:9`!)
1450 {
1451 double lz;
1452
1453 if (z[i] < PLL_ZMINcxx . . $ `pll/pll.h:122:9`!) z[i] = PLL_ZMINcxx . . $ `pll/pll.h:122:9`!;
1454 else if (z[i] > PLL_ZMAXcxx . . $ `pll/pll.h:123:9`!) z[i] = PLL_ZMAXcxx . . $ `pll/pll.h:123:9`!;
1455 lz = log(z[i]);
1456
1457 tr->coreLZcxx . . $ $anonymous_type_5cae24b3841b71ea_10#coreLZ.[i] = lz;
1458 }
1459 }
1460
1461
1462 /* set the execution mask */
1463
1464 if(numBranches > 1)
1465 {
1466 for(model = 0; model < pr->numberOfPartitionscxx . . $ $anonymous_type_5cae24b3841b71ea_8#numberOfPartitions.; model++)
1467 {
1468 if(pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->executeModelcxx . . $ $anonymous_type_5cae24b3841b71ea_7#executeModel.)
1469 pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->executeModelcxx . . $ $anonymous_type_5cae24b3841b71ea_7#executeModel. = !tr->curvatOKcxx . . $ $anonymous_type_5cae24b3841b71ea_10#curvatOK.[model];
1470
1471 }
1472 }
1473 else
1474 {
1475 for(model = 0; model < pr->numberOfPartitionscxx . . $ $anonymous_type_5cae24b3841b71ea_8#numberOfPartitions.; model++)
1476 pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->executeModelcxx . . $ $anonymous_type_5cae24b3841b71ea_7#executeModel. = !tr->curvatOKcxx . . $ $anonymous_type_5cae24b3841b71ea_10#curvatOK.[0];
1477 }
1478
1479
1480 /* store it in traversal descriptor */
1481
1482 storeExecuteMaskInTraversalDescriptorcxx . . $ storeExecuteMaskInTraversalDescriptor(cd932907150aaa55).(tr, pr);
1483
1484 /* store the new branch length values to be tested in traversal descriptor */
1485
1486 storeValuesInTraversalDescriptorcxx . . $ storeValuesInTraversalDescriptor(639ca598df518eb2).(tr, pr, &(tr->coreLZcxx . . $ $anonymous_type_5cae24b3841b71ea_10#coreLZ.[0]));
1487
1488 #if (defined(_FINE_GRAIN_MPI) || defined(_USE_PTHREADScxx . . $ `<built-in>:420:9`!))
1489
1490 /* if this is the first iteration of NR we will need to first do this one-time call
1491 of maknewzIterative() Note that, only this call requires broadcasting the traversal descriptor,
1492 subsequent calls to pllMasterBarrier(PLL_THREAD_MAKENEWZ, tr); will not require this
1493 */
1494
1495 if(firstIteration)
1496 {
1497 tr->tdcxx . . $ $anonymous_type_5cae24b3841b71ea_10#td.[0].traversalHasChangedcxx . . $ $anonymous_type_5cae24b3841b71ea_3#traversalHasChanged. = PLL_TRUEcxx . . $ `pll/pll.h:140:9`!;
1498 pllMasterBarriercxx . . $ pllMasterBarrier(d7242fe58f893e85). (tr, pr, PLL_THREAD_MAKENEWZ_FIRSTcxx . . $ `pll/pllInternal.h:208:9`!);
1499 firstIteration = PLL_FALSEcxx . . $ `pll/pll.h:141:9`!;
1500 tr->tdcxx . . $ $anonymous_type_5cae24b3841b71ea_10#td.[0].traversalHasChangedcxx . . $ $anonymous_type_5cae24b3841b71ea_3#traversalHasChanged. = PLL_FALSEcxx . . $ `pll/pll.h:141:9`!;
1501 }
1502 else
1503 pllMasterBarriercxx . . $ pllMasterBarrier(d7242fe58f893e85).(tr, pr, PLL_THREAD_MAKENEWZcxx . . $ `pll/pllInternal.h:207:9`!);
1504 branchLength_parallelReducecxx . . $ branchLength_parallelReduce(3ee9120fb64e3575).(tr, (double*)dlnLdlz, (double*)d2lnLdlz2, numBranches);
1505 #else
1506 /* sequential part, if this is the first newton-raphson implementation,
1507 do the precomputations as well, otherwise just execute the computation
1508 of the derivatives */
1509 if(firstIteration)
1510 {
1511 makenewzIterative(tr, pr);
1512 firstIteration = PLL_FALSE;
1513 }
1514 execCore(tr, pr, dlnLdlz, d2lnLdlz2);
1515 #endif
1516
1517 /* do a NR step, if we are on the correct side of the maximum that's okay, otherwise
1518 shorten branch */
1519
1520 for(i = 0; i < numBranches; i++)
1521 {
1522 if(outerConverged[i] == PLL_FALSEcxx . . $ `pll/pll.h:141:9`! && tr->curvatOKcxx . . $ $anonymous_type_5cae24b3841b71ea_10#curvatOK.[i] == PLL_FALSEcxx . . $ `pll/pll.h:141:9`!)
1523 {
1524 if ((d2lnLdlz2[i] >= 0.0) && (z[i] < PLL_ZMAXcxx . . $ `pll/pll.h:123:9`!))
1525 zprev[i] = z[i] = 0.37 * z[i] + 0.63; /* Bad curvature, shorten branch */
1526 else
1527 tr->curvatOKcxx . . $ $anonymous_type_5cae24b3841b71ea_10#curvatOK.[i] = PLL_TRUEcxx . . $ `pll/pll.h:140:9`!;
1528 }
1529 }
1530
1531 /* do the standard NR step to obrain the next value, depending on the state for eahc partition */
1532
1533 for(i = 0; i < numBranches; i++)
1534 {
1535 if(tr->curvatOKcxx . . $ $anonymous_type_5cae24b3841b71ea_10#curvatOK.[i] == PLL_TRUEcxx . . $ `pll/pll.h:140:9`! && outerConverged[i] == PLL_FALSEcxx . . $ `pll/pll.h:141:9`!)
1536 {
1537 if (d2lnLdlz2[i] < 0.0)
1538 {
1539 double tantmp = -dlnLdlz[i] / d2lnLdlz2[i];
1540 if (tantmp < 100)
1541 {
1542 z[i] *= exp(tantmp);
1543 if (z[i] < PLL_ZMINcxx . . $ `pll/pll.h:122:9`!)
1544 z[i] = PLL_ZMINcxx . . $ `pll/pll.h:122:9`!;
1545
1546 if (z[i] > 0.25 * zprev[i] + 0.75)
1547 z[i] = 0.25 * zprev[i] + 0.75;
1548 }
1549 else
1550 z[i] = 0.25 * zprev[i] + 0.75;
1551 }
1552 if (z[i] > PLL_ZMAXcxx . . $ `pll/pll.h:123:9`!) z[i] = PLL_ZMAXcxx . . $ `pll/pll.h:123:9`!;
1553
1554 /* decrement the maximum number of itarations */
1555
1556 maxiter[i] = maxiter[i] - 1;
1557
1558 /* check if the outer loop has converged */
1559
1560 //old code below commented out, integrated new PRELIMINARY BUG FIX !
1561 //this needs further work at some point!
1562
1563 /*
1564 if(maxiter[i] > 0 && (PLL_ABS(z[i] - zprev[i]) > zstep[i]))
1565 outerConverged[i] = PLL_FALSE;
1566 else
1567 outerConverged[i] = PLL_TRUE;
1568 */
1569
1570 if((PLL_ABScxx . . $ `pll/pll.h:196:9`!(z[i] - zprev[i]) > zstep[i]))
1571 {
1572 /* We should make a more informed decision here,
1573 based on the log like improvement */
1574
1575 if(maxiter[i] < -20)
1576 {
1577 z[i] = z0[i];
1578 outerConverged[i] = PLL_TRUEcxx . . $ `pll/pll.h:140:9`!;
1579 }
1580 else
1581 outerConverged[i] = PLL_FALSEcxx . . $ `pll/pll.h:141:9`!;
1582 }
1583 else
1584 outerConverged[i] = PLL_TRUEcxx . . $ `pll/pll.h:140:9`!;
1585 }
1586 }
1587
1588 /* check if the loop has converged for all partitions */
1589
1590 loopConverged = PLL_TRUEcxx . . $ `pll/pll.h:140:9`!;
1591 for(i = 0; i < numBranches; i++)
1592 loopConverged = loopConverged && outerConverged[i];
1593 }
1594 while (!loopConverged);
1595
1596
1597 /* reset partition execution mask */
1598
1599 for(model = 0; model < pr->numberOfPartitionscxx . . $ $anonymous_type_5cae24b3841b71ea_8#numberOfPartitions.; model++)
1600 pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[model]->executeModelcxx . . $ $anonymous_type_5cae24b3841b71ea_7#executeModel. = PLL_TRUEcxx . . $ `pll/pll.h:140:9`!;
1601
1602 /* copy the new branches in the result array of branches.
1603 if we don't do a per partition estimate of
1604 branches this will only set result[0]
1605 */
1606
1607 for(i = 0; i < numBranches; i++)
1608 result[i] = z[i];
1609 }
1610
1611
1612 /** @brief Optimize branch length value(s) of a given branch with the Newton-Raphtson procedure
1613 *
1614 * @warning A given branch may have one or several branch length values (up to PLL_NUM_BRANCHES), usually the later refers to partition-specific branch length values. Thus z0 and result represent collections rather than double values. The number of branch length values is given by \a tr->numBranches
1615 *
1616 * @param tr
1617 * Library instance
1618 *
1619 * @param p
1620 * One node that defines the branch (p->z)
1621 *
1622 * @param q
1623 * The other node side of the branch (usually p->back), but the branch length can be estimated even if p and q are
1624 * not connected, e.g. before the insertion of a subtree.
1625 *
1626 * @param z0
1627 * Initial branch length value(s) for the given branch \a p->z
1628 *
1629 * @param maxiter
1630 * Maximum number of iterations in the Newton-Raphson procedure
1631 *
1632 * @param result
1633 * Resulting branch length value(s) for the given branch \a p->z
1634 *
1635 * @param mask
1636 * Specifies if a mask to track partition convergence (\a tr->partitionConverged) is being used.
1637 *
1638 * @sa typical values for \a maxiter are constants \a iterations and \a PLL_NEWZPERCYCLE
1639 * @note Requirement: q->z == p->z
1640 */
1641 void makenewzGenericcxx . . $ makenewzGeneric(5b14bea6e469b1b).(pllInstancecxx . . $ pllInstance# *tr, partitionListcxx . . $ partitionList# * pr, nodeptrcxx . . $ nodeptr# p, nodeptrcxx . . $ nodeptr# q, double *z0, int maxiter, double *result, pllBooleancxx . . $ pllBoolean# mask)
1642 {
1643 int i;
1644 //boolean originalExecute[PLL_NUM_BRANCHES];
1645 int numBranches = pr->perGeneBranchLengthscxx . . $ $anonymous_type_5cae24b3841b71ea_8#perGeneBranchLengths.?pr->numberOfPartitionscxx . . $ $anonymous_type_5cae24b3841b71ea_8#numberOfPartitions.:1;
1646
1647 pllBooleancxx . . $ pllBoolean#
1648 p_recom = PLL_FALSEcxx . . $ `pll/pll.h:141:9`!, /* if one of was missing, we will need to force recomputation */
1649 q_recom = PLL_FALSEcxx . . $ `pll/pll.h:141:9`!;
1650
1651 /* the first entry of the traversal descriptor stores the node pair that defines
1652 the branch */
1653
1654 tr->tdcxx . . $ $anonymous_type_5cae24b3841b71ea_10#td.[0].ticxx . . $ $anonymous_type_5cae24b3841b71ea_3#ti.[0].pNumbercxx . . $ $anonymous_type_5cae24b3841b71ea_2#pNumber. = p->numbercxx . . $ noderec#number.;
1655 tr->tdcxx . . $ $anonymous_type_5cae24b3841b71ea_10#td.[0].ticxx . . $ $anonymous_type_5cae24b3841b71ea_3#ti.[0].qNumbercxx . . $ $anonymous_type_5cae24b3841b71ea_2#qNumber. = q->numbercxx . . $ noderec#number.;
1656
1657 for(i = 0; i < numBranches; i++)
1658 {
1659 //originalExecute[i] = pr->partitionData[i]->executeModel;
1660 tr->tdcxx . . $ $anonymous_type_5cae24b3841b71ea_10#td.[0].ticxx . . $ $anonymous_type_5cae24b3841b71ea_3#ti.[0].qzcxx . . $ $anonymous_type_5cae24b3841b71ea_2#qz.[i] = z0[i];
1661 if(mask)
1662 {
1663 if (tr->partitionConvergedcxx . . $ $anonymous_type_5cae24b3841b71ea_10#partitionConverged.[i])
1664 pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[i]->executeModelcxx . . $ $anonymous_type_5cae24b3841b71ea_7#executeModel. = PLL_FALSEcxx . . $ `pll/pll.h:141:9`!;
1665 else
1666 pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[i]->executeModelcxx . . $ $anonymous_type_5cae24b3841b71ea_7#executeModel. = PLL_TRUEcxx . . $ `pll/pll.h:140:9`!;
1667 }
1668 }
1669 if (tr->useRecomcxx . . $ $anonymous_type_5cae24b3841b71ea_10#useRecom.)
1670 {
1671 int
1672 slot = -1;
1673 //count = 0;
1674
1675 /* Ensure p and q get a unpinnable slot in physical memory */
1676 if(!isTipcxx . . $ isTip(9b79fb6aee4c0440).(q->numbercxx . . $ noderec#number., tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips.))
1677 {
1678 q_recom = getxVectorcxx . . $ getxVector(3989c81871d7fbe7).(tr->rveccxx . . $ $anonymous_type_5cae24b3841b71ea_10#rvec., q->numbercxx . . $ noderec#number., &slot, tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips.);
1679 tr->tdcxx . . $ $anonymous_type_5cae24b3841b71ea_10#td.[0].ticxx . . $ $anonymous_type_5cae24b3841b71ea_3#ti.[0].slot_qcxx . . $ $anonymous_type_5cae24b3841b71ea_2#slot_q. = slot;
1680 }
1681 if(!isTipcxx . . $ isTip(9b79fb6aee4c0440).(p->numbercxx . . $ noderec#number., tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips.))
1682 {
1683 p_recom = getxVectorcxx . . $ getxVector(3989c81871d7fbe7).(tr->rveccxx . . $ $anonymous_type_5cae24b3841b71ea_10#rvec., p->numbercxx . . $ noderec#number., &slot, tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips.);
1684 tr->tdcxx . . $ $anonymous_type_5cae24b3841b71ea_10#td.[0].ticxx . . $ $anonymous_type_5cae24b3841b71ea_3#ti.[0].slot_pcxx . . $ $anonymous_type_5cae24b3841b71ea_2#slot_p. = slot;
1685 }
1686 }
1687
1688
1689 /* compute the traversal descriptor of the likelihood vectors that need to be re-computed
1690 first in makenewzIterative */
1691
1692 tr->tdcxx . . $ $anonymous_type_5cae24b3841b71ea_10#td.[0].countcxx . . $ $anonymous_type_5cae24b3841b71ea_3#count. = 1;
1693
1694 if(p_recom || needsRecompcxx . . $ needsRecomp(42507ea98150a206).(tr->useRecomcxx . . $ $anonymous_type_5cae24b3841b71ea_10#useRecom., tr->rveccxx . . $ $anonymous_type_5cae24b3841b71ea_10#rvec., p, tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips.))
1695 computeTraversalcxx . . $ computeTraversal(ec84a0d828547d12).(tr, p, PLL_TRUEcxx . . $ `pll/pll.h:140:9`!, numBranches);
1696
1697 if(q_recom || needsRecompcxx . . $ needsRecomp(42507ea98150a206).(tr->useRecomcxx . . $ $anonymous_type_5cae24b3841b71ea_10#useRecom., tr->rveccxx . . $ $anonymous_type_5cae24b3841b71ea_10#rvec., q, tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips.))
1698 computeTraversalcxx . . $ computeTraversal(ec84a0d828547d12).(tr, q, PLL_TRUEcxx . . $ `pll/pll.h:140:9`!, numBranches);
1699
1700 /* call the Newton-Raphson procedure */
1701
1702 topLevelMakenewzcxx . . $ topLevelMakenewz(b0667b4757c33fe2).(tr, pr, z0, maxiter, result);
1703
1704 /* Mark node as unpinnable */
1705 if(tr->useRecomcxx . . $ $anonymous_type_5cae24b3841b71ea_10#useRecom.)
1706 {
1707 unpinNodecxx . . $ unpinNode(1f50ace24efbc5e0).(tr->rveccxx . . $ $anonymous_type_5cae24b3841b71ea_10#rvec., p->numbercxx . . $ noderec#number., tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips.);
1708 unpinNodecxx . . $ unpinNode(1f50ace24efbc5e0).(tr->rveccxx . . $ $anonymous_type_5cae24b3841b71ea_10#rvec., q->numbercxx . . $ noderec#number., tr->mxtipscxx . . $ $anonymous_type_5cae24b3841b71ea_10#mxtips.);
1709 }
1710
1711 /* fix eceuteModel this seems to be a bit redundant with topLevelMakenewz */
1712
1713 for(i = 0; i < numBranches; i++)
1714 pr->partitionDatacxx . . $ $anonymous_type_5cae24b3841b71ea_8#partitionData.[i]->executeModelcxx . . $ $anonymous_type_5cae24b3841b71ea_7#executeModel. = PLL_TRUEcxx . . $ `pll/pll.h:140:9`!;
1715 }
1716
1717
1718 /* below are, once again the optimized functions */
1719
1720 #if (defined(__SSE3cxx . . $ `<built-in>:421:9`!) || defined(__AVX))
1721
1722
1723 static void sumCAT_BINARYcxx . . $ sumCAT_BINARY(5111b26dbc8fb27).(int tipCase, double *sum, double *x1_start, double *x2_start, double *tipVector,
1724 unsigned char *tipX1, unsigned char *tipX2, int n)
1725
1726 {
1727 int i;
1728
1729 #if (!defined(__SSE3cxx . . $ `<built-in>:421:9`!) && !defined(__AVX))
1730 int j;
1731 #endif
1732 double *x1, *x2;
1733
1734 switch(tipCase)
1735 {
1736 case PLL_TIP_TIPcxx . . $ `pll/pll.h:244:9`!:
1737 for (i = 0; i < n; i++)
1738 {
1739 x1 = &(tipVector[2 * tipX1[i]]);
1740 x2 = &(tipVector[2 * tipX2[i]]);
1741
1742 #if (!defined(__SSE3cxx . . $ `<built-in>:421:9`!) && !defined(__AVX))
1743 for(j = 0; j < 2; j++)
1744 sum[i * 2 + j] = x1[j] * x2[j];
1745 #else
1746 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).(&sum[i * 2], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(x1), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(x2)));
1747 #endif
1748 }
1749 break;
1750 case PLL_TIP_INNERcxx . . $ `pll/pll.h:245:9`!:
1751 for (i = 0; i < n; i++)
1752 {
1753 x1 = &(tipVector[2 * tipX1[i]]);
1754 x2 = &x2_start[2 * i];
1755
1756 #if (!defined(__SSE3cxx . . $ `<built-in>:421:9`!) && !defined(__AVX))
1757 for(j = 0; j < 2; j++)
1758 sum[i * 2 + j] = x1[j] * x2[j];
1759 #else
1760 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).(&sum[i * 2], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(x1), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(x2)));
1761 #endif
1762 }
1763 break;
1764 case PLL_INNER_INNERcxx . . $ `pll/pll.h:246:9`!:
1765 for (i = 0; i < n; i++)
1766 {
1767 x1 = &x1_start[2 * i];
1768 x2 = &x2_start[2 * i];
1769 #if (!defined(__SSE3cxx . . $ `<built-in>:421:9`!) && !defined(__AVX))
1770 for(j = 0; j < 2; j++)
1771 sum[i * 2 + j] = x1[j] * x2[j];
1772 #else
1773 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).(&sum[i * 2], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(x1), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(x2)));
1774 #endif
1775 }
1776 break;
1777 default:
1778 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0);
1779 }
1780 }
1781
1782
1783 static void sumCAT_SAVEcxx . . $ sumCAT_SAVE(c21ac5ae73f5a996).(int tipCase, double *sum, double *x1_start, double *x2_start, double *tipVector,
1784 unsigned char *tipX1, unsigned char *tipX2, int n, double *x1_gapColumn, double *x2_gapColumn, unsigned int *x1_gap, unsigned int *x2_gap)
1785 {
1786 int i;
1787 double
1788 *x1,
1789 *x2,
1790 *x1_ptr = x1_start,
1791 *x2_ptr = x2_start;
1792
1793 switch(tipCase)
1794 {
1795 case PLL_TIP_TIPcxx . . $ `pll/pll.h:244:9`!:
1796 for (i = 0; i < n; i++)
1797 {
1798 x1 = &(tipVector[4 * tipX1[i]]);
1799 x2 = &(tipVector[4 * tipX2[i]]);
1800
1801 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).( &sum[i*4 + 0], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x1[0] ), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x2[0] )));
1802 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).( &sum[i*4 + 2], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x1[2] ), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x2[2] )));
1803 }
1804 break;
1805 case PLL_TIP_INNERcxx . . $ `pll/pll.h:245:9`!:
1806 for (i = 0; i < n; i++)
1807 {
1808 x1 = &(tipVector[4 * tipX1[i]]);
1809 if(isGapcxx . . $ isGap(b452ef6e7dfbc32e).(x2_gap, i))
1810 x2 = x2_gapColumn;
1811 else
1812 {
1813 x2 = x2_ptr;
1814 x2_ptr += 4;
1815 }
1816
1817 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).( &sum[i*4 + 0], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x1[0] ), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x2[0] )));
1818 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).( &sum[i*4 + 2], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x1[2] ), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x2[2] )));
1819 }
1820 break;
1821 case PLL_INNER_INNERcxx . . $ `pll/pll.h:246:9`!:
1822 for (i = 0; i < n; i++)
1823 {
1824 if(isGapcxx . . $ isGap(b452ef6e7dfbc32e).(x1_gap, i))
1825 x1 = x1_gapColumn;
1826 else
1827 {
1828 x1 = x1_ptr;
1829 x1_ptr += 4;
1830 }
1831
1832 if(isGapcxx . . $ isGap(b452ef6e7dfbc32e).(x2_gap, i))
1833 x2 = x2_gapColumn;
1834 else
1835 {
1836 x2 = x2_ptr;
1837 x2_ptr += 4;
1838 }
1839
1840 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).( &sum[i*4 + 0], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x1[0] ), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x2[0] )));
1841 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).( &sum[i*4 + 2], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x1[2] ), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x2[2] )));
1842
1843 }
1844 break;
1845 default:
1846 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0);
1847 }
1848 }
1849
1850 static void sumGAMMA_BINARYcxx . . $ sumGAMMA_BINARY(5111b26dbc8fb27).(int tipCase, double *sumtable, double *x1_start, double *x2_start, double *tipVector,
1851 unsigned char *tipX1, unsigned char *tipX2, int n)
1852 {
1853 double *x1, *x2, *sum;
1854 int i, j;
1855 #if (!defined(_USE_PTHREADScxx . . $ `<built-in>:420:9`!) && !defined(_FINE_GRAIN_MPI))
1856 int k;
1857 #endif
1858
1859 /* C-OPT once again switch over possible configurations at inner node */
1860
1861 switch(tipCase)
1862 {
1863 case PLL_TIP_TIPcxx . . $ `pll/pll.h:244:9`!:
1864 /* C-OPT main for loop overt alignment length */
1865 for (i = 0; i < n; i++)
1866 {
1867 x1 = &(tipVector[2 * tipX1[i]]);
1868 x2 = &(tipVector[2 * tipX2[i]]);
1869 sum = &sumtable[i * 8];
1870 #if (!defined(_USE_PTHREADScxx . . $ `<built-in>:420:9`!) && !defined(_FINE_GRAIN_MPI))
1871 for(j = 0; j < 4; j++)
1872 for(k = 0; k < 2; k++)
1873 sum[j * 2 + k] = x1[k] * x2[k];
1874 #else
1875 for(j = 0; j < 4; j++)
1876 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).( &sum[j*2], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x1[0] ), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x2[0] )));
1877 #endif
1878 }
1879 break;
1880 case PLL_TIP_INNERcxx . . $ `pll/pll.h:245:9`!:
1881 for (i = 0; i < n; i++)
1882 {
1883 x1 = &(tipVector[2 * tipX1[i]]);
1884 x2 = &x2_start[8 * i];
1885 sum = &sumtable[8 * i];
1886
1887 #if (!defined(_USE_PTHREADScxx . . $ `<built-in>:420:9`!) && !defined(_FINE_GRAIN_MPI))
1888 for(j = 0; j < 4; j++)
1889 for(k = 0; k < 2; k++)
1890 sum[j * 2 + k] = x1[k] * x2[j * 2 + k];
1891 #else
1892 for(j = 0; j < 4; j++)
1893 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).( &sum[j*2], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x1[0] ), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x2[j * 2] )));
1894 #endif
1895 }
1896 break;
1897 case PLL_INNER_INNERcxx . . $ `pll/pll.h:246:9`!:
1898 for (i = 0; i < n; i++)
1899 {
1900 x1 = &x1_start[8 * i];
1901 x2 = &x2_start[8 * i];
1902 sum = &sumtable[8 * i];
1903 #if (!defined(_USE_PTHREADScxx . . $ `<built-in>:420:9`!) && !defined(_FINE_GRAIN_MPI))
1904 for(j = 0; j < 4; j++)
1905 for(k = 0; k < 2; k++)
1906 sum[j * 2 + k] = x1[j * 2 + k] * x2[j * 2 + k];
1907 #else
1908 for(j = 0; j < 4; j++)
1909 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).( &sum[j*2], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x1[j * 2] ), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x2[j * 2] )));
1910 #endif
1911 }
1912 break;
1913 default:
1914 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0);
1915 }
1916 }
1917
1918
1919 static void sumGAMMA_GAPPED_SAVEcxx . . $ sumGAMMA_GAPPED_SAVE(c21ac5ae73f5a996).(int tipCase, double *sumtable, double *x1_start, double *x2_start, double *tipVector,
1920 unsigned char *tipX1, unsigned char *tipX2, int n,
1921 double *x1_gapColumn, double *x2_gapColumn, unsigned int *x1_gap, unsigned int *x2_gap)
1922 {
1923 double
1924 *x1,
1925 *x2,
1926 *sum,
1927 *x1_ptr = x1_start,
1928 *x2_ptr = x2_start;
1929
1930 int i, j, k;
1931
1932 switch(tipCase)
1933 {
1934 case PLL_TIP_TIPcxx . . $ `pll/pll.h:244:9`!:
1935 for (i = 0; i < n; i++)
1936 {
1937 x1 = &(tipVector[4 * tipX1[i]]);
1938 x2 = &(tipVector[4 * tipX2[i]]);
1939 sum = &sumtable[i * 16];
1940
1941 for(j = 0; j < 4; j++)
1942 for(k = 0; k < 4; k+=2)
1943 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).( &sum[j*4 + k], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x1[k] ), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x2[k] )));
1944 }
1945 break;
1946 case PLL_TIP_INNERcxx . . $ `pll/pll.h:245:9`!:
1947 for (i = 0; i < n; i++)
1948 {
1949 x1 = &(tipVector[4 * tipX1[i]]);
1950
1951 if(x2_gap[i / 32] & mask32cxx . . $ mask32.[i % 32])
1952 x2 = x2_gapColumn;
1953 else
1954 {
1955 x2 = x2_ptr;
1956 x2_ptr += 16;
1957 }
1958
1959 sum = &sumtable[16 * i];
1960
1961 for(j = 0; j < 4; j++)
1962 for(k = 0; k < 4; k+=2)
1963 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).( &sum[j*4 + k], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x1[k] ), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x2[j * 4 + k] )));
1964 }
1965 break;
1966 case PLL_INNER_INNERcxx . . $ `pll/pll.h:246:9`!:
1967 for (i = 0; i < n; i++)
1968 {
1969 if(x1_gap[i / 32] & mask32cxx . . $ mask32.[i % 32])
1970 x1 = x1_gapColumn;
1971 else
1972 {
1973 x1 = x1_ptr;
1974 x1_ptr += 16;
1975 }
1976
1977 if(x2_gap[i / 32] & mask32cxx . . $ mask32.[i % 32])
1978 x2 = x2_gapColumn;
1979 else
1980 {
1981 x2 = x2_ptr;
1982 x2_ptr += 16;
1983 }
1984
1985 sum = &sumtable[16 * i];
1986
1987
1988 for(j = 0; j < 4; j++)
1989 for(k = 0; k < 4; k+=2)
1990 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).( &sum[j*4 + k], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x1[j * 4 + k] ), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x2[j * 4 + k] )));
1991 }
1992 break;
1993 default:
1994 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0);
1995 }
1996 }
1997
1998
1999
2000
2001 static void sumGAMMAcxx . . $ sumGAMMA(5111b26dbc8fb27).(int tipCase, double *sumtable, double *x1_start, double *x2_start, double *tipVector,
2002 unsigned char *tipX1, unsigned char *tipX2, int n)
2003 {
2004 double *x1, *x2, *sum;
2005 int i, j, k;
2006
2007 /* C-OPT once again switch over possible configurations at inner node */
2008
2009 switch(tipCase)
2010 {
2011 case PLL_TIP_TIPcxx . . $ `pll/pll.h:244:9`!:
2012 /* C-OPT main for loop overt alignment length */
2013 for (i = 0; i < n; i++)
2014 {
2015 x1 = &(tipVector[4 * tipX1[i]]);
2016 x2 = &(tipVector[4 * tipX2[i]]);
2017 sum = &sumtable[i * 16];
2018
2019 for(j = 0; j < 4; j++)
2020 for(k = 0; k < 4; k+=2)
2021 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).( &sum[j*4 + k], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x1[k] ), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x2[k] )));
2022 }
2023 break;
2024 case PLL_TIP_INNERcxx . . $ `pll/pll.h:245:9`!:
2025 for (i = 0; i < n; i++)
2026 {
2027 x1 = &(tipVector[4 * tipX1[i]]);
2028 x2 = &x2_start[16 * i];
2029 sum = &sumtable[16 * i];
2030
2031 for(j = 0; j < 4; j++)
2032 for(k = 0; k < 4; k+=2)
2033 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).( &sum[j*4 + k], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x1[k] ), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x2[j * 4 + k] )));
2034 }
2035 break;
2036 case PLL_INNER_INNERcxx . . $ `pll/pll.h:246:9`!:
2037 for (i = 0; i < n; i++)
2038 {
2039 x1 = &x1_start[16 * i];
2040 x2 = &x2_start[16 * i];
2041 sum = &sumtable[16 * i];
2042
2043 for(j = 0; j < 4; j++)
2044 for(k = 0; k < 4; k+=2)
2045 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).( &sum[j*4 + k], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x1[j * 4 + k] ), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x2[j * 4 + k] )));
2046 }
2047 break;
2048 default:
2049 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0);
2050 }
2051 }
2052
2053
2054 static void sumCATcxx . . $ sumCAT(5111b26dbc8fb27).(int tipCase, double *sum, double *x1_start, double *x2_start, double *tipVector,
2055 unsigned char *tipX1, unsigned char *tipX2, int n)
2056 {
2057 int i;
2058 double
2059 *x1,
2060 *x2;
2061
2062 switch(tipCase)
2063 {
2064 case PLL_TIP_TIPcxx . . $ `pll/pll.h:244:9`!:
2065 for (i = 0; i < n; i++)
2066 {
2067 x1 = &(tipVector[4 * tipX1[i]]);
2068 x2 = &(tipVector[4 * tipX2[i]]);
2069
2070 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).( &sum[i*4 + 0], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x1[0] ), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x2[0] )));
2071 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).( &sum[i*4 + 2], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x1[2] ), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x2[2] )));
2072 }
2073 break;
2074 case PLL_TIP_INNERcxx . . $ `pll/pll.h:245:9`!:
2075 for (i = 0; i < n; i++)
2076 {
2077 x1 = &(tipVector[4 * tipX1[i]]);
2078 x2 = &x2_start[4 * i];
2079
2080 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).( &sum[i*4 + 0], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x1[0] ), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x2[0] )));
2081 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).( &sum[i*4 + 2], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x1[2] ), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x2[2] )));
2082 }
2083 break;
2084 case PLL_INNER_INNERcxx . . $ `pll/pll.h:246:9`!:
2085 for (i = 0; i < n; i++)
2086 {
2087 x1 = &x1_start[4 * i];
2088 x2 = &x2_start[4 * i];
2089
2090 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).( &sum[i*4 + 0], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x1[0] ), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x2[0] )));
2091 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).( &sum[i*4 + 2], _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).( _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x1[2] ), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).( &x2[2] )));
2092
2093 }
2094 break;
2095 default:
2096 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0);
2097 }
2098 }
2099 static void sumGAMMAPROT_GAPPED_SAVEcxx . . $ sumGAMMAPROT_GAPPED_SAVE(c21ac5ae73f5a996).(int tipCase, double *sumtable, double *x1, double *x2, double *tipVector,
2100 unsigned char *tipX1, unsigned char *tipX2, int n,
2101 double *x1_gapColumn, double *x2_gapColumn, unsigned int *x1_gap, unsigned int *x2_gap)
2102 {
2103 int i, l, k;
2104 double
2105 *left,
2106 *right,
2107 *sum,
2108 *x1_ptr = x1,
2109 *x2_ptr = x2,
2110 *x1v,
2111 *x2v;
2112
2113 switch(tipCase)
2114 {
2115 case PLL_TIP_TIPcxx . . $ `pll/pll.h:244:9`!:
2116 for(i = 0; i < n; i++)
2117 {
2118 left = &(tipVector[20 * tipX1[i]]);
2119 right = &(tipVector[20 * tipX2[i]]);
2120
2121 for(l = 0; l < 4; l++)
2122 {
2123 sum = &sumtable[i * 80 + l * 20];
2124
2125 for(k = 0; k < 20; k+=2)
2126 {
2127 __m128dcxx . . $ __m128d# sumv = _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&left[k]), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&right[k]));
2128
2129 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).(&sum[k], sumv);
2130 }
2131
2132 }
2133 }
2134 break;
2135 case PLL_TIP_INNERcxx . . $ `pll/pll.h:245:9`!:
2136 for(i = 0; i < n; i++)
2137 {
2138 left = &(tipVector[20 * tipX1[i]]);
2139
2140 if(x2_gap[i / 32] & mask32cxx . . $ mask32.[i % 32])
2141 x2v = x2_gapColumn;
2142 else
2143 {
2144 x2v = x2_ptr;
2145 x2_ptr += 80;
2146 }
2147
2148 for(l = 0; l < 4; l++)
2149 {
2150 right = &(x2v[l * 20]);
2151 sum = &sumtable[i * 80 + l * 20];
2152
2153 for(k = 0; k < 20; k+=2)
2154 {
2155 __m128dcxx . . $ __m128d# sumv = _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&left[k]), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&right[k]));
2156
2157 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).(&sum[k], sumv);
2158 }
2159 }
2160 }
2161 break;
2162 case PLL_INNER_INNERcxx . . $ `pll/pll.h:246:9`!:
2163 for(i = 0; i < n; i++)
2164 {
2165 if(x1_gap[i / 32] & mask32cxx . . $ mask32.[i % 32])
2166 x1v = x1_gapColumn;
2167 else
2168 {
2169 x1v = x1_ptr;
2170 x1_ptr += 80;
2171 }
2172
2173 if(x2_gap[i / 32] & mask32cxx . . $ mask32.[i % 32])
2174 x2v = x2_gapColumn;
2175 else
2176 {
2177 x2v = x2_ptr;
2178 x2_ptr += 80;
2179 }
2180
2181 for(l = 0; l < 4; l++)
2182 {
2183 left = &(x1v[l * 20]);
2184 right = &(x2v[l * 20]);
2185 sum = &(sumtable[i * 80 + l * 20]);
2186
2187 for(k = 0; k < 20; k+=2)
2188 {
2189 __m128dcxx . . $ __m128d# sumv = _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&left[k]), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&right[k]));
2190
2191 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).(&sum[k], sumv);
2192 }
2193 }
2194 }
2195 break;
2196 default:
2197 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0);
2198 }
2199 }
2200
2201
2202 static void sumGAMMAPROT_LG4cxx . . $ sumGAMMAPROT_LG4(101081f4e3ed5496).(int tipCase, double *sumtable, double *x1, double *x2, double *tipVector[4],
2203 unsigned char *tipX1, unsigned char *tipX2, int n)
2204 {
2205 int i, l, k;
2206 double *left, *right, *sum;
2207
2208 switch(tipCase)
2209 {
2210 case PLL_TIP_TIPcxx . . $ `pll/pll.h:244:9`!:
2211 for(i = 0; i < n; i++)
2212 {
2213 for(l = 0; l < 4; l++)
2214 {
2215 left = &(tipVector[l][20 * tipX1[i]]);
2216 right = &(tipVector[l][20 * tipX2[i]]);
2217
2218 sum = &sumtable[i * 80 + l * 20];
2219 #ifdef __SSE3cxx . . $ `<built-in>:421:9`!
2220 for(k = 0; k < 20; k+=2)
2221 {
2222 __m128dcxx . . $ __m128d# sumv = _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&left[k]), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&right[k]));
2223
2224 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).(&sum[k], sumv);
2225 }
2226 #else
2227 for(k = 0; k < 20; k++)
2228 sum[k] = left[k] * right[k];
2229 #endif
2230 }
2231 }
2232 break;
2233 case PLL_TIP_INNERcxx . . $ `pll/pll.h:245:9`!:
2234 for(i = 0; i < n; i++)
2235 {
2236
2237
2238 for(l = 0; l < 4; l++)
2239 {
2240 left = &(tipVector[l][20 * tipX1[i]]);
2241 right = &(x2[80 * i + l * 20]);
2242 sum = &sumtable[i * 80 + l * 20];
2243 #ifdef __SSE3cxx . . $ `<built-in>:421:9`!
2244 for(k = 0; k < 20; k+=2)
2245 {
2246 __m128dcxx . . $ __m128d# sumv = _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&left[k]), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&right[k]));
2247
2248 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).(&sum[k], sumv);
2249 }
2250 #else
2251 for(k = 0; k < 20; k++)
2252 sum[k] = left[k] * right[k];
2253 #endif
2254 }
2255 }
2256 break;
2257 case PLL_INNER_INNERcxx . . $ `pll/pll.h:246:9`!:
2258 for(i = 0; i < n; i++)
2259 {
2260 for(l = 0; l < 4; l++)
2261 {
2262 left = &(x1[80 * i + l * 20]);
2263 right = &(x2[80 * i + l * 20]);
2264 sum = &(sumtable[i * 80 + l * 20]);
2265
2266 #ifdef __SSE3cxx . . $ `<built-in>:421:9`!
2267 for(k = 0; k < 20; k+=2)
2268 {
2269 __m128dcxx . . $ __m128d# sumv = _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&left[k]), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&right[k]));
2270
2271 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).(&sum[k], sumv);
2272 }
2273 #else
2274 for(k = 0; k < 20; k++)
2275 sum[k] = left[k] * right[k];
2276 #endif
2277 }
2278 }
2279 break;
2280 default:
2281 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0);
2282 }
2283 }
2284
2285
2286 static void sumGAMMAPROTcxx . . $ sumGAMMAPROT(5111b26dbc8fb27).(int tipCase, double *sumtable, double *x1, double *x2, double *tipVector,
2287 unsigned char *tipX1, unsigned char *tipX2, int n)
2288 {
2289 int i, l, k;
2290 double *left, *right, *sum;
2291
2292 switch(tipCase)
2293 {
2294 case PLL_TIP_TIPcxx . . $ `pll/pll.h:244:9`!:
2295 for(i = 0; i < n; i++)
2296 {
2297 left = &(tipVector[20 * tipX1[i]]);
2298 right = &(tipVector[20 * tipX2[i]]);
2299
2300 for(l = 0; l < 4; l++)
2301 {
2302 sum = &sumtable[i * 80 + l * 20];
2303
2304 for(k = 0; k < 20; k+=2)
2305 {
2306 __m128dcxx . . $ __m128d# sumv = _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&left[k]), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&right[k]));
2307
2308 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).(&sum[k], sumv);
2309 }
2310
2311 }
2312 }
2313 break;
2314 case PLL_TIP_INNERcxx . . $ `pll/pll.h:245:9`!:
2315 for(i = 0; i < n; i++)
2316 {
2317 left = &(tipVector[20 * tipX1[i]]);
2318
2319 for(l = 0; l < 4; l++)
2320 {
2321 right = &(x2[80 * i + l * 20]);
2322 sum = &sumtable[i * 80 + l * 20];
2323
2324 for(k = 0; k < 20; k+=2)
2325 {
2326 __m128dcxx . . $ __m128d# sumv = _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&left[k]), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&right[k]));
2327
2328 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).(&sum[k], sumv);
2329 }
2330
2331 }
2332 }
2333 break;
2334 case PLL_INNER_INNERcxx . . $ `pll/pll.h:246:9`!:
2335 for(i = 0; i < n; i++)
2336 {
2337 for(l = 0; l < 4; l++)
2338 {
2339 left = &(x1[80 * i + l * 20]);
2340 right = &(x2[80 * i + l * 20]);
2341 sum = &(sumtable[i * 80 + l * 20]);
2342
2343
2344 for(k = 0; k < 20; k+=2)
2345 {
2346 __m128dcxx . . $ __m128d# sumv = _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&left[k]), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&right[k]));
2347
2348 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).(&sum[k], sumv);
2349 }
2350 }
2351 }
2352 break;
2353 default:
2354 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0);
2355 }
2356 }
2357
2358
2359 static void sumGTRCATPROTcxx . . $ sumGTRCATPROT(5111b26dbc8fb27).(int tipCase, double *sumtable, double *x1, double *x2, double *tipVector,
2360 unsigned char *tipX1, unsigned char *tipX2, int n)
2361 {
2362 int i, l;
2363 double *sum, *left, *right;
2364
2365 switch(tipCase)
2366 {
2367 case PLL_TIP_TIPcxx . . $ `pll/pll.h:244:9`!:
2368 for (i = 0; i < n; i++)
2369 {
2370 left = &(tipVector[20 * tipX1[i]]);
2371 right = &(tipVector[20 * tipX2[i]]);
2372 sum = &sumtable[20 * i];
2373
2374 for(l = 0; l < 20; l+=2)
2375 {
2376 __m128dcxx . . $ __m128d# sumv = _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&left[l]), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&right[l]));
2377
2378 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).(&sum[l], sumv);
2379 }
2380
2381 }
2382 break;
2383 case PLL_TIP_INNERcxx . . $ `pll/pll.h:245:9`!:
2384 for (i = 0; i < n; i++)
2385 {
2386 left = &(tipVector[20 * tipX1[i]]);
2387 right = &x2[20 * i];
2388 sum = &sumtable[20 * i];
2389
2390 for(l = 0; l < 20; l+=2)
2391 {
2392 __m128dcxx . . $ __m128d# sumv = _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&left[l]), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&right[l]));
2393
2394 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).(&sum[l], sumv);
2395 }
2396
2397 }
2398 break;
2399 case PLL_INNER_INNERcxx . . $ `pll/pll.h:246:9`!:
2400 for (i = 0; i < n; i++)
2401 {
2402 left = &x1[20 * i];
2403 right = &x2[20 * i];
2404 sum = &sumtable[20 * i];
2405
2406 for(l = 0; l < 20; l+=2)
2407 {
2408 __m128dcxx . . $ __m128d# sumv = _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&left[l]), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&right[l]));
2409
2410 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).(&sum[l], sumv);
2411 }
2412
2413 }
2414 break;
2415 default:
2416 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0);
2417 }
2418 }
2419
2420
2421 static void sumGTRCATPROT_SAVEcxx . . $ sumGTRCATPROT_SAVE(c21ac5ae73f5a996).(int tipCase, double *sumtable, double *x1, double *x2, double *tipVector,
2422 unsigned char *tipX1, unsigned char *tipX2, int n,
2423 double *x1_gapColumn, double *x2_gapColumn, unsigned int *x1_gap, unsigned int *x2_gap)
2424 {
2425 int
2426 i,
2427 l;
2428
2429 double
2430 *sum,
2431 *left,
2432 *right,
2433 *left_ptr = x1,
2434 *right_ptr = x2;
2435
2436 switch(tipCase)
2437 {
2438 case PLL_TIP_TIPcxx . . $ `pll/pll.h:244:9`!:
2439 for (i = 0; i < n; i++)
2440 {
2441 left = &(tipVector[20 * tipX1[i]]);
2442 right = &(tipVector[20 * tipX2[i]]);
2443 sum = &sumtable[20 * i];
2444
2445 for(l = 0; l < 20; l+=2)
2446 {
2447 __m128dcxx . . $ __m128d# sumv = _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&left[l]), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&right[l]));
2448
2449 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).(&sum[l], sumv);
2450 }
2451
2452 }
2453 break;
2454 case PLL_TIP_INNERcxx . . $ `pll/pll.h:245:9`!:
2455 for (i = 0; i < n; i++)
2456 {
2457 left = &(tipVector[20 * tipX1[i]]);
2458
2459 if(isGapcxx . . $ isGap(b452ef6e7dfbc32e).(x2_gap, i))
2460 right = x2_gapColumn;
2461 else
2462 {
2463 right = right_ptr;
2464 right_ptr += 20;
2465 }
2466
2467 sum = &sumtable[20 * i];
2468
2469 for(l = 0; l < 20; l+=2)
2470 {
2471 __m128dcxx . . $ __m128d# sumv = _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&left[l]), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&right[l]));
2472
2473 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).(&sum[l], sumv);
2474 }
2475
2476 }
2477 break;
2478 case PLL_INNER_INNERcxx . . $ `pll/pll.h:246:9`!:
2479 for (i = 0; i < n; i++)
2480 {
2481 if(isGapcxx . . $ isGap(b452ef6e7dfbc32e).(x1_gap, i))
2482 left = x1_gapColumn;
2483 else
2484 {
2485 left = left_ptr;
2486 left_ptr += 20;
2487 }
2488
2489 if(isGapcxx . . $ isGap(b452ef6e7dfbc32e).(x2_gap, i))
2490 right = x2_gapColumn;
2491 else
2492 {
2493 right = right_ptr;
2494 right_ptr += 20;
2495 }
2496
2497 sum = &sumtable[20 * i];
2498
2499 for(l = 0; l < 20; l+=2)
2500 {
2501 __m128dcxx . . $ __m128d# sumv = _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&left[l]), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&right[l]));
2502
2503 _mm_store_pdcxx . . $ _mm_store_pd(bcb7fe46c030add4).(&sum[l], sumv);
2504 }
2505 }
2506 break;
2507 default:
2508 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0);
2509 }
2510 }
2511
2512 static void coreGTRGAMMAcxx . . $ coreGTRGAMMA(c0a820a3f2225259).(const int upper, double *sumtable,
2513 volatile double *ext_dlnLdlz, volatile double *ext_d2lnLdlz2, double *EIGN, double *gammaRates, double lz, int *wrptr)
2514 {
2515 double
2516 dlnLdlz = 0.0,
2517 d2lnLdlz2 = 0.0,
2518 ki,
2519 kisqr,
2520 inv_Li,
2521 dlnLidlz,
2522 d2lnLidlz2,
2523 *sum;
2524 PLL_ALIGN_BEGINcxx . . $ `pll/pll.h:101:10`! double
2525 diagptable0[16] PLL_ALIGN_ENDcxx . . $ `pll/pll.h:102:10`!,
2526 diagptable1[16] PLL_ALIGN_ENDcxx . . $ `pll/pll.h:102:10`!,
2527 diagptable2[16] PLL_ALIGN_ENDcxx . . $ `pll/pll.h:102:10`!;
2528
2529 int
2530 i,
2531 j,
2532 l;
2533
2534 for(i = 0; i < 4; i++)
2535 {
2536 ki = gammaRates[i];
2537 kisqr = ki * ki;
2538
2539 diagptable0[i * 4] = 1.0;
2540 diagptable1[i * 4] = 0.0;
2541 diagptable2[i * 4] = 0.0;
2542
2543 for(l = 1; l < 4; l++)
2544 {
2545 diagptable0[i * 4 + l] = exp(EIGN[l] * ki * lz);
2546 diagptable1[i * 4 + l] = EIGN[l] * ki;
2547 diagptable2[i * 4 + l] = EIGN[l] * EIGN[l] * kisqr;
2548 }
2549 }
2550
2551 for (i = 0; i < upper; i++)
2552 {
2553 __m128dcxx . . $ __m128d# a0 = _mm_setzero_pdcxx . . $ _mm_setzero_pd(647fa700b46b5d24).();
2554 __m128dcxx . . $ __m128d# a1 = _mm_setzero_pdcxx . . $ _mm_setzero_pd(647fa700b46b5d24).();
2555 __m128dcxx . . $ __m128d# a2 = _mm_setzero_pdcxx . . $ _mm_setzero_pd(647fa700b46b5d24).();
2556
2557 sum = &sumtable[i * 16];
2558
2559 for(j = 0; j < 4; j++)
2560 {
2561 double
2562 *d0 = &diagptable0[j * 4],
2563 *d1 = &diagptable1[j * 4],
2564 *d2 = &diagptable2[j * 4];
2565
2566 for(l = 0; l < 4; l+=2)
2567 {
2568 __m128dcxx . . $ __m128d# tmpv = _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&d0[l]), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&sum[j * 4 + l]));
2569 a0 = _mm_add_pdcxx . . $ _mm_add_pd(a27da52cef7cc9d8).(a0, tmpv);
2570 a1 = _mm_add_pdcxx . . $ _mm_add_pd(a27da52cef7cc9d8).(a1, _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(tmpv, _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&d1[l])));
2571 a2 = _mm_add_pdcxx . . $ _mm_add_pd(a27da52cef7cc9d8).(a2, _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(tmpv, _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&d2[l])));
2572 }
2573 }
2574
2575 a0 = _mm_hadd_pdcxx . . $ _mm_hadd_pd(a27da52cef7cc9d8).(a0, a0);
2576 a1 = _mm_hadd_pdcxx . . $ _mm_hadd_pd(a27da52cef7cc9d8).(a1, a1);
2577 a2 = _mm_hadd_pdcxx . . $ _mm_hadd_pd(a27da52cef7cc9d8).(a2, a2);
2578
2579 _mm_storel_pdcxx . . $ _mm_storel_pd(bcb7fe46c030add4).(&inv_Li, a0);
2580 _mm_storel_pdcxx . . $ _mm_storel_pd(bcb7fe46c030add4).(&dlnLidlz, a1);
2581 _mm_storel_pdcxx . . $ _mm_storel_pd(bcb7fe46c030add4).(&d2lnLidlz2, a2);
2582
2583 inv_Li = 1.0 / fabs (inv_Li);
2584
2585 dlnLidlz *= inv_Li;
2586 d2lnLidlz2 *= inv_Li;
2587
2588 dlnLdlz += wrptr[i] * dlnLidlz;
2589 d2lnLdlz2 += wrptr[i] * (d2lnLidlz2 - dlnLidlz * dlnLidlz);
2590 }
2591
2592
2593 *ext_dlnLdlz = dlnLdlz;
2594 *ext_d2lnLdlz2 = d2lnLdlz2;
2595 }
2596
2597 static void coreGTRCAT_BINARYcxx . . $ coreGTRCAT_BINARY(25aa5d1ffb96ce3c).(int upper, int numberOfCategories, double *sum,
2598 volatile double *d1, volatile double *d2,
2599 double *rptr, double *EIGN, int *cptr, double lz, int *wgt)
2600 {
2601 int i;
2602 double
2603 *d, *d_start = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
2604 tmp_0, inv_Li, dlnLidlz, d2lnLidlz2,
2605 dlnLdlz = 0.0,
2606 d2lnLdlz2 = 0.0;
2607 double e[2];
2608 double dd1;
2609
2610 e[0] = EIGN[0];
2611 e[1] = EIGN[0] * EIGN[0];
2612
2613
2614 d = d_start = (double *)rax_malloccxx . . $ `pll/mem_alloc.h:38:13`!(numberOfCategories * sizeof(double));
2615
2616 dd1 = e[0] * lz;
2617
2618 for(i = 0; i < numberOfCategories; i++)
2619 d[i] = exp(dd1 * rptr[i]);
2620
2621 for (i = 0; i < upper; i++)
2622 {
2623 double
2624 r = rptr[cptr[i]],
2625 wr1 = r * wgt[i],
2626 wr2 = r * r * wgt[i];
2627
2628 d = &d_start[cptr[i]];
2629
2630 inv_Li = sum[2 * i];
2631 inv_Li += (tmp_0 = d[0] * sum[2 * i + 1]);
2632
2633 inv_Li = 1.0/fabs(inv_Li);
2634
2635 dlnLidlz = tmp_0 * e[0];
2636 d2lnLidlz2 = tmp_0 * e[1];
2637
2638 dlnLidlz *= inv_Li;
2639 d2lnLidlz2 *= inv_Li;
2640
2641 dlnLdlz += wr1 * dlnLidlz;
2642 d2lnLdlz2 += wr2 * (d2lnLidlz2 - dlnLidlz * dlnLidlz);
2643 }
2644
2645 *d1 = dlnLdlz;
2646 *d2 = d2lnLdlz2;
2647
2648 rax_freecxx . . $ `pll/mem_alloc.h:40:13`!(d_start);
2649 }
2650
2651
2652 static void coreGTRCATcxx . . $ coreGTRCAT(ce8aafcb1e86b883).(int upper, int numberOfCategories, double *sum,
2653 volatile double *d1, volatile double *d2, int *wgt,
2654 double *rptr, double *EIGN, int *cptr, double lz)
2655 {
2656 int i;
2657 double
2658 *d, *d_start = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
2659 inv_Li, dlnLidlz, d2lnLidlz2,
2660 dlnLdlz = 0.0,
2661 d2lnLdlz2 = 0.0;
2662
2663 PLL_ALIGN_BEGINcxx . . $ `pll/pll.h:101:10`! double e1[4] PLL_ALIGN_ENDcxx . . $ `pll/pll.h:102:10`!;
2664 PLL_ALIGN_BEGINcxx . . $ `pll/pll.h:101:10`! double e2[4] PLL_ALIGN_ENDcxx . . $ `pll/pll.h:102:10`!;
2665 double dd1, dd2, dd3;
2666
2667 __m128dcxx . . $ __m128d#
2668 e1v[2],
2669 e2v[2];
2670
2671 e1[0] = 0.0;
2672 e2[0] = 0.0;
2673 e1[1] = EIGN[1];
2674 e2[1] = EIGN[1] * EIGN[1];
2675 e1[2] = EIGN[2];
2676 e2[2] = EIGN[2] * EIGN[2];
2677 e1[3] = EIGN[3];
2678 e2[3] = EIGN[3] * EIGN[3];
2679
2680 e1v[0]= _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&e1[0]);
2681 e1v[1]= _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&e1[2]);
2682
2683 e2v[0]= _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&e2[0]);
2684 e2v[1]= _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&e2[2]);
2685
2686 rax_posix_memaligncxx . . $ `pll/mem_alloc.h:37:13`! ((void **) &d_start, PLL_BYTE_ALIGNMENTcxx . . $ `pll/pll.h:89:9`!, numberOfCategories * 4 * sizeof(double));
2687 d = d_start;
2688
2689 dd1 = EIGN[1] * lz;
2690 dd2 = EIGN[2] * lz;
2691 dd3 = EIGN[3] * lz;
2692
2693 for(i = 0; i < numberOfCategories; i++)
2694 {
2695 d[i * 4 + 0] = 1.0;
2696 d[i * 4 + 1] = exp(dd1 * rptr[i]);
2697 d[i * 4 + 2] = exp(dd2 * rptr[i]);
2698 d[i * 4 + 3] = exp(dd3 * rptr[i]);
2699 }
2700
2701 for (i = 0; i < upper; i++)
2702 {
2703 double *s = &sum[4 * i];
2704 d = &d_start[4 * cptr[i]];
2705
2706 __m128dcxx . . $ __m128d# tmp_0v =_mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&d[0]),_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&s[0]));
2707 __m128dcxx . . $ __m128d# tmp_1v =_mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&d[2]),_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&s[2]));
2708
2709 __m128dcxx . . $ __m128d# inv_Liv = _mm_add_pdcxx . . $ _mm_add_pd(a27da52cef7cc9d8).(tmp_0v, tmp_1v);
2710
2711 __m128dcxx . . $ __m128d# dlnLidlzv = _mm_add_pdcxx . . $ _mm_add_pd(a27da52cef7cc9d8).(_mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(tmp_0v, e1v[0]), _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(tmp_1v, e1v[1]));
2712 __m128dcxx . . $ __m128d# d2lnLidlz2v = _mm_add_pdcxx . . $ _mm_add_pd(a27da52cef7cc9d8).(_mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(tmp_0v, e2v[0]), _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(tmp_1v, e2v[1]));
2713
2714
2715 inv_Liv = _mm_hadd_pdcxx . . $ _mm_hadd_pd(a27da52cef7cc9d8).(inv_Liv, inv_Liv);
2716 dlnLidlzv = _mm_hadd_pdcxx . . $ _mm_hadd_pd(a27da52cef7cc9d8).(dlnLidlzv, dlnLidlzv);
2717 d2lnLidlz2v = _mm_hadd_pdcxx . . $ _mm_hadd_pd(a27da52cef7cc9d8).(d2lnLidlz2v, d2lnLidlz2v);
2718
2719 _mm_storel_pdcxx . . $ _mm_storel_pd(bcb7fe46c030add4).(&inv_Li, inv_Liv);
2720 _mm_storel_pdcxx . . $ _mm_storel_pd(bcb7fe46c030add4).(&dlnLidlz, dlnLidlzv);
2721 _mm_storel_pdcxx . . $ _mm_storel_pd(bcb7fe46c030add4).(&d2lnLidlz2, d2lnLidlz2v);
2722
2723 inv_Li = 1.0 / fabs (inv_Li);
2724
2725 dlnLidlz *= inv_Li;
2726 d2lnLidlz2 *= inv_Li;
2727
2728 dlnLdlz += wgt[i] * rptr[cptr[i]] * dlnLidlz;
2729 d2lnLdlz2 += wgt[i] * rptr[cptr[i]] * rptr[cptr[i]] * (d2lnLidlz2 - dlnLidlz * dlnLidlz);
2730 }
2731
2732 *d1 = dlnLdlz;
2733 *d2 = d2lnLdlz2;
2734
2735 rax_freecxx . . $ `pll/mem_alloc.h:40:13`!(d_start);
2736 }
2737
2738 #if (!defined(__SSE3cxx . . $ `<built-in>:421:9`!) && !defined(__AVX))
2739 static void coreGTRGAMMA_BINARY(const int upper, double *sumtable,
2740 volatile double *d1, volatile double *d2, double *EIGN, double *gammaRates, double lz, int *wrptr)
2741 {
2742 int i, j;
2743 double
2744 *diagptable, *diagptable_start, *sum,
2745 tmp_1, inv_Li, dlnLidlz, d2lnLidlz2, ki, kisqr,
2746 dlnLdlz = 0.0,
2747 d2lnLdlz2 = 0.0;
2748
2749 diagptable = diagptable_start = (double *)rax_malloc(sizeof(double) * 12);
2750
2751 for(i = 0; i < 4; i++)
2752 {
2753 ki = gammaRates[i];
2754 kisqr = ki * ki;
2755
2756 diagptable[i * 3] = exp (EIGN[1] * ki * lz);
2757 diagptable[i * 3 + 1] = EIGN[1] * ki;
2758 diagptable[i * 3 + 2] = EIGN[1] * EIGN[1] * kisqr;
2759 }
2760
2761 for (i = 0; i < upper; i++)
2762 {
2763 diagptable = diagptable_start;
2764 sum = &(sumtable[i * 8]);
2765
2766 inv_Li = 0.0;
2767 dlnLidlz = 0.0;
2768 d2lnLidlz2 = 0.0;
2769
2770 for(j = 0; j < 4; j++)
2771 {
2772 inv_Li += sum[2 * j];
2773
2774 tmp_1 = diagptable[3 * j] * sum[2 * j + 1];
2775 inv_Li += tmp_1;
2776 dlnLidlz += tmp_1 * diagptable[3 * j + 1];
2777 d2lnLidlz2 += tmp_1 * diagptable[3 * j + 2];
2778 }
2779
2780 inv_Li = 1.0 / fabs(inv_Li);
2781
2782 dlnLidlz *= inv_Li;
2783 d2lnLidlz2 *= inv_Li;
2784
2785
2786 dlnLdlz += wrptr[i] * dlnLidlz;
2787 d2lnLdlz2 += wrptr[i] * (d2lnLidlz2 - dlnLidlz * dlnLidlz);
2788 }
2789
2790 *d1 = dlnLdlz;
2791 *d2 = d2lnLdlz2;
2792
2793 rax_free(diagptable_start);
2794 }
2795 #else
2796 static void coreGTRGAMMA_BINARYcxx . . $ coreGTRGAMMA_BINARY(c0a820a3f2225259).(const int upper, double *sumtable,
2797 volatile double *d1, volatile double *d2, double *EIGN, double *gammaRates, double lz, int *wrptr)
2798 {
2799 double
2800 dlnLdlz = 0.0,
2801 d2lnLdlz2 = 0.0,
2802 ki,
2803 kisqr,
2804 inv_Li,
2805 dlnLidlz,
2806 d2lnLidlz2,
2807 *sum;
2808 PLL_ALIGN_BEGINcxx . . $ `pll/pll.h:101:10`! double
2809 diagptable0[8] PLL_ALIGN_ENDcxx . . $ `pll/pll.h:102:10`!,
2810 diagptable1[8] PLL_ALIGN_ENDcxx . . $ `pll/pll.h:102:10`!,
2811 diagptable2[8] PLL_ALIGN_ENDcxx . . $ `pll/pll.h:102:10`!;
2812
2813 int
2814 i,
2815 j;
2816
2817 for(i = 0; i < 4; i++)
2818 {
2819 ki = gammaRates[i];
2820 kisqr = ki * ki;
2821
2822 diagptable0[i * 2] = 1.0;
2823 diagptable1[i * 2] = 0.0;
2824 diagptable2[i * 2] = 0.0;
2825
2826 diagptable0[i * 2 + 1] = exp(EIGN[0] * ki * lz);
2827 diagptable1[i * 2 + 1] = EIGN[0] * ki;
2828 diagptable2[i * 2 + 1] = EIGN[0] * EIGN[0] * kisqr;
2829 }
2830
2831 for (i = 0; i < upper; i++)
2832 {
2833 __m128dcxx . . $ __m128d# a0 = _mm_setzero_pdcxx . . $ _mm_setzero_pd(647fa700b46b5d24).();
2834 __m128dcxx . . $ __m128d# a1 = _mm_setzero_pdcxx . . $ _mm_setzero_pd(647fa700b46b5d24).();
2835 __m128dcxx . . $ __m128d# a2 = _mm_setzero_pdcxx . . $ _mm_setzero_pd(647fa700b46b5d24).();
2836
2837 sum = &sumtable[i * 8];
2838
2839 for(j = 0; j < 4; j++)
2840 {
2841 double
2842 *d0 = &diagptable0[j * 2],
2843 *d1 = &diagptable1[j * 2],
2844 *d2 = &diagptable2[j * 2];
2845
2846 __m128dcxx . . $ __m128d# tmpv = _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(d0), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&sum[j * 2]));
2847 a0 = _mm_add_pdcxx . . $ _mm_add_pd(a27da52cef7cc9d8).(a0, tmpv);
2848 a1 = _mm_add_pdcxx . . $ _mm_add_pd(a27da52cef7cc9d8).(a1, _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(tmpv, _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(d1)));
2849 a2 = _mm_add_pdcxx . . $ _mm_add_pd(a27da52cef7cc9d8).(a2, _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(tmpv, _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(d2)));
2850
2851 }
2852
2853 a0 = _mm_hadd_pdcxx . . $ _mm_hadd_pd(a27da52cef7cc9d8).(a0, a0);
2854 a1 = _mm_hadd_pdcxx . . $ _mm_hadd_pd(a27da52cef7cc9d8).(a1, a1);
2855 a2 = _mm_hadd_pdcxx . . $ _mm_hadd_pd(a27da52cef7cc9d8).(a2, a2);
2856
2857 _mm_storel_pdcxx . . $ _mm_storel_pd(bcb7fe46c030add4).(&inv_Li, a0);
2858 _mm_storel_pdcxx . . $ _mm_storel_pd(bcb7fe46c030add4).(&dlnLidlz, a1);
2859 _mm_storel_pdcxx . . $ _mm_storel_pd(bcb7fe46c030add4).(&d2lnLidlz2, a2);
2860
2861 inv_Li = 1.0 / fabs(inv_Li);
2862
2863 dlnLidlz *= inv_Li;
2864 d2lnLidlz2 *= inv_Li;
2865
2866 dlnLdlz += wrptr[i] * dlnLidlz;
2867 d2lnLdlz2 += wrptr[i] * (d2lnLidlz2 - dlnLidlz * dlnLidlz);
2868 }
2869
2870
2871 *d1 = dlnLdlz;
2872 *d2 = d2lnLdlz2;
2873 }
2874
2875
2876 #endif
2877
2878 static void coreGTRGAMMAPROT_LG4cxx . . $ coreGTRGAMMAPROT_LG4(b7457016642a760a).(double *gammaRates, double *EIGN[4], double *sumtable, int upper, int *wrptr,
2879 volatile double *ext_dlnLdlz, volatile double *ext_d2lnLdlz2, double lz,
2880 double * lg4_weights)
2881 {
2882 double *sum;
2883 PLL_ALIGN_BEGINcxx . . $ `pll/pll.h:101:10`! double
2884 diagptable0[80] PLL_ALIGN_ENDcxx . . $ `pll/pll.h:102:10`!,
2885 diagptable1[80] PLL_ALIGN_ENDcxx . . $ `pll/pll.h:102:10`!,
2886 diagptable2[80] PLL_ALIGN_ENDcxx . . $ `pll/pll.h:102:10`!;
2887 int i, j, l;
2888 double dlnLdlz = 0;
2889 double d2lnLdlz2 = 0;
2890 double ki, kisqr;
2891
2892 for(i = 0; i < 4; i++)
2893 {
2894 ki = gammaRates[i];
2895 kisqr = ki * ki;
2896
2897 diagptable0[i * 20] = 1.0;
2898 diagptable1[i * 20] = 0.0;
2899 diagptable2[i * 20] = 0.0;
2900
2901 for(l = 1; l < 20; l++)
2902 {
2903 diagptable0[i * 20 + l] = exp(EIGN[i][l] * ki * lz);
2904 diagptable1[i * 20 + l] = EIGN[i][l] * ki;
2905 diagptable2[i * 20 + l] = EIGN[i][l] * EIGN[i][l] * kisqr;
2906 }
2907 }
2908
2909 for (i = 0; i < upper; i++)
2910 {
2911
2912 double
2913 inv_Li = 0.0,
2914 dlnLidlz = 0.0,
2915 d2lnLidlz2 = 0.0;
2916
2917 sum = &sumtable[i * 80];
2918
2919 for(j = 0; j < 4; j++)
2920 {
2921 double
2922 l0,
2923 l1,
2924 l2,
2925 *d0 = &diagptable0[j * 20],
2926 *d1 = &diagptable1[j * 20],
2927 *d2 = &diagptable2[j * 20];
2928
2929 __m128dcxx . . $ __m128d# a0 = _mm_setzero_pdcxx . . $ _mm_setzero_pd(647fa700b46b5d24).();
2930 __m128dcxx . . $ __m128d# a1 = _mm_setzero_pdcxx . . $ _mm_setzero_pd(647fa700b46b5d24).();
2931 __m128dcxx . . $ __m128d# a2 = _mm_setzero_pdcxx . . $ _mm_setzero_pd(647fa700b46b5d24).();
2932
2933 for(l = 0; l < 20; l+=2)
2934 {
2935 __m128dcxx . . $ __m128d# tmpv = _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&d0[l]), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&sum[j * 20 +l]));
2936 a0 = _mm_add_pdcxx . . $ _mm_add_pd(a27da52cef7cc9d8).(a0, tmpv);
2937 a1 = _mm_add_pdcxx . . $ _mm_add_pd(a27da52cef7cc9d8).(a1, _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(tmpv, _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&d1[l])));
2938 a2 = _mm_add_pdcxx . . $ _mm_add_pd(a27da52cef7cc9d8).(a2, _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(tmpv, _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&d2[l])));
2939 }
2940
2941 a0 = _mm_hadd_pdcxx . . $ _mm_hadd_pd(a27da52cef7cc9d8).(a0, a0);
2942 a1 = _mm_hadd_pdcxx . . $ _mm_hadd_pd(a27da52cef7cc9d8).(a1, a1);
2943 a2 = _mm_hadd_pdcxx . . $ _mm_hadd_pd(a27da52cef7cc9d8).(a2, a2);
2944
2945 _mm_storel_pdcxx . . $ _mm_storel_pd(bcb7fe46c030add4).(&l0, a0);
2946 _mm_storel_pdcxx . . $ _mm_storel_pd(bcb7fe46c030add4).(&l1, a1);
2947 _mm_storel_pdcxx . . $ _mm_storel_pd(bcb7fe46c030add4).(&l2, a2);
2948
2949 inv_Li += lg4_weights[j] * l0;
2950 dlnLidlz += lg4_weights[j] * l1;
2951 d2lnLidlz2 += lg4_weights[j] * l2;
2952 }
2953
2954 inv_Li = 1.0 / fabs (inv_Li);
2955
2956 dlnLidlz *= inv_Li;
2957 d2lnLidlz2 *= inv_Li;
2958
2959 dlnLdlz += wrptr[i] * dlnLidlz;
2960 d2lnLdlz2 += wrptr[i] * (d2lnLidlz2 - dlnLidlz * dlnLidlz);
2961 }
2962
2963 *ext_dlnLdlz = dlnLdlz;
2964 *ext_d2lnLdlz2 = d2lnLdlz2;
2965 }
2966
2967
2968
2969 static void coreGTRGAMMAPROTcxx . . $ coreGTRGAMMAPROT(51b4f202b4cc753d).(double *gammaRates, double *EIGN, double *sumtable, int upper, int *wrptr,
2970 volatile double *ext_dlnLdlz, volatile double *ext_d2lnLdlz2, double lz)
2971 {
2972 double *sum;
2973 PLL_ALIGN_BEGINcxx . . $ `pll/pll.h:101:10`! double
2974 diagptable0[80] PLL_ALIGN_ENDcxx . . $ `pll/pll.h:102:10`!,
2975 diagptable1[80] PLL_ALIGN_ENDcxx . . $ `pll/pll.h:102:10`!,
2976 diagptable2[80] PLL_ALIGN_ENDcxx . . $ `pll/pll.h:102:10`!;
2977
2978 int i, j, l;
2979 double dlnLdlz = 0;
2980 double d2lnLdlz2 = 0;
2981 double ki, kisqr;
2982 double inv_Li, dlnLidlz, d2lnLidlz2;
2983
2984 for(i = 0; i < 4; i++)
2985 {
2986 ki = gammaRates[i];
2987 kisqr = ki * ki;
2988
2989 diagptable0[i * 20] = 1.0;
2990 diagptable1[i * 20] = 0.0;
2991 diagptable2[i * 20] = 0.0;
2992
2993 for(l = 1; l < 20; l++)
2994 {
2995 diagptable0[i * 20 + l] = exp(EIGN[l] * ki * lz);
2996 diagptable1[i * 20 + l] = EIGN[l] * ki;
2997 diagptable2[i * 20 + l] = EIGN[l] * EIGN[l] * kisqr;
2998 }
2999 }
3000
3001 for (i = 0; i < upper; i++)
3002 {
3003 __m128dcxx . . $ __m128d# a0 = _mm_setzero_pdcxx . . $ _mm_setzero_pd(647fa700b46b5d24).();
3004 __m128dcxx . . $ __m128d# a1 = _mm_setzero_pdcxx . . $ _mm_setzero_pd(647fa700b46b5d24).();
3005 __m128dcxx . . $ __m128d# a2 = _mm_setzero_pdcxx . . $ _mm_setzero_pd(647fa700b46b5d24).();
3006
3007 sum = &sumtable[i * 80];
3008
3009 for(j = 0; j < 4; j++)
3010 {
3011 double
3012 *d0 = &diagptable0[j * 20],
3013 *d1 = &diagptable1[j * 20],
3014 *d2 = &diagptable2[j * 20];
3015
3016 for(l = 0; l < 20; l+=2)
3017 {
3018 __m128dcxx . . $ __m128d# tmpv = _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&d0[l]), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&sum[j * 20 +l]));
3019 a0 = _mm_add_pdcxx . . $ _mm_add_pd(a27da52cef7cc9d8).(a0, tmpv);
3020 a1 = _mm_add_pdcxx . . $ _mm_add_pd(a27da52cef7cc9d8).(a1, _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(tmpv, _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&d1[l])));
3021 a2 = _mm_add_pdcxx . . $ _mm_add_pd(a27da52cef7cc9d8).(a2, _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(tmpv, _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&d2[l])));
3022 }
3023 }
3024
3025 a0 = _mm_hadd_pdcxx . . $ _mm_hadd_pd(a27da52cef7cc9d8).(a0, a0);
3026 a1 = _mm_hadd_pdcxx . . $ _mm_hadd_pd(a27da52cef7cc9d8).(a1, a1);
3027 a2 = _mm_hadd_pdcxx . . $ _mm_hadd_pd(a27da52cef7cc9d8).(a2, a2);
3028
3029 _mm_storel_pdcxx . . $ _mm_storel_pd(bcb7fe46c030add4).(&inv_Li, a0);
3030 _mm_storel_pdcxx . . $ _mm_storel_pd(bcb7fe46c030add4).(&dlnLidlz, a1);
3031 _mm_storel_pdcxx . . $ _mm_storel_pd(bcb7fe46c030add4).(&d2lnLidlz2, a2);
3032
3033 inv_Li = 1.0 / fabs (inv_Li);
3034
3035 dlnLidlz *= inv_Li;
3036 d2lnLidlz2 *= inv_Li;
3037
3038 dlnLdlz += wrptr[i] * dlnLidlz;
3039 d2lnLdlz2 += wrptr[i] * (d2lnLidlz2 - dlnLidlz * dlnLidlz);
3040 }
3041
3042 *ext_dlnLdlz = dlnLdlz;
3043 *ext_d2lnLdlz2 = d2lnLdlz2;
3044 }
3045
3046
3047
3048 static void coreGTRCATPROTcxx . . $ coreGTRCATPROT(7a64fe835b18a73f).(double *EIGN, double lz, int numberOfCategories, double *rptr, int *cptr, int upper,
3049 int *wgt, volatile double *ext_dlnLdlz, volatile double *ext_d2lnLdlz2, double *sumtable)
3050 {
3051 int i, l;
3052 double *d1, *d_start = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, *sum;
3053 PLL_ALIGN_BEGINcxx . . $ `pll/pll.h:101:10`! double
3054 e[20] PLL_ALIGN_ENDcxx . . $ `pll/pll.h:102:10`!,
3055 s[20] PLL_ALIGN_ENDcxx . . $ `pll/pll.h:102:10`!,
3056 dd[20] PLL_ALIGN_ENDcxx . . $ `pll/pll.h:102:10`!;
3057 double inv_Li, dlnLidlz, d2lnLidlz2;
3058 double dlnLdlz = 0.0;
3059 double d2lnLdlz2 = 0.0;
3060
3061 rax_posix_memaligncxx . . $ `pll/mem_alloc.h:37:13`! ((void **)&d_start, PLL_BYTE_ALIGNMENTcxx . . $ `pll/pll.h:89:9`!, numberOfCategories * 20 * sizeof(double));
3062 d1 = d_start;
3063
3064 e[0] = 0.0;
3065 s[0] = 0.0;
3066
3067 for(l = 1; l < 20; l++)
3068 {
3069 e[l] = EIGN[l] * EIGN[l];
3070 s[l] = EIGN[l];
3071 dd[l] = s[l] * lz;
3072 }
3073
3074 for(i = 0; i < numberOfCategories; i++)
3075 {
3076 d1[20 * i] = 1.0;
3077 for(l = 1; l < 20; l++)
3078 d1[20 * i + l] = exp(dd[l] * rptr[i]);
3079 }
3080
3081 for (i = 0; i < upper; i++)
3082 {
3083 __m128dcxx . . $ __m128d# a0 = _mm_setzero_pdcxx . . $ _mm_setzero_pd(647fa700b46b5d24).();
3084 __m128dcxx . . $ __m128d# a1 = _mm_setzero_pdcxx . . $ _mm_setzero_pd(647fa700b46b5d24).();
3085 __m128dcxx . . $ __m128d# a2 = _mm_setzero_pdcxx . . $ _mm_setzero_pd(647fa700b46b5d24).();
3086
3087 d1 = &d_start[20 * cptr[i]];
3088 sum = &sumtable[20 * i];
3089
3090 for(l = 0; l < 20; l+=2)
3091 {
3092 __m128dcxx . . $ __m128d# tmpv = _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(_mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&d1[l]), _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&sum[l]));
3093
3094 a0 = _mm_add_pdcxx . . $ _mm_add_pd(a27da52cef7cc9d8).(a0, tmpv);
3095 __m128dcxx . . $ __m128d# sv = _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&s[l]);
3096
3097 a1 = _mm_add_pdcxx . . $ _mm_add_pd(a27da52cef7cc9d8).(a1, _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(tmpv, sv));
3098 __m128dcxx . . $ __m128d# ev = _mm_load_pdcxx . . $ _mm_load_pd(21ef2617b20ace4d).(&e[l]);
3099
3100 a2 = _mm_add_pdcxx . . $ _mm_add_pd(a27da52cef7cc9d8).(a2, _mm_mul_pdcxx . . $ _mm_mul_pd(a27da52cef7cc9d8).(tmpv, ev));
3101 }
3102
3103 a0 = _mm_hadd_pdcxx . . $ _mm_hadd_pd(a27da52cef7cc9d8).(a0, a0);
3104 a1 = _mm_hadd_pdcxx . . $ _mm_hadd_pd(a27da52cef7cc9d8).(a1, a1);
3105 a2 = _mm_hadd_pdcxx . . $ _mm_hadd_pd(a27da52cef7cc9d8).(a2, a2);
3106
3107 _mm_storel_pdcxx . . $ _mm_storel_pd(bcb7fe46c030add4).(&inv_Li, a0);
3108 _mm_storel_pdcxx . . $ _mm_storel_pd(bcb7fe46c030add4).(&dlnLidlz, a1);
3109 _mm_storel_pdcxx . . $ _mm_storel_pd(bcb7fe46c030add4).(&d2lnLidlz2, a2);
3110
3111 inv_Li = 1.0 / fabs (inv_Li);
3112
3113 dlnLidlz *= inv_Li;
3114 d2lnLidlz2 *= inv_Li;
3115
3116 dlnLdlz += wgt[i] * rptr[cptr[i]] * dlnLidlz;
3117 d2lnLdlz2 += wgt[i] * rptr[cptr[i]] * rptr[cptr[i]] * (d2lnLidlz2 - dlnLidlz * dlnLidlz);
3118 }
3119
3120 *ext_dlnLdlz = dlnLdlz;
3121 *ext_d2lnLdlz2 = d2lnLdlz2;
3122
3123 rax_freecxx . . $ `pll/mem_alloc.h:40:13`!(d_start);
3124 }
3125
3126
3127
3128
3129 #endif
3130
3131
3132