/usr/include/libpll/pll.h is in libpll-dev 0.3.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 | /*
Copyright (C) 2015 Tomas Flouri, Diego Darriba
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Contact: Tomas Flouri <Tomas.Flouri@h-its.org>,
Exelixis Lab, Heidelberg Instutute for Theoretical Studies
Schloss-Wolfsbrunnenweg 35, D-69118 Heidelberg, Germany
*/
#ifndef PLL_H
#define PLL_H
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <ctype.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#if (!defined(__clang__) && defined(__GNUC__) && (__GNUC__ < 4 || \
(__GNUC__ == 4 && __GNUC_MINOR__ < 7)))
#if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6))
#if (defined(HAVE_AVX2))
#error "GCC 4.6.x. Please run ./configure --disable-avx2"
#endif
#else
#if (defined(HAVE_AVX2) || defined(HAVE_AVX))
#error "GCC < 4.6. Please run ./configure --disable-avx --disable-avx2"
#endif
#endif
#endif
#ifdef HAVE_X86INTRIN_H
#include <x86intrin.h>
#endif
/* platform specific */
#if (!defined(__APPLE__) && !defined(__WIN32__) && !defined(__WIN64__))
#include <sys/sysinfo.h>
#endif
#if (defined(__WIN32__) || defined(__WIN64__))
#define PLL_EXPORT __declspec(dllexport)
#else
#define PLL_EXPORT
#endif
/* macros */
#define PLL_MIN(a,b) ((a) < (b) ? (a) : (b))
#define PLL_MAX(a,b) ((a) > (b) ? (a) : (b))
#define PLL_SWAP(x,y) do { __typeof__ (x) _t = x; x = y; y = _t; } while(0)
#define PLL_STAT(x) ((pll_hardware.init || pll_hardware_probe()) \
&& pll_hardware.x)
/* constants */
#define PLL_FAILURE 0
#define PLL_SUCCESS 1
#define PLL_FALSE 0
#define PLL_TRUE 1
#define PLL_ALIGNMENT_CPU 8
#define PLL_ALIGNMENT_SSE 16
#define PLL_ALIGNMENT_AVX 32
#define PLL_LINEALLOC 2048
#define PLL_ASCII_SIZE 256
#define PLL_SCALE_FACTOR 115792089237316195423570985008687907853269984665640564039457584007913129639936.0 /* 2**256 (exactly) */
#define PLL_SCALE_THRESHOLD (1.0/PLL_SCALE_FACTOR)
#define PLL_SCALE_FACTOR_SQRT 340282366920938463463374607431768211456.0 /* 2**128 */
#define PLL_SCALE_THRESHOLD_SQRT (1.0/PLL_SCALE_FACTOR_SQRT)
#define PLL_SCALE_BUFFER_NONE -1
/* in per-rate scaling mode, maximum difference between scalers
* please see https://github.com/xflouris/libpll/issues/44 */
#define PLL_SCALE_RATE_MAXDIFF 4
#define PLL_MISC_EPSILON 1e-8
#define PLL_ONE_EPSILON 1e-15
#define PLL_ONE_MIN (1-PLL_ONE_EPSILON)
#define PLL_ONE_MAX (1+PLL_ONE_EPSILON)
/* attribute flags */
#define PLL_ATTRIB_ARCH_CPU 0
#define PLL_ATTRIB_ARCH_SSE (1 << 0)
#define PLL_ATTRIB_ARCH_AVX (1 << 1)
#define PLL_ATTRIB_ARCH_AVX2 (1 << 2)
#define PLL_ATTRIB_ARCH_AVX512 (1 << 3)
#define PLL_ATTRIB_ARCH_MASK 0xF
#define PLL_ATTRIB_PATTERN_TIP (1 << 4)
/* ascertainment bias correction */
#define PLL_ATTRIB_AB_LEWIS (1 << 5)
#define PLL_ATTRIB_AB_FELSENSTEIN (2 << 5)
#define PLL_ATTRIB_AB_STAMATAKIS (3 << 5)
#define PLL_ATTRIB_AB_MASK (7 << 5)
#define PLL_ATTRIB_AB_FLAG (1 << 8)
#define PLL_ATTRIB_RATE_SCALERS (1 << 9)
/* topological rearrangements */
#define PLL_UTREE_MOVE_SPR 1
#define PLL_UTREE_MOVE_NNI 2
#define PLL_UTREE_MOVE_NNI_LEFT 1
#define PLL_UTREE_MOVE_NNI_RIGHT 2
#define PLL_TREE_TRAVERSE_POSTORDER 1
#define PLL_TREE_TRAVERSE_PREORDER 2
/* error codes */
#define PLL_ERROR_FILE_OPEN 100
#define PLL_ERROR_FILE_SEEK 101
#define PLL_ERROR_FILE_EOF 102
#define PLL_ERROR_FASTA_ILLEGALCHAR 103
#define PLL_ERROR_FASTA_UNPRINTABLECHAR 104
#define PLL_ERROR_FASTA_INVALIDHEADER 105
#define PLL_ERROR_PHYLIP_SYNTAX 106
#define PLL_ERROR_PHYLIP_LONGSEQ 107
#define PLL_ERROR_PHYLIP_NONALIGNED 108
#define PLL_ERROR_PHYLIP_ILLEGALCHAR 109
#define PLL_ERROR_PHYLIP_UNPRINTABLECHAR 110
#define PLL_ERROR_NEWICK_SYNTAX 111
#define PLL_ERROR_MEM_ALLOC 112
#define PLL_ERROR_PARAM_INVALID 113
#define PLL_ERROR_TIPDATA_ILLEGALSTATE 114
#define PLL_ERROR_TIPDATA_ILLEGALFUNCTION 115
#define PLL_ERROR_TREE_CONVERSION 116
#define PLL_ERROR_INVAR_INCOMPAT 117
#define PLL_ERROR_INVAR_PROPORTION 118
#define PLL_ERROR_INVAR_PARAMINDEX 119
#define PLL_ERROR_INVAR_NONEFOUND 120
#define PLL_ERROR_AB_INVALIDMETHOD 121
#define PLL_ERROR_AB_NOSUPPORT 122
#define PLL_ERROR_SPR_TERMINALBRANCH 123
#define PLL_ERROR_SPR_NOCHANGE 124
#define PLL_ERROR_NNI_INVALIDMOVE 125
#define PLL_ERROR_NNI_TERMINALBRANCH 126
#define PLL_ERROR_STEPWISE_STRUCT 127
#define PLL_ERROR_STEPWISE_TIPS 128
#define PLL_ERROR_STEPWISE_UNSUPPORTED 129
#define PLL_ERROR_EINVAL 130
/* utree specific */
#define PLL_UTREE_SHOW_LABEL (1 << 0)
#define PLL_UTREE_SHOW_BRANCH_LENGTH (1 << 1)
#define PLL_UTREE_SHOW_CLV_INDEX (1 << 2)
#define PLL_UTREE_SHOW_SCALER_INDEX (1 << 3)
#define PLL_UTREE_SHOW_PMATRIX_INDEX (1 << 4)
/* GAMMA discretization modes */
#define PLL_GAMMA_RATES_MEAN 0
#define PLL_GAMMA_RATES_MEDIAN 1
/* structures and data types */
typedef struct pll_hardware_s
{
int init;
/* cpu features */
int altivec_present;
int mmx_present;
int sse_present;
int sse2_present;
int sse3_present;
int ssse3_present;
int sse41_present;
int sse42_present;
int popcnt_present;
int avx_present;
int avx2_present;
/* TODO: add chip,core,mem info */
} pll_hardware_t;
typedef struct pll_partition
{
unsigned int tips;
unsigned int clv_buffers;
unsigned int states;
unsigned int sites;
unsigned int pattern_weight_sum;
unsigned int rate_matrices;
unsigned int prob_matrices;
unsigned int rate_cats;
unsigned int scale_buffers;
unsigned int attributes;
const unsigned int * map;
/* vectorization options */
size_t alignment;
unsigned int states_padded;
double ** clv;
double ** pmatrix;
double * rates;
double * rate_weights;
double ** subst_params;
unsigned int ** scale_buffer;
double ** frequencies;
double * prop_invar;
int * invariant;
unsigned int * pattern_weights;
int * eigen_decomp_valid;
double ** eigenvecs;
double ** inv_eigenvecs;
double ** eigenvals;
/* tip-tip precomputation data */
unsigned int maxstates;
unsigned char ** tipchars;
unsigned char * charmap;
double * ttlookup;
unsigned int * tipmap;
/* ascertainment bias correction */
int asc_bias_alloc;
} pll_partition_t;
/* Structure for driving likelihood operations */
typedef struct pll_operation
{
unsigned int parent_clv_index;
int parent_scaler_index;
unsigned int child1_clv_index;
unsigned int child1_matrix_index;
int child1_scaler_index;
unsigned int child2_clv_index;
unsigned int child2_matrix_index;
int child2_scaler_index;
} pll_operation_t;
/* Doubly-linked list */
typedef struct pll_dlist
{
struct pll_dlist * next;
struct pll_dlist * prev;
void * data;
} pll_dlist_t;
/* multiple sequence alignment */
typedef struct pll_msa_s
{
int count;
int length;
char ** sequence;
char ** label;
} pll_msa_t;
/* Simple structure for handling FASTA parsing */
typedef struct pll_fasta
{
FILE * fp;
char line[PLL_LINEALLOC];
const unsigned int * chrstatus;
long no;
long filesize;
long lineno;
long stripped_count;
long stripped[256];
} pll_fasta_t;
/* Simple structure for handling PHYLIP parsing */
typedef struct pll_phylip_s
{
FILE * fp;
char * line;
size_t line_size;
size_t line_maxsize;
char buffer[PLL_LINEALLOC];
const unsigned int * chrstatus;
long no;
long filesize;
long lineno;
long stripped_count;
long stripped[256];
} pll_phylip_t;
/* Simple unrooted and rooted tree structure for parsing newick */
typedef struct pll_unode_s
{
char * label;
double length;
unsigned int node_index;
unsigned int clv_index;
int scaler_index;
unsigned int pmatrix_index;
struct pll_unode_s * next;
struct pll_unode_s * back;
void * data;
} pll_unode_t;
typedef struct pll_utree_s
{
unsigned int tip_count;
unsigned int inner_count;
unsigned int edge_count;
pll_unode_t ** nodes;
} pll_utree_t;
typedef struct pll_rnode_s
{
char * label;
double length;
unsigned int node_index;
unsigned int clv_index;
int scaler_index;
unsigned int pmatrix_index;
struct pll_rnode_s * left;
struct pll_rnode_s * right;
struct pll_rnode_s * parent;
void * data;
} pll_rnode_t;
typedef struct pll_rtree_s
{
unsigned int tip_count;
unsigned int inner_count;
unsigned int edge_count;
pll_rnode_t ** nodes;
pll_rnode_t * root;
} pll_rtree_t;
/* structures for handling topological rearrangement move rollbacks */
typedef struct pll_utree_rb_s
{
int move_type;
union
{
struct
{
pll_unode_t * p;
pll_unode_t * r;
pll_unode_t * rb;
pll_unode_t * pnb;
pll_unode_t * pnnb;
double r_len;
double pnb_len;
double pnnb_len;
} spr;
struct
{
pll_unode_t * p;
int nni_type;
} nni;
};
} pll_utree_rb_t;
/* structures for parsimony */
typedef struct pll_parsimony_s
{
/* common information */
unsigned int tips;
unsigned int inner_nodes;
unsigned int sites;
unsigned int states;
unsigned int attributes;
size_t alignment;
/* fast unweighted parsimony */
unsigned int ** packedvector;
unsigned int * node_cost;
unsigned int packedvector_count;
unsigned int const_cost;
int * informative;
unsigned int informative_count;
/* weighted parsimony */
unsigned int score_buffers;
unsigned int ancestral_buffers;
double * score_matrix;
double ** sbuffer;
unsigned int ** anc_states;
} pll_parsimony_t;
typedef struct pll_pars_buildop_s
{
unsigned int parent_score_index;
unsigned int child1_score_index;
unsigned int child2_score_index;
} pll_pars_buildop_t;
typedef struct pll_pars_recop_s
{
unsigned int node_score_index;
unsigned int node_ancestral_index;
unsigned int parent_score_index;
unsigned int parent_ancestral_index;
} pll_pars_recop_t;
/* structures for SVG visualization */
typedef struct pll_svg_attrib_s
{
int precision;
long width;
long font_size;
long tip_spacing;
long stroke_width;
long legend_show;
long legend_spacing;
long margin_left;
long margin_right;
long margin_bottom;
long margin_top;
long node_radius;
double legend_ratio;
} pll_svg_attrib_t;
/* Reentrant versions of the `random' family of functions.
These functions all use the following data structure to contain
state, rather than global state variables. Taken and modified from
glibc 2.23 */
struct pll_random_data
{
int32_t *fptr; /* Front pointer. */
int32_t *rptr; /* Rear pointer. */
int32_t *state; /* Array of state values. */
int rand_type; /* Type of random number generator. */
int rand_deg; /* Degree of random number generator. */
int rand_sep; /* Distance between front and rear. */
int32_t *end_ptr; /* Pointer behind state table. */
};
/* common data */
PLL_EXPORT extern __thread int pll_errno;
PLL_EXPORT extern __thread char pll_errmsg[200];
PLL_EXPORT extern pll_hardware_t pll_hardware;
PLL_EXPORT extern const unsigned int pll_map_bin[256];
PLL_EXPORT extern const unsigned int pll_map_nt[256];
PLL_EXPORT extern const unsigned int pll_map_aa[256];
PLL_EXPORT extern const unsigned int pll_map_fasta[256];
PLL_EXPORT extern const unsigned int pll_map_phylip[256];
PLL_EXPORT extern const double pll_aa_rates_dayhoff[190];
PLL_EXPORT extern const double pll_aa_rates_lg[190];
PLL_EXPORT extern const double pll_aa_rates_dcmut[190];
PLL_EXPORT extern const double pll_aa_rates_jtt[190];
PLL_EXPORT extern const double pll_aa_rates_mtrev[190];
PLL_EXPORT extern const double pll_aa_rates_wag[190];
PLL_EXPORT extern const double pll_aa_rates_rtrev[190];
PLL_EXPORT extern const double pll_aa_rates_cprev[190];
PLL_EXPORT extern const double pll_aa_rates_vt[190];
PLL_EXPORT extern const double pll_aa_rates_blosum62[190];
PLL_EXPORT extern const double pll_aa_rates_mtmam[190];
PLL_EXPORT extern const double pll_aa_rates_mtart[190];
PLL_EXPORT extern const double pll_aa_rates_mtzoa[190];
PLL_EXPORT extern const double pll_aa_rates_pmb[190];
PLL_EXPORT extern const double pll_aa_rates_hivb[190];
PLL_EXPORT extern const double pll_aa_rates_hivw[190];
PLL_EXPORT extern const double pll_aa_rates_jttdcmut[190];
PLL_EXPORT extern const double pll_aa_rates_flu[190];
PLL_EXPORT extern const double pll_aa_rates_stmtrev[190];
PLL_EXPORT extern const double pll_aa_rates_lg4m[4][190];
PLL_EXPORT extern const double pll_aa_rates_lg4x[4][190];
PLL_EXPORT extern const double pll_aa_freqs_dayhoff[20];
PLL_EXPORT extern const double pll_aa_freqs_lg[20];
PLL_EXPORT extern const double pll_aa_freqs_dcmut[20];
PLL_EXPORT extern const double pll_aa_freqs_jtt[20];
PLL_EXPORT extern const double pll_aa_freqs_mtrev[20];
PLL_EXPORT extern const double pll_aa_freqs_wag[20];
PLL_EXPORT extern const double pll_aa_freqs_rtrev[20];
PLL_EXPORT extern const double pll_aa_freqs_cprev[20];
PLL_EXPORT extern const double pll_aa_freqs_vt[20];
PLL_EXPORT extern const double pll_aa_freqs_blosum62[20];
PLL_EXPORT extern const double pll_aa_freqs_mtmam[20];
PLL_EXPORT extern const double pll_aa_freqs_mtart[20];
PLL_EXPORT extern const double pll_aa_freqs_mtzoa[20];
PLL_EXPORT extern const double pll_aa_freqs_pmb[20];
PLL_EXPORT extern const double pll_aa_freqs_hivb[20];
PLL_EXPORT extern const double pll_aa_freqs_hivw[20];
PLL_EXPORT extern const double pll_aa_freqs_jttdcmut[20];
PLL_EXPORT extern const double pll_aa_freqs_flu[20];
PLL_EXPORT extern const double pll_aa_freqs_stmtrev[20];
PLL_EXPORT extern const double pll_aa_freqs_lg4m[4][20];
PLL_EXPORT extern const double pll_aa_freqs_lg4x[4][20];
#ifdef __cplusplus
extern "C" {
#endif
/* functions in pll.c */
PLL_EXPORT pll_partition_t * pll_partition_create(unsigned int tips,
unsigned int clv_buffers,
unsigned int states,
unsigned int sites,
unsigned int rate_matrices,
unsigned int prob_matrices,
unsigned int rate_cats,
unsigned int scale_buffers,
unsigned int attributes);
PLL_EXPORT void pll_partition_destroy(pll_partition_t * partition);
PLL_EXPORT int pll_set_tip_states(pll_partition_t * partition,
unsigned int tip_index,
const unsigned int * map,
const char * sequence);
PLL_EXPORT int pll_set_tip_clv(pll_partition_t * partition,
unsigned int tip_index,
const double * clv,
int padding);
PLL_EXPORT void pll_set_pattern_weights(pll_partition_t * partition,
const unsigned int * pattern_weights);
PLL_EXPORT int pll_set_asc_bias_type(pll_partition_t * partition,
int asc_bias_type);
PLL_EXPORT void pll_set_asc_state_weights(pll_partition_t * partition,
const unsigned int * state_weights);
/* functions in list.c */
PLL_EXPORT int pll_dlist_append(pll_dlist_t ** dlist, void * data);
PLL_EXPORT int pll_dlist_remove(pll_dlist_t ** dlist, void * data);
PLL_EXPORT int pll_dlist_prepend(pll_dlist_t ** dlist, void * data);
/* functions in models.c */
PLL_EXPORT void pll_set_subst_params(pll_partition_t * partition,
unsigned int params_index,
const double * params);
PLL_EXPORT void pll_set_frequencies(pll_partition_t * partition,
unsigned int params_index,
const double * frequencies);
PLL_EXPORT void pll_set_category_rates(pll_partition_t * partition,
const double * rates);
PLL_EXPORT void pll_set_category_weights(pll_partition_t * partition,
const double * rate_weights);
PLL_EXPORT int pll_update_eigen(pll_partition_t * partition,
unsigned int params_index);
PLL_EXPORT int pll_update_prob_matrices(pll_partition_t * partition,
const unsigned int * params_index,
const unsigned int * matrix_indices,
const double * branch_lengths,
unsigned int count);
PLL_EXPORT unsigned int pll_count_invariant_sites(pll_partition_t * partition,
unsigned int * state_inv_count);
PLL_EXPORT int pll_update_invariant_sites(pll_partition_t * partition);
PLL_EXPORT int pll_update_invariant_sites_proportion(pll_partition_t * partition,
unsigned int params_index,
double prop_invar);
PLL_EXPORT void * pll_aligned_alloc(size_t size, size_t alignment);
PLL_EXPORT void pll_aligned_free(void * ptr);
/* functions in likelihood.c */
PLL_EXPORT double pll_compute_root_loglikelihood(pll_partition_t * partition,
unsigned int clv_index,
int scaler_index,
const unsigned int * freqs_indices,
double * persite_lnl);
PLL_EXPORT double pll_compute_edge_loglikelihood(pll_partition_t * partition,
unsigned int parent_clv_index,
int parent_scaler_index,
unsigned int child_clv_index,
int child_scaler_index,
unsigned int matrix_index,
const unsigned int * freqs_indices,
double * persite_lnl);
/* functions in partials.c */
PLL_EXPORT void pll_update_partials(pll_partition_t * partition,
const pll_operation_t * operations,
unsigned int count);
/* functions in derivatives.c */
PLL_EXPORT int pll_update_sumtable(pll_partition_t * partition,
unsigned int parent_clv_index,
unsigned int child_clv_index,
int parent_scaler_index,
int child_scaler_index,
const unsigned int * params_indices,
double *sumtable);
PLL_EXPORT int pll_compute_likelihood_derivatives(pll_partition_t * partition,
int parent_scaler_index,
int child_scaler_index,
double branch_length,
const unsigned int * params_indices,
const double * sumtable,
double * d_f,
double * dd_f);
/* functions in gamma.c */
PLL_EXPORT int pll_compute_gamma_cats(double alpha,
unsigned int categories,
double * output_rates,
int rates_mode);
/* functions in output.c */
PLL_EXPORT void pll_show_pmatrix(const pll_partition_t * partition,
unsigned int index,
unsigned int float_precision);
PLL_EXPORT void pll_show_clv(const pll_partition_t * partition,
unsigned int clv_index,
int scaler_index,
unsigned int float_precision);
/* functions in fasta.c */
PLL_EXPORT pll_fasta_t * pll_fasta_open(const char * filename,
const unsigned int * map);
PLL_EXPORT int pll_fasta_getnext(pll_fasta_t * fd, char ** head,
long * head_len, char ** seq,
long * seq_len, long * seqno);
PLL_EXPORT void pll_fasta_close(pll_fasta_t * fd);
PLL_EXPORT long pll_fasta_getfilesize(const pll_fasta_t * fd);
PLL_EXPORT long pll_fasta_getfilepos(pll_fasta_t * fd);
PLL_EXPORT int pll_fasta_rewind(pll_fasta_t * fd);
/* functions in parse_rtree.y */
PLL_EXPORT pll_rtree_t * pll_rtree_parse_newick(const char * filename);
PLL_EXPORT pll_rtree_t * pll_rtree_parse_newick_string(const char * s);
PLL_EXPORT void pll_rtree_destroy(pll_rtree_t * root,
void (*cb_destroy)(void *));
PLL_EXPORT void pll_rtree_reset_template_indices(pll_rnode_t * node,
unsigned int tip_count);
PLL_EXPORT void pll_rtree_graph_destroy(pll_rnode_t * root,
void (*cb_destroy)(void *));
PLL_EXPORT pll_rtree_t * pll_rtree_wraptree(pll_rnode_t * root,
unsigned int tip_count);
/* functions in parse_utree.y */
PLL_EXPORT pll_utree_t * pll_utree_parse_newick(const char * filename);
PLL_EXPORT pll_utree_t * pll_utree_parse_newick_string(const char * s);
PLL_EXPORT void pll_utree_destroy(pll_utree_t * tree,
void (*cb_destroy)(void *));
PLL_EXPORT void pll_utree_reset_template_indices(pll_unode_t * node,
unsigned int tip_count);
PLL_EXPORT void pll_utree_graph_destroy(pll_unode_t * root,
void (*cb_destroy)(void *));
PLL_EXPORT pll_utree_t * pll_utree_wraptree(pll_unode_t * root,
unsigned int tip_count);
/* functions in utree.c */
PLL_EXPORT void pll_utree_show_ascii(const pll_unode_t * tree, int options);
PLL_EXPORT char * pll_utree_export_newick(const pll_unode_t * root,
char * (*cb_serialize)(const pll_unode_t *));
PLL_EXPORT int pll_utree_traverse(pll_unode_t * root,
int traversal,
int (*cbtrav)(pll_unode_t *),
pll_unode_t ** outbuffer,
unsigned int * trav_size);
#if 0
PLL_EXPORT unsigned int pll_utree_query_tipnodes(pll_utree_t * root,
pll_utree_t ** node_list);
PLL_EXPORT unsigned int pll_utree_query_innernodes(pll_utree_t * root,
pll_utree_t ** node_list);
#endif
PLL_EXPORT void pll_utree_create_operations(pll_unode_t * const* trav_buffer,
unsigned int trav_buffer_size,
double * branches,
unsigned int * pmatrix_indices,
pll_operation_t * ops,
unsigned int * matrix_count,
unsigned int * ops_count);
PLL_EXPORT int pll_utree_check_integrity(const pll_utree_t * root);
PLL_EXPORT pll_unode_t * pll_utree_graph_clone(const pll_unode_t * root);
PLL_EXPORT pll_utree_t * pll_utree_clone(const pll_utree_t * root);
PLL_EXPORT pll_utree_t * pll_rtree_unroot(pll_rtree_t * tree);
PLL_EXPORT int pll_utree_every(pll_utree_t * tree,
int (*cb)(pll_unode_t *));
PLL_EXPORT int pll_utree_every_const(const pll_utree_t * tree,
int (*cb)(const pll_unode_t *));
PLL_EXPORT void pll_utree_create_pars_buildops(pll_unode_t * const* trav_buffer,
unsigned int trav_buffer_size,
pll_pars_buildop_t * ops,
unsigned int * ops_count);
/* functions in phylip.c */
PLL_EXPORT void pll_msa_destroy(pll_msa_t * msa);
PLL_EXPORT pll_phylip_t * pll_phylip_open(const char * filename,
const unsigned int * map);
PLL_EXPORT int pll_phylip_rewind(pll_phylip_t * fd);
PLL_EXPORT void pll_phylip_close(pll_phylip_t * fd);
PLL_EXPORT pll_msa_t * pll_phylip_parse_interleaved(pll_phylip_t * fd);
PLL_EXPORT pll_msa_t * pll_phylip_parse_sequential(pll_phylip_t * fd);
/* functions in rtree.c */
PLL_EXPORT void pll_rtree_show_ascii(const pll_rnode_t * root, int options);
PLL_EXPORT char * pll_rtree_export_newick(const pll_rnode_t * root,
char * (*cb_serialize)(const pll_rnode_t *));
PLL_EXPORT int pll_rtree_traverse(pll_rnode_t * root,
int traversal,
int (*cbtrav)(pll_rnode_t *),
pll_rnode_t ** outbuffer,
unsigned int * trav_size);
#if 0
PLL_EXPORT unsigned int pll_rtree_query_tipnodes(pll_rtree_t * root,
pll_rtree_t ** node_list);
PLL_EXPORT unsigned int pll_rtree_query_innernodes(pll_rtree_t * root,
pll_rtree_t ** node_list);
#endif
PLL_EXPORT void pll_rtree_create_operations(pll_rnode_t * const* trav_buffer,
unsigned int trav_buffer_size,
double * branches,
unsigned int * pmatrix_indices,
pll_operation_t * ops,
unsigned int * matrix_count,
unsigned int * ops_count);
#if 0
PLL_EXPORT int pll_rtree_traverse_preorder(pll_rtree_t * root,
int (*cbtrav)(pll_rtree_t *),
pll_rtree_t ** outbuffer,
unsigned int * trav_size);
#endif
PLL_EXPORT void pll_rtree_create_pars_buildops(pll_rnode_t * const* trav_buffer,
unsigned int trav_buffer_size,
pll_pars_buildop_t * ops,
unsigned int * ops_count);
PLL_EXPORT void pll_rtree_create_pars_recops(pll_rnode_t * const* trav_buffer,
unsigned int trav_buffer_size,
pll_pars_recop_t * ops,
unsigned int * ops_count);
/* functions in core_partials.c */
PLL_EXPORT void pll_core_create_lookup(unsigned int states,
unsigned int rate_cats,
double * lookup,
const double * left_matrix,
const double * right_matrix,
const unsigned int * tipmap,
unsigned int tipmap_size,
unsigned int attrib);
PLL_EXPORT void pll_core_update_partial_tt(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
double * parent_clv,
unsigned int * parent_scaler,
const unsigned char * left_tipchars,
const unsigned char * right_tipchars,
const unsigned int * tipmap,
unsigned int tipmap_size,
const double * lookup,
unsigned int attrib);
PLL_EXPORT void pll_core_update_partial_ti(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
double * parent_clv,
unsigned int * parent_scaler,
const unsigned char * left_tipchars,
const double * right_clv,
const double * left_matrix,
const double * right_matrix,
const unsigned int * right_scaler,
const unsigned int * tipmap,
unsigned int tipmap_size,
unsigned int attrib);
PLL_EXPORT void pll_core_update_partial_ii(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
double * parent_clv,
unsigned int * parent_scaler,
const double * left_clv,
const double * right_clv,
const double * left_matrix,
const double * right_matrix,
const unsigned int * left_scaler,
const unsigned int * right_scaler,
unsigned int attrib);
PLL_EXPORT void pll_core_create_lookup_4x4(unsigned int rate_cats,
double * lookup,
const double * left_matrix,
const double * right_matrix);
PLL_EXPORT void pll_core_update_partial_tt_4x4(unsigned int sites,
unsigned int rate_cats,
double * parent_clv,
unsigned int * parent_scaler,
const unsigned char * left_tipchars,
const unsigned char * right_tipchars,
const double * lookup,
unsigned int attrib);
PLL_EXPORT void pll_core_update_partial_ti_4x4(unsigned int sites,
unsigned int rate_cats,
double * parent_clv,
unsigned int * parent_scaler,
const unsigned char * left_tipchars,
const double * right_clv,
const double * left_matrix,
const double * right_matrix,
const unsigned int * right_scaler,
unsigned int attrib);
/* functions in core_derivatives.c */
PLL_EXPORT int pll_core_update_sumtable_ti_4x4(unsigned int sites,
unsigned int rate_cats,
const double * parent_clv,
const unsigned char * left_tipchars,
const unsigned int * parent_scaler,
double * const * eigenvecs,
double * const * inv_eigenvecs,
double * const * freqs,
const unsigned int * tipmap,
double * sumtable,
unsigned int attrib);
PLL_EXPORT int pll_core_update_sumtable_ii(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
const double * parent_clv,
const double * child_clv,
const unsigned int * parent_scaler,
const unsigned int * child_scaler,
double * const * eigenvecs,
double * const * inv_eigenvecs,
double * const * freqs,
double * sumtable,
unsigned int attrib);
PLL_EXPORT int pll_core_update_sumtable_ti(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
const double * parent_clv,
const unsigned char * left_tipchars,
const unsigned int * parent_scaler,
double * const * eigenvecs,
double * const * inv_eigenvecs,
double * const * freqs,
const unsigned int * tipmap,
unsigned int tipmap_size,
double * sumtable,
unsigned int attrib);
PLL_EXPORT int pll_core_likelihood_derivatives(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
const double * rate_weights,
const unsigned int * parent_scaler,
const unsigned int * child_scaler,
const int * invariant,
const unsigned int * pattern_weights,
double branch_length,
const double * prop_invar,
double * const * freqs,
const double * rates,
double * const * eigenvals,
const double * sumtable,
double * d_f,
double * dd_f,
unsigned int attrib);
/* functions in core_likelihood.c */
PLL_EXPORT double pll_core_edge_loglikelihood_ii(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
const double * parent_clv,
const unsigned int * parent_scaler,
const double * child_clv,
const unsigned int * child_scaler,
const double * pmatrix,
double * const * frequencies,
const double * rate_weights,
const unsigned int * pattern_weights,
const double * invar_proportion,
const int * invar_indices,
const unsigned int * freqs_indices,
double * persite_lnl,
unsigned int attrib);
PLL_EXPORT double pll_core_edge_loglikelihood_ti(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
const double * parent_clv,
const unsigned int * parent_scaler,
const unsigned char * tipchars,
const unsigned int * tipmap,
unsigned int tipmap_size,
const double * pmatrix,
double * const * frequencies,
const double * rate_weights,
const unsigned int * pattern_weights,
const double * invar_proportion,
const int * invar_indices,
const unsigned int * freqs_indices,
double * persite_lnl,
unsigned int attrib);
PLL_EXPORT double pll_core_edge_loglikelihood_ti_4x4(unsigned int sites,
unsigned int rate_cats,
const double * parent_clv,
const unsigned int * parent_scaler,
const unsigned char * tipchars,
const double * pmatrix,
double * const * frequencies,
const double * rate_weights,
const unsigned int * pattern_weights,
const double * invar_proportion,
const int * invar_indices,
const unsigned int * freqs_indices,
double * persite_lnl,
unsigned int attrib);
PLL_EXPORT double pll_core_root_loglikelihood(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
const double * clv,
const unsigned int * scaler,
double * const * frequencies,
const double * rate_weights,
const unsigned int * pattern_weights,
const double * invar_proportion,
const int * invar_indices,
const unsigned int * freqs_indices,
double * persite_lnl,
unsigned int attrib);
/* functions in core_partials_sse.c */
#ifdef HAVE_SSE3
PLL_EXPORT void pll_core_create_lookup_sse(unsigned int states,
unsigned int rate_cats,
double * ttlookup,
const double * left_matrix,
const double * right_matrix,
const unsigned int * tipmap,
unsigned int tipmap_size);
PLL_EXPORT void pll_core_create_lookup_4x4_sse(unsigned int rate_cats,
double * lookup,
const double * left_matrix,
const double * right_matrix);
PLL_EXPORT void pll_core_update_partial_tt_sse(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
double * parent_clv,
unsigned int * parent_scaler,
const unsigned char * left_tipchars,
const unsigned char * right_tipchars,
const double * lookup,
unsigned int tipstates_count,
unsigned int attrib);
PLL_EXPORT void pll_core_update_partial_tt_4x4_sse(unsigned int sites,
unsigned int rate_cats,
double * parent_clv,
unsigned int * parent_scaler,
const unsigned char * left_tipchars,
const unsigned char * right_tipchars,
const double * lookup,
unsigned int attrib);
PLL_EXPORT void pll_core_update_partial_ti_sse(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
double * parent_clv,
unsigned int * parent_scaler,
const unsigned char * left_tipchars,
const double * right_clv,
const double * left_matrix,
const double * right_matrix,
const unsigned int * right_scaler,
const unsigned int * tipmap,
unsigned int tipmap_size,
unsigned int attrib);
PLL_EXPORT void pll_core_update_partial_ti_4x4_sse(unsigned int sites,
unsigned int rate_cats,
double * parent_clv,
unsigned int * parent_scaler,
const unsigned char * left_tipchar,
const double * right_clv,
const double * left_matrix,
const double * right_matrix,
const unsigned int * right_scaler,
unsigned int attrib);
PLL_EXPORT void pll_core_update_partial_ii_sse(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
double * parent_clv,
unsigned int * parent_scaler,
const double * left_clv,
const double * right_clv,
const double * left_matrix,
const double * right_matrix,
const unsigned int * left_scaler,
const unsigned int * right_scaler,
unsigned int attrib);
PLL_EXPORT void pll_core_update_partial_ii_4x4_sse(unsigned int sites,
unsigned int rate_cats,
double * parent_clv,
unsigned int * parent_scaler,
const double * left_clv,
const double * right_clv,
const double * left_matrix,
const double * right_matrix,
const unsigned int * left_scaler,
const unsigned int * right_scaler,
unsigned int attrib);
#endif
/* functions in core_partials_avx.c */
#ifdef HAVE_AVX
PLL_EXPORT void pll_core_create_lookup_avx(unsigned int states,
unsigned int rate_cats,
double * lookup,
const double * left_matrix,
const double * right_matrix,
const unsigned int * tipmap,
unsigned int tipmap_size);
PLL_EXPORT void pll_core_create_lookup_4x4_avx(unsigned int rate_cats,
double * lookup,
const double * left_matrix,
const double * right_matrix);
PLL_EXPORT void pll_core_create_lookup_20x20_avx(unsigned int rate_cats,
double * ttlookup,
const double * left_matrix,
const double * right_matrix,
const unsigned int * tipmap,
unsigned int tipmap_size);
PLL_EXPORT void pll_core_update_partial_tt_avx(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
double * parent_clv,
unsigned int * parent_scaler,
const unsigned char * left_tipchars,
const unsigned char * right_tipchars,
const double * lookup,
unsigned int tipstates_count,
unsigned int attrib);
PLL_EXPORT void pll_core_update_partial_tt_4x4_avx(unsigned int sites,
unsigned int rate_cats,
double * parent_clv,
unsigned int * parent_scaler,
const unsigned char * left_tipchars,
const unsigned char * right_tipchars,
const double * lookup,
unsigned int attrib);
PLL_EXPORT void pll_core_update_partial_ti_avx(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
double * parent_clv,
unsigned int * parent_scaler,
const unsigned char * left_tipchars,
const double * right_clv,
const double * left_matrix,
const double * right_matrix,
const unsigned int * right_scaler,
const unsigned int * tipmap,
unsigned int tipmap_size,
unsigned int attrib);
PLL_EXPORT void pll_core_update_partial_ti_4x4_avx(unsigned int sites,
unsigned int rate_cats,
double * parent_clv,
unsigned int * parent_scaler,
const unsigned char * left_tipchar,
const double * right_clv,
const double * left_matrix,
const double * right_matrix,
const unsigned int * right_scaler,
unsigned int attrib);
PLL_EXPORT void pll_core_update_partial_ti_20x20_avx(unsigned int sites,
unsigned int rate_cats,
double * parent_clv,
unsigned int * parent_scaler,
const unsigned char * left_tipchar,
const double * right_clv,
const double * left_matrix,
const double * right_matrix,
const unsigned int * right_scaler,
const unsigned int * tipmap,
unsigned int tipmap_size);
PLL_EXPORT void pll_core_update_partial_ii_avx(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
double * parent_clv,
unsigned int * parent_scaler,
const double * left_clv,
const double * right_clv,
const double * left_matrix,
const double * right_matrix,
const unsigned int * left_scaler,
const unsigned int * right_scaler,
unsigned int attrib);
PLL_EXPORT void pll_core_update_partial_ii_4x4_avx(unsigned int sites,
unsigned int rate_cats,
double * parent_clv,
unsigned int * parent_scaler,
const double * left_clv,
const double * right_clv,
const double * left_matrix,
const double * right_matrix,
const unsigned int * left_scaler,
const unsigned int * right_scaler,
unsigned int attrib);
#endif
/* functions in core_partials_avx2.c */
#ifdef HAVE_AVX2
PLL_EXPORT void pll_core_update_partial_ti_avx2(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
double * parent_clv,
unsigned int * parent_scaler,
const unsigned char * left_tipchars,
const double * right_clv,
const double * left_matrix,
const double * right_matrix,
const unsigned int * right_scaler,
const unsigned int * tipmap,
unsigned int tipmap_size,
unsigned int attrib);
PLL_EXPORT
void pll_core_update_partial_ti_20x20_avx2(unsigned int sites,
unsigned int rate_cats,
double * parent_clv,
unsigned int * parent_scaler,
const unsigned char * left_tipchar,
const double * right_clv,
const double * left_matrix,
const double * right_matrix,
const unsigned int * right_scaler,
const unsigned int * tipmap,
unsigned int tipmap_size);
PLL_EXPORT void pll_core_update_partial_ii_avx2(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
double * parent_clv,
unsigned int * parent_scaler,
const double * left_clv,
const double * right_clv,
const double * left_matrix,
const double * right_matrix,
const unsigned int * left_scaler,
const unsigned int * right_scaler,
unsigned int attrib);
#endif
/* functions in core_derivatives_sse.c */
#ifdef HAVE_SSE3
PLL_EXPORT int pll_core_update_sumtable_ii_sse(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
const double * parent_clv,
const double * child_clv,
const unsigned int * parent_scaler,
const unsigned int * child_scaler,
double * const * eigenvecs,
double * const * inv_eigenvecs,
double * const * freqs,
double * sumtable,
unsigned int attrib);
PLL_EXPORT int pll_core_update_sumtable_ti_sse(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
const double * parent_clv,
const unsigned char * left_tipchars,
const unsigned int * parent_scaler,
double * const * eigenvecs,
double * const * inv_eigenvecs,
double * const * freqs,
const unsigned int * tipmap,
double * sumtable,
unsigned int attrib);
#endif
/* functions in core_derivatives_avx.c */
#ifdef HAVE_AVX
PLL_EXPORT int pll_core_update_sumtable_ii_avx(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
const double * clvp,
const double * clvc,
const unsigned int * parent_scaler,
const unsigned int * child_scaler,
double * const * eigenvecs,
double * const * inv_eigenvecs,
double * const * freqs,
double * sumtable,
unsigned int attrib);
PLL_EXPORT int pll_core_update_sumtable_ti_avx(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
const double * parent_clv,
const unsigned char * left_tipchars,
const unsigned int * parent_scaler,
double * const * eigenvecs,
double * const * inv_eigenvecs,
double * const * freqs,
const unsigned int * tipmap,
unsigned int tipmap_size,
double * sumtable,
unsigned int attrib);
PLL_EXPORT int pll_core_likelihood_derivatives_avx(unsigned int states,
unsigned int states_padded,
unsigned int rate_cats,
unsigned int ef_sites,
const unsigned int * pattern_weights,
const double * rate_weights,
const int * invariant,
const double * prop_invar,
double * const * freqs,
const double * sumtable,
const double * diagptable,
double * d_f,
double * dd_f);
#endif
/* functions in core_derivatives_avx2.c */
#ifdef HAVE_AVX2
PLL_EXPORT int pll_core_update_sumtable_ii_avx2(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
const double * clvp,
const double * clvc,
const unsigned int * parent_scaler,
const unsigned int * child_scaler,
double * const * eigenvecs,
double * const * inv_eigenvecs,
double * const * freqs,
double * sumtable,
unsigned int attrib);
PLL_EXPORT int pll_core_update_sumtable_ti_avx2(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
const double * parent_clv,
const unsigned char * left_tipchars,
const unsigned int * parent_scaler,
double * const * eigenvecs,
double * const * inv_eigenvecs,
double * const * freqs,
const unsigned int * tipmap,
unsigned int tipmap_size,
double * sumtable,
unsigned int attrib);
PLL_EXPORT
int pll_core_likelihood_derivatives_avx2(unsigned int states,
unsigned int states_padded,
unsigned int rate_cats,
unsigned int ef_sites,
const unsigned int * pattern_weights,
const double * rate_weights,
const int * invariant,
const double * prop_invar,
double * const * freqs,
const double * sumtable,
const double * diagptable,
double * d_f,
double * dd_f);
#endif
/* functions in core_likelihood_sse.c */
#ifdef HAVE_SSE3
PLL_EXPORT
double pll_core_edge_loglikelihood_ii_sse(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
const double * parent_clv,
const unsigned int * parent_scaler,
const double * child_clv,
const unsigned int * child_scaler,
const double * pmatrix,
double * const * frequencies,
const double * rate_weights,
const unsigned int * pattern_weights,
const double * invar_proportion,
const int * invar_indices,
const unsigned int * freqs_indices,
double * persite_lnl);
PLL_EXPORT
double pll_core_edge_loglikelihood_ii_4x4_sse(unsigned int sites,
unsigned int rate_cats,
const double * parent_clv,
const unsigned int * parent_scaler,
const double * child_clv,
const unsigned int * child_scaler,
const double * pmatrix,
double * const * frequencies,
const double * rate_weights,
const unsigned int * pattern_weights,
const double * invar_proportion,
const int * invar_indices,
const unsigned int * freqs_indices,
double * persite_lnl,
unsigned int attrib);
PLL_EXPORT
double pll_core_edge_loglikelihood_ti_sse(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
const double * parent_clv,
const unsigned int * parent_scaler,
const unsigned char * tipchars,
const unsigned int * tipmap,
const double * pmatrix,
double * const * frequencies,
const double * rate_weights,
const unsigned int * pattern_weights,
const double * invar_proportion,
const int * invar_indices,
const unsigned int * freqs_indices,
double * persite_lnl);
PLL_EXPORT
double pll_core_edge_loglikelihood_ti_4x4_sse(unsigned int sites,
unsigned int rate_cats,
const double * parent_clv,
const unsigned int * parent_scaler,
const unsigned char * tipchars,
const double * pmatrix,
double * const * frequencies,
const double * rate_weights,
const unsigned int * pattern_weights,
const double * invar_proportion,
const int * invar_indices,
const unsigned int * freqs_indices,
double * persite_lnl,
unsigned int attrib);
PLL_EXPORT double pll_core_root_loglikelihood_4x4_sse(unsigned int sites,
unsigned int rate_cats,
const double * clv,
const unsigned int * scaler,
double * const * frequencies,
const double * rate_weights,
const unsigned int * pattern_weights,
const double * invar_proportion,
const int * invar_indices,
const unsigned int * freqs_indices,
double * persite_lnl);
PLL_EXPORT double pll_core_root_loglikelihood_sse(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
const double * clv,
const unsigned int * scaler,
double * const * frequencies,
const double * rate_weights,
const unsigned int * pattern_weights,
const double * invar_proportion,
const int * invar_indices,
const unsigned int * freqs_indices,
double * persite_lnl);
#endif
/* functions in core_likelihood_avx.c */
#ifdef HAVE_AVX
PLL_EXPORT double pll_core_edge_loglikelihood_ii_avx(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
const double * parent_clv,
const unsigned int * parent_scaler,
const double * child_clv,
const unsigned int * child_scaler,
const double * pmatrix,
double * const * frequencies,
const double * rate_weights,
const unsigned int * pattern_weights,
const double * invar_proportion,
const int * invar_indices,
const unsigned int * freqs_indices,
double * persite_lnl);
PLL_EXPORT double pll_core_edge_loglikelihood_ii_4x4_avx(unsigned int sites,
unsigned int rate_cats,
const double * parent_clv,
const unsigned int * parent_scaler,
const double * child_clv,
const unsigned int * child_scaler,
const double * pmatrix,
double * const * frequencies,
const double * rate_weights,
const unsigned int * pattern_weights,
const double * invar_proportion,
const int * invar_indices,
const unsigned int * freqs_indices,
double * persite_lnl,
unsigned int attrib);
PLL_EXPORT double pll_core_edge_loglikelihood_ti_4x4_avx(unsigned int sites,
unsigned int rate_cats,
const double * parent_clv,
const unsigned int * parent_scaler,
const unsigned char * tipchars,
const double * pmatrix,
double * const * frequencies,
const double * rate_weights,
const unsigned int * pattern_weights,
const double * invar_proportion,
const int * invar_indices,
const unsigned int * freqs_indices,
double * persite_lnl,
unsigned int attrib);
PLL_EXPORT double pll_core_edge_loglikelihood_ti_20x20_avx(unsigned int sites,
unsigned int rate_cats,
const double * parent_clv,
const unsigned int * parent_scaler,
const unsigned char * tipchars,
const unsigned int * tipmap,
unsigned int tipmap_size,
const double * pmatrix,
double * const * frequencies,
const double * rate_weights,
const unsigned int * pattern_weights,
const double * invar_proportion,
const int * invar_indices,
const unsigned int * freqs_indices,
double * persite_lnl);
PLL_EXPORT double pll_core_edge_loglikelihood_ti_avx(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
const double * parent_clv,
const unsigned int * parent_scaler,
const unsigned char * tipchars,
const unsigned int * tipmap,
const double * pmatrix,
double * const * frequencies,
const double * rate_weights,
const unsigned int * pattern_weights,
const double * invar_proportion,
const int * invar_indices,
const unsigned int * freqs_indices,
double * persite_lnl);
PLL_EXPORT double pll_core_root_loglikelihood_4x4_avx(unsigned int sites,
unsigned int rate_cats,
const double * clv,
const unsigned int * scaler,
double * const * frequencies,
const double * rate_weights,
const unsigned int * pattern_weights,
const double * invar_proportion,
const int * invar_indices,
const unsigned int * freqs_indices,
double * persite_lnl);
PLL_EXPORT double pll_core_root_loglikelihood_avx(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
const double * clv,
const unsigned int * scaler,
double * const * frequencies,
const double * rate_weights,
const unsigned int * pattern_weights,
const double * invar_proportion,
const int * invar_indices,
const unsigned int * freqs_indices,
double * persite_lnl);
#endif
/* functions in core_likelihood_avx2.c */
#ifdef HAVE_AVX2
PLL_EXPORT
double pll_core_root_loglikelihood_avx2(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
const double * clv,
const unsigned int * scaler,
double * const * frequencies,
const double * rate_weights,
const unsigned int * pattern_weights,
const double * invar_proportion,
const int * invar_indices,
const unsigned int * freqs_indices,
double * persite_lnl);
PLL_EXPORT
double pll_core_edge_loglikelihood_ti_20x20_avx2(unsigned int sites,
unsigned int rate_cats,
const double * parent_clv,
const unsigned int * parent_scaler,
const unsigned char * tipchars,
const unsigned int * tipmap,
unsigned int tipmap_size,
const double * pmatrix,
double * const * frequencies,
const double * rate_weights,
const unsigned int * pattern_weights,
const double * invar_proportion,
const int * invar_indices,
const unsigned int * freqs_indices,
double * persite_lnl);
PLL_EXPORT
double pll_core_edge_loglikelihood_ii_avx2(unsigned int states,
unsigned int sites,
unsigned int rate_cats,
const double * parent_clv,
const unsigned int * parent_scaler,
const double * child_clv,
const unsigned int * child_scaler,
const double * pmatrix,
double * const * frequencies,
const double * rate_weights,
const unsigned int * pattern_weights,
const double * invar_proportion,
const int * invar_indices,
const unsigned int * freqs_indices,
double * persite_lnl);
#endif
/* functions in core_pmatrix.c */
PLL_EXPORT int pll_core_update_pmatrix(double ** pmatrix,
unsigned int states,
unsigned int rate_cats,
const double * rates,
const double * branch_lengths,
const unsigned int * matrix_indices,
const unsigned int * params_indices,
const double * prop_invar,
double * const * eigenvals,
double * const * eigenvecs,
double * const * inv_eigenvecs,
unsigned int count,
unsigned int attrib);
/* functions in core_pmatrix_avx2.c */
#ifdef HAVE_AVX2
PLL_EXPORT int pll_core_update_pmatrix_20x20_avx2(double ** pmatrix,
unsigned int rate_cats,
const double * rates,
const double * branch_lengths,
const unsigned int * matrix_indices,
const unsigned int * params_indices,
const double * prop_invar,
double * const * eigenvals,
double * const * eigenvecs,
double * const * inv_eigenvecs,
unsigned int count);
#endif
/* functions in core_pmatrix_avx.c */
#ifdef HAVE_AVX
PLL_EXPORT int pll_core_update_pmatrix_4x4_avx(double ** pmatrix,
unsigned int rate_cats,
const double * rates,
const double * branch_lengths,
const unsigned int * matrix_indices,
const unsigned int * params_indices,
const double * prop_invar,
double * const * eigenvals,
double * const * eigenvecs,
double * const * inv_eigenvecs,
unsigned int count);
PLL_EXPORT int pll_core_update_pmatrix_20x20_avx(double ** pmatrix,
unsigned int rate_cats,
const double * rates,
const double * branch_lengths,
const unsigned int * matrix_indices,
const unsigned int * params_indices,
const double * prop_invar,
double * const * eigenvals,
double * const * eigenvecs,
double * const * inv_eigenvecs,
unsigned int count);
#endif
/* functions in core_pmatrix_sse.c */
#ifdef HAVE_SSE3
PLL_EXPORT int pll_core_update_pmatrix_4x4_sse(double ** pmatrix,
unsigned int rate_cats,
const double * rates,
const double * branch_lengths,
const unsigned int * matrix_indices,
const unsigned int * params_indices,
const double * prop_invar,
double * const * eigenvals,
double * const * eigenvecs,
double * const * inv_eigenvecs,
unsigned int count);
#endif
/* functions in compress.c */
PLL_EXPORT unsigned int * pll_compress_site_patterns(char ** sequence,
const unsigned int * map,
int count,
int * length);
/* functions in utree_moves.c */
PLL_EXPORT int pll_utree_spr(pll_unode_t * p,
pll_unode_t * r,
pll_utree_rb_t * rb,
double * branch_lengths,
unsigned int * matrix_indices);
PLL_EXPORT int pll_utree_spr_safe(pll_unode_t * p,
pll_unode_t * r,
pll_utree_rb_t * rb,
double * branch_lengths,
unsigned int * matrix_indices);
PLL_EXPORT int pll_utree_nni(pll_unode_t * p,
int type,
pll_utree_rb_t * rb);
PLL_EXPORT int pll_utree_rollback(pll_utree_rb_t * rollback,
double * branch_lengths,
unsigned int * matrix_indices);
/* functions in parsimony.c */
PLL_EXPORT int pll_set_parsimony_sequence(pll_parsimony_t * pars,
unsigned int tip_index,
const unsigned int * map,
const char * sequence);
PLL_EXPORT pll_parsimony_t * pll_parsimony_create(unsigned int tips,
unsigned int states,
unsigned int sites,
const double * score_matrix,
unsigned int score_buffers,
unsigned int ancestral_buffers);
PLL_EXPORT double pll_parsimony_build(pll_parsimony_t * pars,
const pll_pars_buildop_t * operations,
unsigned int count);
PLL_EXPORT void pll_parsimony_reconstruct(pll_parsimony_t * pars,
const unsigned int * map,
const pll_pars_recop_t * operations,
unsigned int count);
PLL_EXPORT double pll_parsimony_score(pll_parsimony_t * pars,
unsigned int score_buffer_index);
PLL_EXPORT void pll_parsimony_destroy(pll_parsimony_t * pars);
/* functions in utree_svg.c */
PLL_EXPORT pll_svg_attrib_t * pll_svg_attrib_create(void);
PLL_EXPORT void pll_svg_attrib_destroy(pll_svg_attrib_t * attrib);
PLL_EXPORT int pll_utree_export_svg(pll_utree_t * tree,
pll_unode_t * root,
const pll_svg_attrib_t * attribs,
const char * filename);
/* functions in fast_parsimony.c */
PLL_EXPORT pll_parsimony_t * pll_fastparsimony_init(const pll_partition_t * partition);
PLL_EXPORT void pll_fastparsimony_update_vectors(pll_parsimony_t * parsimony,
const pll_pars_buildop_t * ops,
unsigned int count);
PLL_EXPORT unsigned int pll_fastparsimony_root_score(const pll_parsimony_t * parsimony,
unsigned int root_index);
PLL_EXPORT unsigned int pll_fastparsimony_edge_score(const pll_parsimony_t * parsimony,
unsigned int node1_score_index,
unsigned int node2_score_index);
PLL_EXPORT void pll_fastparsimony_update_vector_4x4(pll_parsimony_t * parsimony,
const pll_pars_buildop_t * op);
PLL_EXPORT unsigned int pll_fastparsimony_edge_score_4x4(const pll_parsimony_t * parsimony,
unsigned int node1_score_index,
unsigned int node2_score_index);
PLL_EXPORT void pll_fastparsimony_update_vector(pll_parsimony_t * parsimony,
const pll_pars_buildop_t * op);
/* functions in fast_parsimony_sse.c */
PLL_EXPORT void pll_fastparsimony_update_vector_4x4_sse(pll_parsimony_t * parsimony,
const pll_pars_buildop_t * op);
PLL_EXPORT unsigned int pll_fastparsimony_edge_score_4x4_sse(const pll_parsimony_t * parsimony,
unsigned int node1_score_index,
unsigned int node2_score_index);
PLL_EXPORT unsigned int pll_fastparsimony_edge_score_sse(const pll_parsimony_t * parsimony,
unsigned int node1_score_index,
unsigned int node2_score_index);
PLL_EXPORT void pll_fastparsimony_update_vector_sse(pll_parsimony_t * parsimony,
const pll_pars_buildop_t * op);
/* functions in fast_parsimony_avx.c */
PLL_EXPORT void pll_fastparsimony_update_vector_4x4_avx(pll_parsimony_t * parsimony,
const pll_pars_buildop_t * op);
PLL_EXPORT unsigned int pll_fastparsimony_edge_score_4x4_avx(const pll_parsimony_t * parsimony,
unsigned int node1_score_index,
unsigned int node2_score_index);
PLL_EXPORT void pll_fastparsimony_update_vector_avx(pll_parsimony_t * parsimony,
const pll_pars_buildop_t * op);
PLL_EXPORT unsigned int pll_fastparsimony_edge_score_avx(const pll_parsimony_t * parsimony,
unsigned int node1_score_index,
unsigned int node2_score_index);
/* functions in fast_parsimony_avx2.c */
PLL_EXPORT void pll_fastparsimony_update_vector_4x4_avx2(pll_parsimony_t * parsimony,
const pll_pars_buildop_t * op);
PLL_EXPORT unsigned int pll_fastparsimony_edge_score_4x4_avx2(const pll_parsimony_t * parsimony,
unsigned int node1_score_index,
unsigned int node2_score_index);
PLL_EXPORT void pll_fastparsimony_update_vector_avx2(pll_parsimony_t * parsimony,
const pll_pars_buildop_t * op);
PLL_EXPORT unsigned int pll_fastparsimony_edge_score_avx2(const pll_parsimony_t * parsimony,
unsigned int node1_score_index,
unsigned int node2_score_index);
/* functions in stepwise.c */
PLL_EXPORT pll_utree_t * pll_fastparsimony_stepwise(pll_parsimony_t ** list,
char * const * labels,
unsigned int * score,
unsigned int count,
unsigned int seed);
/* functions in random.c */
PLL_EXPORT extern int pll_random_r(struct pll_random_data * __buf,
int32_t * __result);
PLL_EXPORT extern int pll_srandom_r(unsigned int __seed,
struct pll_random_data * __buf);
PLL_EXPORT extern int pll_initstate_r(unsigned int __seed,
char * __statebuf,
size_t __statelen,
struct pll_random_data * __buf);
PLL_EXPORT extern int pll_setstate_r(char * __statebuf,
struct pll_random_data * __buf);
/* functions in hardware.c */
PLL_EXPORT int pll_hardware_probe(void);
PLL_EXPORT void pll_hardware_dump();
PLL_EXPORT void pll_hardware_ignore();
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif
|