├── .github └── workflows │ └── ci.yaml ├── .gitignore ├── .gitmodules ├── .vscode └── settings.json ├── .ycm_extra_conf.py ├── CMakeLists.txt ├── CMakeSettings.json ├── CODE_OF_CONDUCT.md ├── FindEigen3.cmake ├── LICENSE ├── README.md ├── alignment ├── CMakeLists.txt ├── alignment.cpp ├── alignment.h ├── alignmentpairwise.cpp ├── alignmentpairwise.h ├── alignmentsummary.cpp ├── alignmentsummary.h ├── maalignment.cpp ├── maalignment.h ├── pattern.cpp ├── pattern.h ├── sequence.cpp ├── sequence.h ├── sequencechunkstr.cpp ├── sequencechunkstr.h ├── substitution.cpp ├── substitution.h ├── superalignment.cpp ├── superalignment.h ├── superalignmentpairwise.cpp ├── superalignmentpairwise.h ├── superalignmentpairwiseplen.cpp ├── superalignmentpairwiseplen.h ├── superalignmentunlinked.cpp └── superalignmentunlinked.h ├── booster ├── CMakeLists.txt ├── Makefile ├── bitset_index.c ├── bitset_index.h ├── booster.c ├── booster.h ├── externs.h ├── hashmap.c ├── hashmap.h ├── hashtables_bfields.c ├── hashtables_bfields.h ├── io.c ├── io.h ├── prng.c ├── prng.h ├── sort.c ├── sort.h ├── stats.c ├── stats.h ├── test.c ├── tree.c ├── tree.h ├── tree_utils.c ├── tree_utils.h ├── version.c └── version.h ├── doc ├── html │ ├── bc_s.png │ ├── bdwn.png │ ├── closed.png │ ├── doc.png │ ├── doxygen.css │ ├── doxygen.svg │ ├── dynsections.js │ ├── folderclosed.png │ ├── folderopen.png │ ├── index.html │ ├── jquery.js │ ├── md__r_e_a_d_m_e.html │ ├── menu.js │ ├── menudata.js │ ├── nav_f.png │ ├── nav_g.png │ ├── nav_h.png │ ├── open.png │ ├── pages.html │ ├── search │ │ ├── all_0.html │ │ ├── all_0.js │ │ ├── close.svg │ │ ├── mag_sel.svg │ │ ├── nomatches.html │ │ ├── pages_0.html │ │ ├── pages_0.js │ │ ├── search.css │ │ ├── search.js │ │ ├── search_l.png │ │ ├── search_m.png │ │ ├── search_r.png │ │ └── searchdata.js │ ├── splitbar.png │ ├── sync_off.png │ ├── sync_on.png │ ├── tab_a.png │ ├── tab_b.png │ ├── tab_h.png │ ├── tab_s.png │ └── tabs.css └── latex │ ├── Makefile │ ├── doxygen.sty │ ├── longtable_doxygen.sty │ ├── md__r_e_a_d_m_e.tex │ ├── refman.tex │ └── tabu_doxygen.sty ├── example ├── custom_distributions.txt ├── example.cf ├── example.nex ├── example.phy ├── models.nex └── tree.nwk ├── flake.lock ├── flake.nix ├── gsl ├── CMakeLists.txt ├── binomial_tpe.cpp ├── gauss.cpp ├── gaussinv.cpp ├── gausspdf.cpp ├── gsl_nan.h ├── multinomial.cpp ├── mygsl.h ├── pow_int.cpp └── rat_eval.h ├── iqtree.doxy ├── iqtree_config.h.in ├── lbfgsb ├── CMakeLists.txt ├── lbfgsb_new.cpp └── lbfgsb_new.h ├── lib ├── libiomp5md.dll ├── libomp.a ├── libompstatic.a ├── pthreadGC2.dll ├── pthreadGC2_64.dll ├── pthreadVC2.dll └── pthreadVC2.lib ├── libmac └── libomp.a ├── libmac_m1 └── libomp.a ├── main ├── CMakeLists.txt ├── alisim.cpp ├── alisim.h ├── main.cpp ├── phyloanalysis.cpp ├── phyloanalysis.h ├── phylotesting.cpp ├── phylotesting.h ├── terraceanalysis.cpp ├── terraceanalysis.h ├── timetree.cpp ├── timetree.h ├── treetesting.cpp └── treetesting.h ├── model ├── CMakeLists.txt ├── modelbin.cpp ├── modelbin.h ├── modelcodon.cpp ├── modelcodon.h ├── modelcodonempirical.cpp ├── modelcodonempirical.h ├── modelcodonmixture.cpp ├── modelcodonmixture.h ├── modelcodonparametric.cpp ├── modelcodonparametric.h ├── modelcodonsemiempirical.cpp ├── modelcodonsemiempirical.h ├── modeldna.cpp ├── modeldna.h ├── modeldnaerror.cpp ├── modeldnaerror.h ├── modelfactory.cpp ├── modelfactory.h ├── modelfactorymixlen.cpp ├── modelfactorymixlen.h ├── modelgtr.cpp ├── modelhmm.cpp ├── modelhmm.h ├── modelhmmgm.cpp ├── modelhmmgm.h ├── modelhmmtm.cpp ├── modelhmmtm.h ├── modelliemarkov.cpp ├── modelliemarkov.h ├── modelmarkov.cpp ├── modelmarkov.h ├── modelmixture.cpp ├── modelmixture.h ├── modelmorphology.cpp ├── modelmorphology.h ├── modelnonrev.cpp ├── modelnonrev.h ├── modelpomo.cpp ├── modelpomo.h ├── modelpomomixture.cpp ├── modelpomomixture.h ├── modelprotein.cpp ├── modelprotein.h ├── modelset.cpp ├── modelset.h ├── modelsubst.cpp ├── modelsubst.h ├── modelunrest.cpp ├── modelunrest.h ├── partitionmodel.cpp ├── partitionmodel.h ├── partitionmodelplen.cpp ├── partitionmodelplen.h ├── ratecontinuousgamma.cpp ├── ratecontinuousgamma.h ├── ratecontinuousgammainvar.cpp ├── ratecontinuousgammainvar.h ├── ratefree.cpp ├── ratefree.h ├── ratefreeinvar.cpp ├── ratefreeinvar.h ├── rategamma.cpp ├── rategamma.h ├── rategammainvar.cpp ├── rategammainvar.h ├── rateheterogeneity.cpp ├── rateheterogeneity.h ├── rateheterotachy.cpp ├── rateheterotachy.h ├── rateheterotachyinvar.cpp ├── rateheterotachyinvar.h ├── rateinvar.cpp ├── rateinvar.h ├── ratekategory.cpp ├── ratekategory.h ├── ratemeyerdiscrete.cpp ├── ratemeyerdiscrete.h ├── ratemeyerhaeseler.cpp └── ratemeyerhaeseler.h ├── ncl ├── CMakeLists.txt ├── ncl.h ├── nxsassumptionsblock.cpp ├── nxsassumptionsblock.h ├── nxsblock.cpp ├── nxsblock.h ├── nxscharactersblock.cpp ├── nxscharactersblock.h ├── nxsdatablock.cpp ├── nxsdatablock.h ├── nxsdefs.h ├── nxsdiscretedatum.cpp ├── nxsdiscretedatum.h ├── nxsdiscretematrix.cpp ├── nxsdiscretematrix.h ├── nxsdistancedatum.cpp ├── nxsdistancedatum.h ├── nxsdistancesblock.cpp ├── nxsdistancesblock.h ├── nxsemptyblock.cpp ├── nxsemptyblock.h ├── nxsexception.cpp ├── nxsexception.h ├── nxsindent.h ├── nxsreader.cpp ├── nxsreader.h ├── nxssetreader.cpp ├── nxssetreader.h ├── nxsstring.cpp ├── nxsstring.h ├── nxstaxablock.cpp ├── nxstaxablock.h ├── nxstoken.cpp ├── nxstoken.h ├── nxstreesblock.cpp └── nxstreesblock.h ├── nclextra ├── CMakeLists.txt ├── modelsblock.cpp ├── modelsblock.h ├── mpdablock.cpp ├── mpdablock.h ├── msetsblock.cpp ├── msetsblock.h ├── msplitsblock.cpp ├── msplitsblock.h └── myreader.h ├── nn ├── CMakeLists.txt ├── neuralnetwork.cpp └── neuralnetwork.h ├── nn_models ├── lanfear_alpha_lstm.onnx └── resnet_modelfinder.onnx ├── obsolete ├── gss.cpp ├── gss.h ├── guidedbootstrap.cpp ├── guidedbootstrap.h ├── ngs.cpp ├── ngs.h ├── parsmultistate.cpp └── parsmultistate.h ├── onnxruntimeConfig.cmake ├── pda ├── CMakeLists.txt ├── circularnetwork.cpp ├── circularnetwork.h ├── ecopd.cpp ├── ecopd.h ├── ecopdmtreeset.cpp ├── ecopdmtreeset.h ├── graph.cpp ├── graph.h ├── greedy.cpp ├── greedy.h ├── gurobiwrapper.cpp ├── gurobiwrapper.h ├── hashsplitset.cpp ├── hashsplitset.h ├── lpwrapper.c ├── lpwrapper.h ├── pdnetwork.cpp ├── pdnetwork.h ├── pdtree.cpp ├── pdtree.h ├── pdtreeset.cpp ├── pdtreeset.h ├── pruning.cpp ├── pruning.h ├── split.cpp ├── split.h ├── splitgraph.cpp ├── splitgraph.h ├── splitset.cpp └── splitset.h ├── phylo-yaml ├── CMakeLists.txt ├── statespace.cpp └── statespace.h ├── pll ├── CMakeLists.txt ├── alignment.c ├── avxLikelihood.c ├── bipartitionList.c ├── cycle.h ├── errcodes.h ├── evaluateGenericSpecial.c ├── evaluatePartialGenericSpecial.c ├── fastDNAparsimony.c ├── genericParallelization.c ├── genericParallelization.h ├── globalVariables.h ├── hardware.c ├── hardware.h ├── hash.c ├── hash.h ├── lexer.c ├── lexer.h ├── makenewzGenericSpecial.c ├── mem_alloc.c ├── mem_alloc.h ├── mic_native.h ├── mic_native_aa.c ├── mic_native_dna.c ├── models.c ├── newick.c ├── newick.h ├── newviewGenericSpecial.c ├── optimizeModel.c ├── parsePartition.c ├── parsePartition.h ├── parsimony.c ├── pll.h ├── pllInternal.h ├── pthread.h ├── queue.c ├── queue.h ├── randomTree.c ├── recom.c ├── restartHashTable.c ├── sched.h ├── searchAlgo.c ├── semaphore.h ├── ssort.c ├── stack.c ├── stack.h ├── systypes.h ├── topologies.c ├── trash.c ├── treeIO.c ├── treeIO.h └── utils.c ├── simulator ├── CMakeLists.txt ├── alisimulator.cpp ├── alisimulator.h ├── alisimulatorheterogeneity.cpp ├── alisimulatorheterogeneity.h ├── alisimulatorheterogeneityinvar.cpp ├── alisimulatorheterogeneityinvar.h ├── alisimulatorinvar.cpp └── alisimulatorinvar.h ├── sprng ├── CMakeLists.txt ├── README ├── checkid.c ├── interface.h ├── lcg64.c ├── makeseed.c ├── memory.c ├── memory.h ├── primelist-lcg64.h ├── primes-lcg64.c ├── primes-lcg64.h ├── sprng.h ├── store.c └── store.h ├── terrace ├── CMakeLists.txt ├── README.md ├── presenceabsencematrix.cpp ├── presenceabsencematrix.hpp ├── terrace.cpp ├── terrace.hpp ├── terracenode.cpp ├── terracenode.hpp ├── terracetree.cpp └── terracetree.hpp ├── terracetphast ├── CMakeLists.txt ├── terracetphast.cpp └── terracetphast.h ├── terraphast ├── .gitattributes ├── .gitignore ├── AUTHORS ├── CMakeLists.txt ├── LICENSE ├── README.md ├── app │ └── app.cpp ├── appveyor.yml ├── c_include │ └── terraces │ │ └── terraces.h ├── c_lib │ └── terraces.cpp ├── catch │ ├── LICENSE.txt │ └── catch.hpp ├── cmake │ └── FindGMP.cmake ├── documentation │ ├── Changelog.md │ ├── Dependencies.md │ └── walkthrough.md ├── doxygen.conf ├── include │ └── terraces │ │ ├── advanced.hpp │ │ ├── bigint.hpp │ │ ├── bitmatrix.hpp │ │ ├── clamped_uint.hpp │ │ ├── constraints.hpp │ │ ├── definitions.hpp │ │ ├── errors.hpp │ │ ├── parser.hpp │ │ ├── rooting.hpp │ │ ├── simple.hpp │ │ ├── subtree_extraction.hpp │ │ └── trees.hpp ├── lib │ ├── advanced.cpp │ ├── bigint.cpp │ ├── bipartitions.cpp │ ├── bipartitions.hpp │ ├── bitmatrix.cpp │ ├── bits.hpp │ ├── bitvector.hpp │ ├── cl │ │ └── intrinsics.hpp │ ├── clamped_uint.cpp │ ├── constraints.cpp │ ├── constraints_impl.hpp │ ├── errors.cpp │ ├── gcc_clang │ │ └── intrinsics.hpp │ ├── intel │ │ └── intrinsics.hpp │ ├── io_utils.hpp │ ├── multitree.cpp │ ├── multitree.hpp │ ├── multitree_impl.hpp │ ├── multitree_iterator.cpp │ ├── multitree_iterator.hpp │ ├── nodes.cpp │ ├── parser.cpp │ ├── ranked_bitvector.hpp │ ├── rooting.cpp │ ├── simple.cpp │ ├── small_bipartition.hpp │ ├── stack_allocator.hpp │ ├── subtree_extraction.cpp │ ├── subtree_extraction_impl.hpp │ ├── supertree_enumerator.hpp │ ├── supertree_helpers.cpp │ ├── supertree_helpers.hpp │ ├── supertree_variants.hpp │ ├── supertree_variants_debug.hpp │ ├── supertree_variants_multitree.hpp │ ├── trees.cpp │ ├── trees_impl.hpp │ ├── union_find.cpp │ ├── union_find.hpp │ ├── union_find_debug.hpp │ ├── utils.hpp │ ├── validation.cpp │ └── validation.hpp ├── scripts │ ├── build_appveyor.bat │ ├── format.sh │ ├── pre-commit │ ├── setup_workspace.sh │ └── setup_workspace_windows.sh ├── test │ ├── advanced.cpp │ ├── bipartitions.cpp │ ├── bitmatrix.cpp │ ├── bits.cpp │ ├── bitvector.cpp │ ├── c_api.cpp │ ├── clamped_uint.cpp │ ├── compile_test.cpp │ ├── constraints.cpp │ ├── fast_set.cpp │ ├── integration.cpp │ ├── main.cc │ ├── multitree_iterator.cpp │ ├── parser.cpp │ ├── rooting.cpp │ ├── simple.cpp │ ├── small_bipartition.cpp │ ├── stack_allocator.cpp │ ├── subtree_extraction.cpp │ ├── supertree.cpp │ ├── trees.cpp │ ├── union_find.cpp │ ├── util.cpp │ └── validation.cpp └── tools │ ├── isomorphic.cpp │ ├── nwk_to_dot.cpp │ ├── reroot.cpp │ ├── site_gen.cpp │ ├── subtree.cpp │ ├── tree_gen.cpp │ ├── validated_run.cpp │ └── verbose_run.cpp ├── test_scripts ├── README ├── compile.sh ├── gen_test_standard.py ├── gen_test_webserver.py ├── iqtree2.h ├── jobmanager.py ├── linux_universal.sh ├── make_linux_universal.sh ├── make_universal.sh ├── run_tests.sh ├── submit_jobs.sh ├── test_configs.txt ├── test_data │ ├── d59_8.nex │ ├── d59_8.phy │ ├── example.nex │ ├── example.phy │ └── prot_M126_27_269.phy └── unify-static-libs.sh ├── tree ├── CMakeLists.txt ├── candidateset.cpp ├── candidateset.h ├── constrainttree.cpp ├── constrainttree.h ├── discordance.cpp ├── genomenode.cpp ├── genomenode.h ├── genometree.cpp ├── genometree.h ├── iqtree.cpp ├── iqtree.h ├── iqtreemix.cpp ├── iqtreemix.h ├── iqtreemixhmm.cpp ├── iqtreemixhmm.h ├── matree.cpp ├── matree.h ├── memslot.cpp ├── memslot.h ├── mexttree.cpp ├── mexttree.h ├── mtree.cpp ├── mtree.h ├── mtreeset.cpp ├── mtreeset.h ├── ncbitree.cpp ├── ncbitree.h ├── node.cpp ├── node.h ├── parstree.cpp ├── parstree.h ├── phylohmm.cpp ├── phylohmm.h ├── phylokernel.h ├── phylokernelavx512.cpp ├── phylokernelfma.cpp ├── phylokernelmixrate.h ├── phylokernelmixture.h ├── phylokernelnew.h ├── phylokernelnonrev.cpp ├── phylokernelnonrev.h ├── phylokernelsafe.h ├── phylokernelsitemodel.cpp ├── phylokernelsitemodel.h ├── phylokernelsse.cpp ├── phylonode.cpp ├── phylonode.h ├── phylonodemixlen.cpp ├── phylonodemixlen.h ├── phylosuperhmm.cpp ├── phylosuperhmm.h ├── phylosupertree.cpp ├── phylosupertree.h ├── phylosupertreeplen.cpp ├── phylosupertreeplen.h ├── phylosupertreeunlinked.cpp ├── phylosupertreeunlinked.h ├── phylotree.cpp ├── phylotree.h ├── phylotreeavx.cpp ├── phylotreeeigen.cpp ├── phylotreemixlen.cpp ├── phylotreemixlen.h ├── phylotreepars.cpp ├── phylotreesse.cpp ├── quartet.cpp ├── supernode.cpp ├── supernode.h ├── tinatree.cpp ├── tinatree.h ├── upperbounds.cpp └── upperbounds.h ├── utils ├── CMakeLists.txt ├── MPIHelper.cpp ├── MPIHelper.h ├── ObjectStream.cpp ├── ObjectStream.h ├── TreeCollection.cpp ├── TreeCollection.h ├── bionj.cpp ├── bionj2.cpp ├── bionj2.h ├── checkpoint.cpp ├── checkpoint.h ├── decenttree.cpp ├── eigendecomposition.cpp ├── eigendecomposition.h ├── gzstream.cpp ├── gzstream.h ├── hammingdistance.h ├── heapsort.h ├── operatingsystem.cpp ├── operatingsystem.h ├── optimization.cpp ├── optimization.h ├── pllnni.cpp ├── pllnni.h ├── progress.cpp ├── progress.h ├── sse2neon.h ├── starttree.cpp ├── starttree.h ├── stoprule.cpp ├── stoprule.h ├── timeutil.h ├── tools.cpp └── tools.h ├── vectorclass ├── CMakeLists.txt ├── changelog.txt ├── instrset.h ├── instrset_detect.cpp ├── license.txt ├── vectorclass.h ├── vectorf128.h ├── vectorf256.h ├── vectorf256e.h ├── vectorf512.h ├── vectorf512e.h ├── vectorf64.h ├── vectori128.h ├── vectori256.h ├── vectori256e.h ├── vectori512.h ├── vectori512e.h ├── vectormath_common.h ├── vectormath_exp.h ├── vectormath_hyp.h ├── vectormath_lib.h └── vectormath_trig.h ├── whtest ├── CMakeLists.txt ├── eigen.c ├── eigen.h ├── eigen_sym.c ├── eigen_sym.h ├── random.c ├── random.h ├── weisslambda.c ├── weisslambda_sub.c ├── weisslambda_sub.h ├── whtest.c ├── whtest.h ├── whtest_sub.c ├── whtest_sub.h ├── whtest_wrapper.cpp ├── whtest_wrapper.h └── whtools.h ├── yaml-cpp ├── CMakeLists.txt ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── include │ └── yaml-cpp │ │ ├── anchor.h │ │ ├── binary.h │ │ ├── contrib │ │ ├── anchordict.h │ │ └── graphbuilder.h │ │ ├── dll.h │ │ ├── emitfromevents.h │ │ ├── emitter.h │ │ ├── emitterdef.h │ │ ├── emittermanip.h │ │ ├── emitterstyle.h │ │ ├── eventhandler.h │ │ ├── exceptions.h │ │ ├── mark.h │ │ ├── node │ │ ├── convert.h │ │ ├── detail │ │ │ ├── bool_type.h │ │ │ ├── impl.h │ │ │ ├── iterator.h │ │ │ ├── iterator_fwd.h │ │ │ ├── memory.h │ │ │ ├── node.h │ │ │ ├── node_data.h │ │ │ ├── node_iterator.h │ │ │ └── node_ref.h │ │ ├── emit.h │ │ ├── impl.h │ │ ├── iterator.h │ │ ├── node.h │ │ ├── parse.h │ │ ├── ptr.h │ │ └── type.h │ │ ├── noncopyable.h │ │ ├── null.h │ │ ├── ostream_wrapper.h │ │ ├── parser.h │ │ ├── stlemitter.h │ │ ├── traits.h │ │ └── yaml.h ├── install.txt ├── src │ ├── binary.cpp │ ├── collectionstack.h │ ├── contrib │ │ ├── graphbuilder.cpp │ │ ├── graphbuilderadapter.cpp │ │ ├── graphbuilderadapter.h │ │ ├── yaml-cpp.natvis │ │ └── yaml-cpp.natvis.md │ ├── convert.cpp │ ├── directives.cpp │ ├── directives.h │ ├── emit.cpp │ ├── emitfromevents.cpp │ ├── emitter.cpp │ ├── emitterstate.cpp │ ├── emitterstate.h │ ├── emitterutils.cpp │ ├── emitterutils.h │ ├── exceptions.cpp │ ├── exp.cpp │ ├── exp.h │ ├── indentation.h │ ├── memory.cpp │ ├── node.cpp │ ├── node_data.cpp │ ├── nodebuilder.cpp │ ├── nodebuilder.h │ ├── nodeevents.cpp │ ├── nodeevents.h │ ├── null.cpp │ ├── ostream_wrapper.cpp │ ├── parse.cpp │ ├── parser.cpp │ ├── ptr_vector.h │ ├── regex_yaml.cpp │ ├── regex_yaml.h │ ├── regeximpl.h │ ├── scanner.cpp │ ├── scanner.h │ ├── scanscalar.cpp │ ├── scanscalar.h │ ├── scantag.cpp │ ├── scantag.h │ ├── scantoken.cpp │ ├── setting.h │ ├── simplekey.cpp │ ├── singledocparser.cpp │ ├── singledocparser.h │ ├── stream.cpp │ ├── stream.h │ ├── streamcharsource.h │ ├── stringsource.h │ ├── tag.cpp │ ├── tag.h │ └── token.h ├── util │ ├── CMakeLists.txt │ ├── api.cpp │ ├── parse.cpp │ ├── read.cpp │ └── sandbox.cpp ├── yaml-cpp-config-version.cmake.in ├── yaml-cpp-config.cmake.in └── yaml-cpp.pc.cmake └── zlib-1.2.7 ├── CMakeLists.txt ├── ChangeLog ├── FAQ ├── INDEX ├── Makefile ├── Makefile.in ├── README ├── adler32.c ├── amiga ├── Makefile.pup └── Makefile.sas ├── as400 ├── bndsrc ├── compile.clp ├── readme.txt └── zlib.inc ├── compress.c ├── configure ├── contrib ├── README.contrib ├── ada │ ├── buffer_demo.adb │ ├── mtest.adb │ ├── read.adb │ ├── readme.txt │ ├── test.adb │ ├── zlib-streams.adb │ ├── zlib-streams.ads │ ├── zlib-thin.adb │ ├── zlib-thin.ads │ ├── zlib.adb │ ├── zlib.ads │ └── zlib.gpr ├── amd64 │ └── amd64-match.S ├── asm686 │ ├── README.686 │ └── match.S ├── blast │ ├── Makefile │ ├── README │ ├── blast.c │ ├── blast.h │ ├── test.pk │ └── test.txt ├── delphi │ ├── ZLib.pas │ ├── ZLibConst.pas │ ├── readme.txt │ └── zlibd32.mak ├── dotzlib │ ├── DotZLib.build │ ├── DotZLib.chm │ ├── DotZLib.sln │ ├── DotZLib │ │ ├── AssemblyInfo.cs │ │ ├── ChecksumImpl.cs │ │ ├── CircularBuffer.cs │ │ ├── CodecBase.cs │ │ ├── Deflater.cs │ │ ├── DotZLib.cs │ │ ├── DotZLib.csproj │ │ ├── GZipStream.cs │ │ ├── Inflater.cs │ │ └── UnitTests.cs │ ├── LICENSE_1_0.txt │ └── readme.txt ├── gcc_gvmat64 │ └── gvmat64.S ├── infback9 │ ├── README │ ├── infback9.c │ ├── infback9.h │ ├── inffix9.h │ ├── inflate9.h │ ├── inftree9.c │ └── inftree9.h ├── inflate86 │ ├── inffas86.c │ └── inffast.S ├── iostream │ ├── test.cpp │ ├── zfstream.cpp │ └── zfstream.h ├── iostream2 │ ├── zstream.h │ └── zstream_test.cpp ├── iostream3 │ ├── README │ ├── TODO │ ├── test.cc │ ├── zfstream.cc │ └── zfstream.h ├── masmx64 │ ├── bld_ml64.bat │ ├── gvmat64.asm │ ├── inffas8664.c │ ├── inffasx64.asm │ └── readme.txt ├── masmx86 │ ├── bld_ml32.bat │ ├── inffas32.asm │ ├── match686.asm │ └── readme.txt ├── minizip │ ├── Makefile │ ├── Makefile.am │ ├── MiniZip64_Changes.txt │ ├── MiniZip64_info.txt │ ├── configure.ac │ ├── crypt.h │ ├── ioapi.c │ ├── ioapi.h │ ├── iowin32.c │ ├── iowin32.h │ ├── make_vms.com │ ├── miniunz.c │ ├── minizip.c │ ├── minizip.pc.in │ ├── mztools.c │ ├── mztools.h │ ├── unzip.c │ ├── unzip.h │ ├── zip.c │ └── zip.h ├── pascal │ ├── example.pas │ ├── readme.txt │ ├── zlibd32.mak │ └── zlibpas.pas ├── puff │ ├── Makefile │ ├── README │ ├── puff.c │ ├── puff.h │ ├── pufftest.c │ └── zeros.raw ├── testzlib │ ├── testzlib.c │ └── testzlib.txt ├── untgz │ ├── Makefile │ ├── Makefile.msc │ └── untgz.c └── vstudio │ ├── readme.txt │ ├── vc10 │ ├── miniunz.vcxproj │ ├── miniunz.vcxproj.filters │ ├── miniunz.vcxproj.user │ ├── minizip.vcxproj │ ├── minizip.vcxproj.filters │ ├── minizip.vcxproj.user │ ├── testzlib.vcxproj │ ├── testzlib.vcxproj.filters │ ├── testzlib.vcxproj.user │ ├── testzlibdll.vcxproj │ ├── testzlibdll.vcxproj.filters │ ├── testzlibdll.vcxproj.user │ ├── zlib.rc │ ├── zlibstat.vcxproj │ ├── zlibstat.vcxproj.filters │ ├── zlibstat.vcxproj.user │ ├── zlibvc.def │ ├── zlibvc.sln │ ├── zlibvc.vcxproj │ ├── zlibvc.vcxproj.filters │ └── zlibvc.vcxproj.user │ └── vc9 │ ├── miniunz.vcproj │ ├── minizip.vcproj │ ├── testzlib.vcproj │ ├── testzlibdll.vcproj │ ├── zlib.rc │ ├── zlibstat.vcproj │ ├── zlibvc.def │ ├── zlibvc.sln │ └── zlibvc.vcproj ├── crc32.c ├── crc32.h ├── deflate.c ├── deflate.h ├── doc ├── algorithm.txt ├── rfc1950.txt ├── rfc1951.txt ├── rfc1952.txt └── txtvsbin.txt ├── examples ├── README.examples ├── enough.c ├── fitblk.c ├── gun.c ├── gzappend.c ├── gzjoin.c ├── gzlog.c ├── gzlog.h ├── zlib_how.html ├── zpipe.c └── zran.c ├── gzclose.c ├── gzguts.h ├── gzlib.c ├── gzread.c ├── gzwrite.c ├── infback.c ├── inffast.c ├── inffast.h ├── inffixed.h ├── inflate.c ├── inflate.h ├── inftrees.c ├── inftrees.h ├── make_vms.com ├── msdos ├── Makefile.bor ├── Makefile.dj2 ├── Makefile.emx ├── Makefile.msc └── Makefile.tc ├── nintendods ├── Makefile └── README ├── old ├── Makefile.emx ├── Makefile.riscos ├── README ├── descrip.mms ├── os2 │ ├── Makefile.os2 │ └── zlib.def └── visual-basic.txt ├── qnx └── package.qpg ├── test ├── example.c ├── infcover.c └── minigzip.c ├── treebuild.xml ├── trees.c ├── trees.h ├── uncompr.c ├── watcom ├── watcom_f.mak └── watcom_l.mak ├── win32 ├── DLL_FAQ.txt ├── Makefile.bor ├── Makefile.gcc ├── Makefile.msc ├── README-WIN32.txt ├── VisualC.txt ├── zlib.def └── zlib1.rc ├── zconf.h.cmakein ├── zconf.h.in ├── zconf.h.included ├── zlib.3 ├── zlib.3.pdf ├── zlib.h ├── zlib.map ├── zlib.pc.cmakein ├── zlib.pc.in ├── zlib2ansi ├── zutil.c └── zutil.h /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | .cproject 3 | .settings 4 | .project 5 | examples 6 | pll/CMakeFiles/ 7 | pll/Makefile 8 | pll/cmake_install.cmake 9 | pll/libpll.a 10 | pll_test/ 11 | test_scripts/iqtree_release 12 | test_scripts/iqtree_test 13 | tags 14 | test_scripts/iqtree_test_cmds.txt 15 | pllrepo/ 16 | build/ 17 | /Default-clang 18 | .idea/ 19 | .idea/codeStyleSettings.xml 20 | /GPATH 21 | /GRTAGS 22 | /GTAGS 23 | /.dir-locals.el 24 | /iqtree_config.h 25 | .DS_Store 26 | *.ipch 27 | *.log 28 | /.vs/ 29 | example/ 30 | sprng/ 31 | terraphast/ 32 | test_scripts/ 33 | vectorclass/ 34 | zlib-1.2.7/ 35 | /.direnv/ 36 | /.envrc 37 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lsd2"] 2 | path = lsd2 3 | url = https://github.com/tothuhien/lsd2.git 4 | [submodule "cmaple"] 5 | path = cmaple 6 | url = https://github.com/trongnhanuit/cmaple.git 7 | branch = dev2_2 8 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cmake.configureOnOpen": true 3 | } -------------------------------------------------------------------------------- /CMakeSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "x64-Debug", 5 | "generator": "Ninja", 6 | "configurationType": "Debug", 7 | "inheritEnvironments": [ "clang_cl_x64" ], 8 | "buildRoot": "${projectDir}\\out\\build\\${name}", 9 | "installRoot": "${projectDir}\\out\\install\\${name}", 10 | "cmakeCommandArgs": "-DEIGEN3_INCLUDE_DIR=C:\\Projects\\eigen-3.3.7 -DBoost_INCLUDE_DIR=C:\\Projects\\boost_1_73_0\\boost_1_73_0 -DIQTREE_FLAGS=mpi,fma -DMPI_DIR=c:\\Projects\\Microsoft_MPI_10_1_2", 11 | "buildCommandArgs": "", 12 | "ctestCommandArgs": "", 13 | "variables": [] 14 | }, 15 | { 16 | "name": "x64-Release", 17 | "generator": "Ninja", 18 | "configurationType": "RelWithDebInfo", 19 | "buildRoot": "${projectDir}\\out\\build\\${name}", 20 | "installRoot": "${projectDir}\\out\\install\\${name}", 21 | "cmakeCommandArgs": "-DEIGEN3_INCLUDE_DIR=C:\\Projects\\eigen-3.3.7 -DBoost_INCLUDE_DIR=C:\\Projects\\boost_1_73_0\\boost_1_73_0 -DIQTREE_FLAGS=mpi,fma -DMPI_DIR=c:\\Projects\\Microsoft_MPI_10_1_2", 22 | "buildCommandArgs": "", 23 | "ctestCommandArgs": "", 24 | "inheritEnvironments": [ "clang_cl_x64" ], 25 | "variables": [] 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /alignment/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(alignment 2 | substitution.h 3 | substitution.cpp 4 | pattern.cpp 5 | pattern.h 6 | alignment.cpp 7 | alignment.h 8 | alignmentpairwise.cpp 9 | alignmentpairwise.h 10 | alignmentsummary.cpp 11 | alignmentsummary.h 12 | maalignment.cpp 13 | maalignment.h 14 | superalignment.cpp 15 | superalignment.h 16 | superalignmentpairwise.cpp 17 | superalignmentpairwise.h 18 | superalignmentpairwiseplen.cpp 19 | superalignmentpairwiseplen.h 20 | superalignmentunlinked.cpp 21 | superalignmentunlinked.h 22 | sequence.cpp 23 | sequence.h 24 | sequencechunkstr.cpp 25 | sequencechunkstr.h 26 | ) 27 | 28 | target_link_libraries(alignment simulator ncl gsl model) 29 | -------------------------------------------------------------------------------- /alignment/sequence.cpp: -------------------------------------------------------------------------------- 1 | #include "sequence.h" 2 | 3 | Sequence::Sequence() { 4 | nums_children_done_simulation.resize(1); 5 | sequence_chunks.resize(1); 6 | num_threads_done_simulation = 0; 7 | num_threads_reach_barrier = 0; 8 | num_gaps = 0; 9 | depth = 0; 10 | insertion_pos = NULL; 11 | parent = NULL; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /alignment/sequence.h: -------------------------------------------------------------------------------- 1 | #ifndef SEQUENCE_H 2 | #define SEQUENCE_H 3 | 4 | #include "utils/tools.h" 5 | #include "tree/genometree.h" 6 | 7 | using namespace std; 8 | 9 | class Sequence { 10 | public: 11 | 12 | /** 13 | chunks of sequence 14 | */ 15 | vector> sequence_chunks; 16 | 17 | /** 18 | number of children which have completed simulating the sequence (for AliSim) 19 | */ 20 | vector nums_children_done_simulation; 21 | 22 | 23 | /** 24 | number of OPENMP threads that completed simulating the sequence (for AliSim) 25 | */ 26 | short int num_threads_done_simulation; 27 | 28 | /** 29 | number of OPENMP threads reach a barrier 30 | */ 31 | unsigned short int num_threads_reach_barrier; 32 | 33 | /** 34 | pointer to the position of the insertion event that occurs after simulating sequence at this node 35 | */ 36 | Insertion* insertion_pos; 37 | 38 | /** 39 | parent node of the current node (only use when simulating Indels with AliSim) 40 | */ 41 | Node* parent; 42 | 43 | /** 44 | number of gaps in the sequence 45 | */ 46 | int num_gaps; 47 | 48 | /** 49 | depth of the current node 50 | */ 51 | int depth; 52 | 53 | /** 54 | constructor 55 | */ 56 | Sequence(); 57 | 58 | /** 59 | deconstructor 60 | */ 61 | ~Sequence() { 62 | // do nothing, pointers should be deallocated by other tasks 63 | } 64 | }; 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /alignment/sequencechunkstr.cpp: -------------------------------------------------------------------------------- 1 | #include "sequencechunkstr.h" 2 | 3 | SequenceChunkStr::SequenceChunkStr() 4 | { 5 | chunk_status = EMPTY; 6 | pos = 0; 7 | chunk_str = ""; 8 | } 9 | 10 | SequenceChunkStr::~SequenceChunkStr() 11 | { 12 | string().swap(chunk_str); 13 | } 14 | -------------------------------------------------------------------------------- /alignment/sequencechunkstr.h: -------------------------------------------------------------------------------- 1 | #ifndef SEQUENCECHUNK_H 2 | #define SEQUENCECHUNK_H 3 | 4 | #include "utils/tools.h" 5 | 6 | /** class storing a chunk of readable sequence waiting in writing queue */ 7 | class SequenceChunkStr { 8 | public: 9 | SEQ_CHUNK_STATUS chunk_status; 10 | int64_t pos; 11 | string chunk_str; 12 | 13 | /** 14 | constructor 15 | */ 16 | SequenceChunkStr(); 17 | 18 | /** 19 | deconstructor 20 | */ 21 | ~SequenceChunkStr(); 22 | 23 | }; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /alignment/substitution.h: -------------------------------------------------------------------------------- 1 | #ifndef SUBSTITUTION_H 2 | #define SUBSTITUTION_H 3 | 4 | #include "alignment.h" 5 | 6 | /** class storing a substition (evolving from one state to another state) at a site */ 7 | class Substitution { 8 | private: 9 | /** 10 | The old state 11 | */ 12 | short int old_state; 13 | 14 | /** 15 | The new state 16 | */ 17 | short int new_state; 18 | 19 | /** 20 | Position where the substitution occurs 21 | */ 22 | int position; 23 | 24 | /** 25 | Parse a state from readable character(s) 26 | */ 27 | int parseState(const std::string& old_state_str, Alignment* const aln) const; 28 | 29 | public: 30 | /** 31 | Default constructor 32 | */ 33 | // Substitution(); 34 | 35 | /** 36 | Custom constructor from a string 37 | */ 38 | Substitution(const std::string& sub_str, Alignment* const aln, const int& seq_length); 39 | 40 | /** 41 | Get the old state 42 | */ 43 | short int getOldState() const; 44 | 45 | /** 46 | Get the new state 47 | */ 48 | short int getNewState() const; 49 | 50 | /** 51 | Get the position 52 | */ 53 | int getPosition() const; 54 | }; 55 | 56 | /** class storing a set of substitions */ 57 | class Substitutions: public std::vector { 58 | public: 59 | /** 60 | Custom constructor from a string {/.../} 61 | */ 62 | Substitutions(const std::string& sub_str, Alignment* const aln, const int& seq_length); 63 | }; 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /alignment/superalignmentpairwiseplen.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // superalignmentpairwiseplen.cpp 3 | // iqtree 4 | // 5 | // Created by Olga on 04/05/17. 6 | // 7 | // 8 | 9 | #include 10 | #include "superalignmentpairwiseplen.h" 11 | 12 | /********************************************************** 13 | * class SuperAlignmentPairwisePlen 14 | **********************************************************/ 15 | 16 | SuperAlignmentPairwisePlen::SuperAlignmentPairwisePlen(PhyloSuperTreePlen *atree, int seq1, int seq2) 17 | : SuperAlignmentPairwise((PhyloSuperTree*) atree, seq1, seq2) 18 | { 19 | part_info = &(atree->part_info); 20 | } 21 | 22 | double SuperAlignmentPairwisePlen::computeFunction(double value) { 23 | int part = 0; 24 | double lh = 0.0; 25 | for (auto it = partitions.begin(); it != partitions.end(); it++, part++) { 26 | lh += it->computeFunction(part_info->at(part).part_rate*value); 27 | } 28 | return lh; 29 | } 30 | 31 | void SuperAlignmentPairwisePlen::computeFuncDerv(double value, double &df, double &ddf) { 32 | int part = 0; 33 | df = 0.0; 34 | ddf = 0.0; 35 | for (auto it = partitions.begin(); it != partitions.end(); it++, part++) { 36 | double d1, d2; 37 | it->computeFuncDerv(part_info->at(part).part_rate*value, d1, d2); 38 | df += part_info->at(part).part_rate*d1; 39 | ddf += part_info->at(part).part_rate*part_info->at(part).part_rate*d2; 40 | } 41 | } 42 | 43 | SuperAlignmentPairwisePlen::~SuperAlignmentPairwisePlen() 44 | {} 45 | -------------------------------------------------------------------------------- /booster/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(booster 2 | bitset_index.c hashmap.c io.c sort.c tree_utils.h 3 | bitset_index.h hashmap.h io.h sort.h tree.c 4 | booster.c hashtables_bfields.c prng.c stats.c tree.h 5 | externs.h hashtables_bfields.h prng.h stats.h tree_utils.c 6 | booster.h 7 | ) 8 | 9 | -------------------------------------------------------------------------------- /booster/Makefile: -------------------------------------------------------------------------------- 1 | # Version of booster 2 | GIT_VERSION := $(shell git describe --abbrev=10 --dirty --always --tags) 3 | 4 | UNAME := $(shell uname) 5 | 6 | CFLAGS = -Wall -g -O3 -DVERSION=\"$(GIT_VERSION)\" 7 | CFLAGS_OMP = -Wall -g -fopenmp 8 | 9 | # Compiler: gcc 10 | ifeq ($(cross),win32) 11 | CC = i686-w64-mingw32-gcc 12 | else 13 | ifeq ($(cross),win64) 14 | CC = x86_64-w64-mingw32-gcc 15 | else 16 | ifeq ($(cross),linux32) 17 | CFLAGS_OMP += -m32 18 | CFLAGS += -m32 19 | else 20 | CC = gcc 21 | endif 22 | endif 23 | endif 24 | 25 | ifeq ($(UNAME),Darwin) 26 | CFLAGS_OMP += -static-libgcc 27 | #else 28 | # CFLAGS_OMP += -static 29 | endif 30 | 31 | LIBS = -lm 32 | OBJS = hashtables_bfields.o tree.o stats.o prng.o hashmap.o version.o sort.o io.o tree_utils.o bitset_index.o 33 | 34 | # default target 35 | ALL = booster 36 | 37 | INSTALL_PATH=$$HOME/bin/ 38 | 39 | all : $(ALL) 40 | 41 | %.o: %.c %.h 42 | $(CC) $(CFLAGS) -c $< 43 | 44 | # **** 45 | # the "booster" supports. Needs ref tree and bt trees. 46 | # **** 47 | booster: $(OBJS) booster.c 48 | $(CC) $(CFLAGS_OMP) -o $@ $^ $(LIBS) 49 | 50 | 51 | # **** 52 | # TESTS 53 | # **** 54 | tests: $(OBJS) test.c 55 | $(CC) $(CFLAGS) -o $@ $^ $(LIBS) 56 | 57 | test : tests 58 | ./tests 59 | 60 | .PHONY: clean 61 | 62 | clean: 63 | rm -f *~ *.o $(ALL) tests 64 | rm -rf *.dSYM 65 | 66 | install: all 67 | mkdir -p $(INSTALL_PATH) 68 | cp $(ALL) $(INSTALL_PATH) 69 | 70 | uninstall: 71 | rm $(addprefix $(INSTALL_PATH),$(ALL)) 72 | -------------------------------------------------------------------------------- /booster/booster.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | interface to call booster for transfer bootstrap expectation (TBE) 4 | @param input_tree reference tree file 5 | @param boot_trees bootstrap trees file 6 | @param out_tree output tree 7 | @param out_raw_tree output raw tree 8 | @param stat_out statistic output file 9 | @param num_threads number of threads 10 | @param quiet 1 to stay quiet, 0 otherwise 11 | */ 12 | int main_booster (const char* input_tree, const char *boot_trees, 13 | const char* out_tree, const char* out_raw_tree, const char* stat_out, 14 | int quiet); 15 | -------------------------------------------------------------------------------- /booster/externs.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | BOOSTER: BOOtstrap Support by TransfER: 4 | BOOSTER is an alternative method to compute bootstrap branch supports 5 | in large trees. It uses transfer distance between bipartitions, instead 6 | of perfect match. 7 | 8 | Copyright (C) 2017 Frederic Lemoine, Jean-Baka Domelevo Entfellner, Olivier Gascuel 9 | 10 | This program is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU General Public License 12 | as published by the Free Software Foundation; either version 2 13 | of the License, or (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program; if not, write to the Free Software 22 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 23 | 24 | */ 25 | extern int ntax; /* this is set in parse_nh, in tree.c */ 26 | -------------------------------------------------------------------------------- /booster/io.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | BOOSTER: BOOtstrap Support by TransfER: 4 | BOOSTER is an alternative method to compute bootstrap branch supports 5 | in large trees. It uses transfer distance between bipartitions, instead 6 | of perfect match. 7 | 8 | Copyright (C) 2017 Frederic Lemoine, Jean-Baka Domelevo Entfellner, Olivier Gascuel 9 | 10 | This program is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU General Public License 12 | as published by the Free Software Foundation; either version 2 13 | of the License, or (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program; if not, write to the Free Software 22 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 23 | 24 | */ 25 | 26 | #include "io.h" 27 | 28 | void Generic_Exit(const char *file, int line, const char *function, int code){ 29 | fprintf(stderr,"\n== Err. in file '%s' (line %d), function '%s'\n",file,line,function); 30 | exit(code); 31 | } 32 | -------------------------------------------------------------------------------- /booster/io.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | BOOSTER: BOOtstrap Support by TransfER: 4 | BOOSTER is an alternative method to compute bootstrap branch supports 5 | in large trees. It uses transfer distance between bipartitions, instead 6 | of perfect match. 7 | 8 | Copyright (C) 2017 Frederic Lemoine, Jean-Baka Domelevo Entfellner, Olivier Gascuel 9 | 10 | This program is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU General Public License 12 | as published by the Free Software Foundation; either version 2 13 | of the License, or (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program; if not, write to the Free Software 22 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 23 | 24 | */ 25 | 26 | #ifndef _IO_H 27 | #define _IO_H 28 | #include 29 | #include 30 | 31 | /* Taken from PhyML*/ 32 | void Generic_Exit(const char *file, int line, const char *function, int ret_code); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /booster/prng.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | BOOSTER: BOOtstrap Support by TransfER: 4 | BOOSTER is an alternative method to compute bootstrap branch supports 5 | in large trees. It uses transfer distance between bipartitions, instead 6 | of perfect match. 7 | 8 | Copyright (C) 2017 Frederic Lemoine, Jean-Baka Domelevo Entfellner, Olivier Gascuel 9 | 10 | This program is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU General Public License 12 | as published by the Free Software Foundation; either version 2 13 | of the License, or (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program; if not, write to the Free Software 22 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 23 | 24 | */ 25 | 26 | #ifndef PRNG_H_INCLUDED 27 | #define PRNG_H_INCLUDED 28 | 29 | #include 30 | 31 | long prng_seed_time (void); 32 | void prng_seed_bytes (const void *, size_t); 33 | unsigned char prng_get_octet (void); 34 | unsigned char prng_get_byte (void); 35 | void prng_get_bytes (void *, size_t); 36 | unsigned long prng_get_ulong (void); 37 | long prng_get_long (void); 38 | unsigned prng_get_uint (void); 39 | int prng_get_int (void); 40 | double prng_get_double (void); 41 | double prng_get_double_normal (void); 42 | 43 | #endif /* prng.h */ 44 | -------------------------------------------------------------------------------- /booster/sort.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | BOOSTER: BOOtstrap Support by TransfER: 4 | BOOSTER is an alternative method to compute bootstrap branch supports 5 | in large trees. It uses transfer distance between bipartitions, instead 6 | of perfect match. 7 | 8 | Copyright (C) 2017 Frederic Lemoine, Jean-Baka Domelevo Entfellner, Olivier Gascuel 9 | 10 | This program is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU General Public License 12 | as published by the Free Software Foundation; either version 2 13 | of the License, or (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program; if not, write to the Free Software 22 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 23 | 24 | */ 25 | 26 | #define _GNU_SOURCE 27 | #include 28 | 29 | #ifndef _SORT_H 30 | #define _SORT_H 31 | 32 | int comp_double(const void * elem1, const void * elem2); 33 | int comp_indexes(const void * elem1, const void * elem2, void * other_array); 34 | int comp_indexes_apple(void * other_array, const void * elem1, const void * elem2); 35 | 36 | void sort_double(double * tab, int size); 37 | void sort_indexes_double(int * indexes, int size, double * values); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /booster/version.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | BOOSTER: BOOtstrap Support by TransfER: 4 | BOOSTER is an alternative method to compute bootstrap branch supports 5 | in large trees. It uses transfer distance between bipartitions, instead 6 | of perfect match. 7 | 8 | Copyright (C) 2017 Frederic Lemoine, Jean-Baka Domelevo Entfellner, Olivier Gascuel 9 | 10 | This program is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU General Public License 12 | as published by the Free Software Foundation; either version 2 13 | of the License, or (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program; if not, write to the Free Software 22 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 23 | 24 | */ 25 | 26 | #include "version.h" 27 | 28 | void version(FILE *out, char *executable){ 29 | fprintf(out,"%s version %s\n",NAME, VERSION); 30 | } 31 | 32 | void short_version(FILE *out){ 33 | fprintf(out,"%s : version %s\n",NAME,VERSION); 34 | } 35 | -------------------------------------------------------------------------------- /doc/html/bc_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/doc/html/bc_s.png -------------------------------------------------------------------------------- /doc/html/bdwn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/doc/html/bdwn.png -------------------------------------------------------------------------------- /doc/html/closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/doc/html/closed.png -------------------------------------------------------------------------------- /doc/html/doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/doc/html/doc.png -------------------------------------------------------------------------------- /doc/html/folderclosed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/doc/html/folderclosed.png -------------------------------------------------------------------------------- /doc/html/folderopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/doc/html/folderopen.png -------------------------------------------------------------------------------- /doc/html/menudata.js: -------------------------------------------------------------------------------- 1 | /* 2 | @licstart The following is the entire license notice for the JavaScript code in this file. 3 | 4 | The MIT License (MIT) 5 | 6 | Copyright (C) 1997-2020 by Dimitri van Heesch 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 9 | and associated documentation files (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, publish, distribute, 11 | sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all copies or 15 | substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 18 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 20 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | @licend The above is the entire license notice for the JavaScript code in this file 24 | */ 25 | var menudata={children:[ 26 | {text:"Main Page",url:"index.html"}, 27 | {text:"Related Pages",url:"pages.html"}]} 28 | -------------------------------------------------------------------------------- /doc/html/nav_f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/doc/html/nav_f.png -------------------------------------------------------------------------------- /doc/html/nav_g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/doc/html/nav_g.png -------------------------------------------------------------------------------- /doc/html/nav_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/doc/html/nav_h.png -------------------------------------------------------------------------------- /doc/html/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/doc/html/open.png -------------------------------------------------------------------------------- /doc/html/search/all_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /doc/html/search/all_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['iq_2dtree_0',['IQ-TREE',['../md__r_e_a_d_m_e.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /doc/html/search/close.svg: -------------------------------------------------------------------------------- 1 | 2 | 13 | 15 | 16 | 18 | image/svg+xml 19 | 21 | 22 | 23 | 24 | 25 | 27 | 31 | 32 | -------------------------------------------------------------------------------- /doc/html/search/nomatches.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |
No Matches
11 |
12 | 13 | 14 | -------------------------------------------------------------------------------- /doc/html/search/pages_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /doc/html/search/pages_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['iq_2dtree_0',['IQ-TREE',['../md__r_e_a_d_m_e.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /doc/html/search/search_l.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/doc/html/search/search_l.png -------------------------------------------------------------------------------- /doc/html/search/search_m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/doc/html/search/search_m.png -------------------------------------------------------------------------------- /doc/html/search/search_r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/doc/html/search/search_r.png -------------------------------------------------------------------------------- /doc/html/search/searchdata.js: -------------------------------------------------------------------------------- 1 | var indexSectionsWithContent = 2 | { 3 | 0: "i", 4 | 1: "i" 5 | }; 6 | 7 | var indexSectionNames = 8 | { 9 | 0: "all", 10 | 1: "pages" 11 | }; 12 | 13 | var indexSectionLabels = 14 | { 15 | 0: "All", 16 | 1: "Pages" 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /doc/html/splitbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/doc/html/splitbar.png -------------------------------------------------------------------------------- /doc/html/sync_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/doc/html/sync_off.png -------------------------------------------------------------------------------- /doc/html/sync_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/doc/html/sync_on.png -------------------------------------------------------------------------------- /doc/html/tab_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/doc/html/tab_a.png -------------------------------------------------------------------------------- /doc/html/tab_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/doc/html/tab_b.png -------------------------------------------------------------------------------- /doc/html/tab_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/doc/html/tab_h.png -------------------------------------------------------------------------------- /doc/html/tab_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/doc/html/tab_s.png -------------------------------------------------------------------------------- /doc/latex/Makefile: -------------------------------------------------------------------------------- 1 | LATEX_CMD?=pdflatex 2 | MKIDX_CMD?=makeindex 3 | BIBTEX_CMD?=bibtex 4 | LATEX_COUNT?=8 5 | MANUAL_FILE?=refman 6 | 7 | all: $(MANUAL_FILE).pdf 8 | 9 | pdf: $(MANUAL_FILE).pdf 10 | 11 | $(MANUAL_FILE).pdf: clean $(MANUAL_FILE).tex 12 | $(LATEX_CMD) $(MANUAL_FILE) 13 | $(MKIDX_CMD) $(MANUAL_FILE).idx 14 | $(LATEX_CMD) $(MANUAL_FILE) 15 | latex_count=$(LATEX_COUNT) ; \ 16 | while egrep -s 'Rerun (LaTeX|to get cross-references right|to get bibliographical references right)' $(MANUAL_FILE).log && [ $$latex_count -gt 0 ] ;\ 17 | do \ 18 | echo "Rerunning latex...." ;\ 19 | $(LATEX_CMD) $(MANUAL_FILE) ;\ 20 | latex_count=`expr $$latex_count - 1` ;\ 21 | done 22 | $(MKIDX_CMD) $(MANUAL_FILE).idx 23 | $(LATEX_CMD) $(MANUAL_FILE) 24 | 25 | 26 | clean: 27 | rm -f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out *.brf *.blg *.bbl $(MANUAL_FILE).pdf 28 | -------------------------------------------------------------------------------- /example/custom_distributions.txt: -------------------------------------------------------------------------------- 1 | F_A 0.363799 0.313203 0.277533 0.24235 0.260252 2 | F_B 0.321134 0.299891 0.315519 0.269172 0.258165 3 | F_C 0.287641 0.309442 0.264017 0.23103 4 | F_D 0.200087 0.336534 0.337547 0.325379 0.335034 5 | F_E 0.306336 0.359459 0.249315 0.388073 6 | F_F 0.345694 0.338733 0.305404 0.294181 7 | I_A 0.257679 0.417313 0.290922 0.301826 0.292324 0.33887 8 | I_B 0.179902 0.122071 0.348381 0.33887 0.228999 9 | I_C 0.377297 0.296036 0.044523 0.262098 0.295087 10 | R_A 10.363799 20.313203 10.277533 5.24235 3.26025 11 | R_B 6.321134 0.299891 10.315519 0.269172 04.258165 12 | R_C 10.287641 8.309442 20.264017 03.23103 04.178778 13 | R_D 9.200087 10.336534 30.337547 03.325379 0.335034 14 | R_E 2.306336 4.359459 0.249315 0.388073 04.296979 15 | R_F 4.345694 06.338733 02.305404 02.294181 04.303477 16 | R_G 3.257679 07.417313 03.290922 04.301826 03.292324 17 | N_A -0.363799 -0.313203 -0.277533 0.24235 -0.260252 18 | N_B 0.321134 -0.299891 -01.315519 -0.269172 -0.258165 19 | N_C 0.287641 -0.309442 0.264017 -0.23103 0.178778 -------------------------------------------------------------------------------- /example/example.nex: -------------------------------------------------------------------------------- 1 | #nexus 2 | 3 | begin sets; 4 | charset part1 = 1-999\3 2-999\3; 5 | charset part2 = 3-999\3; 6 | charset part3 = 1000-1998; 7 | 8 | charpartition mine = HKY:part1, GTR+G:part2, GTR+G: part3; 9 | end; 10 | -------------------------------------------------------------------------------- /example/tree.nwk: -------------------------------------------------------------------------------- 1 | (A:0.3544,(B:0.1905,C:0.1328):0.0998,D:0.0898); -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "flake-utils": { 4 | "locked": { 5 | "lastModified": 1644229661, 6 | "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", 7 | "owner": "numtide", 8 | "repo": "flake-utils", 9 | "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", 10 | "type": "github" 11 | }, 12 | "original": { 13 | "owner": "numtide", 14 | "repo": "flake-utils", 15 | "type": "github" 16 | } 17 | }, 18 | "nixpkgs": { 19 | "locked": { 20 | "lastModified": 1646051047, 21 | "narHash": "sha256-XDJGACWVeNs3OAECpx20zegX/YDigHOUZ1nVmCJUeEM=", 22 | "owner": "NixOS", 23 | "repo": "nixpkgs", 24 | "rev": "21968db378c9144f418c1e8e7002316aa8b75776", 25 | "type": "github" 26 | }, 27 | "original": { 28 | "owner": "NixOS", 29 | "ref": "nixos-unstable-small", 30 | "repo": "nixpkgs", 31 | "type": "github" 32 | } 33 | }, 34 | "root": { 35 | "inputs": { 36 | "flake-utils": "flake-utils", 37 | "nixpkgs": "nixpkgs" 38 | } 39 | } 40 | }, 41 | "root": "root", 42 | "version": 7 43 | } 44 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "IQ-TREE 2"; 3 | 4 | inputs.flake-utils.url = "github:numtide/flake-utils"; 5 | 6 | inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small"; 7 | 8 | outputs = 9 | { self 10 | , flake-utils 11 | , nixpkgs 12 | }: 13 | flake-utils.lib.eachDefaultSystem ( 14 | system: 15 | let 16 | # # For Nixpkgs and the NUR repository, the following two forms are 17 | # # equivalent because the flake just imports the base directory. 18 | pkgs = nixpkgs.legacyPackages.${system}; 19 | # pkgs = import nixpkgs { 20 | # inherit system; 21 | # config = { allowUnfree = true; }; 22 | # }; 23 | in 24 | { 25 | devShell = pkgs.mkShell { 26 | packages = with pkgs; [ 27 | # See https://github.com/NixOS/nixpkgs/issues/59209. 28 | bashInteractive 29 | ]; 30 | nativeBuildInputs = with pkgs; [ cmake ]; 31 | buildInputs = with pkgs; [ boost eigen zlib ]; 32 | 33 | cmakeFlags = [ 34 | "-DIQTREE_FLAGS=omp" 35 | ]; 36 | }; 37 | } 38 | ); 39 | } 40 | -------------------------------------------------------------------------------- /gsl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(gsl 2 | binomial_tpe.cpp 3 | multinomial.cpp 4 | pow_int.cpp 5 | gauss.cpp 6 | gaussinv.cpp 7 | gausspdf.cpp 8 | mygsl.h 9 | ) 10 | -------------------------------------------------------------------------------- /gsl/gausspdf.cpp: -------------------------------------------------------------------------------- 1 | /* randist/gauss.c 2 | * 3 | * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2006, 2007 James Theiler, Brian Gough 4 | * Copyright (C) 2006 Charles Karney 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3 of the License, or (at 9 | * your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | //#include 22 | #include 23 | //#include 24 | //#include 25 | //#include 26 | 27 | double 28 | gsl_ran_gaussian_pdf (const double x, const double sigma) 29 | { 30 | double u = x / fabs (sigma); 31 | double p = (1 / (sqrt (2 * 3.14159265358979323846264338327950288) * fabs (sigma))) * exp (-u * u / 2); 32 | return p; 33 | } 34 | 35 | double 36 | gsl_ran_ugaussian_pdf (const double x) 37 | { 38 | return gsl_ran_gaussian_pdf (x, 1.0); 39 | } 40 | 41 | -------------------------------------------------------------------------------- /gsl/gsl_nan.h: -------------------------------------------------------------------------------- 1 | /* gsl_nan.h 2 | * 3 | * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __GSL_NAN_H__ 21 | #define __GSL_NAN_H__ 22 | 23 | #ifdef INFINITY 24 | # define GSL_POSINF INFINITY 25 | # define GSL_NEGINF (-INFINITY) 26 | #elif defined(HUGE_VAL) 27 | # define GSL_POSINF HUGE_VAL 28 | # define GSL_NEGINF (-HUGE_VAL) 29 | #else 30 | # define GSL_POSINF (gsl_posinf()) 31 | # define GSL_NEGINF (gsl_neginf()) 32 | #endif 33 | 34 | #ifdef NAN 35 | # define GSL_NAN NAN 36 | #elif defined(INFINITY) 37 | # define GSL_NAN (INFINITY/INFINITY) 38 | #else 39 | # define GSL_NAN (gsl_nan()) 40 | #endif 41 | 42 | #define GSL_POSZERO (+0.0) 43 | #define GSL_NEGZERO (-0.0) 44 | 45 | #endif /* __GSL_NAN_H__ */ 46 | -------------------------------------------------------------------------------- /gsl/rat_eval.h: -------------------------------------------------------------------------------- 1 | static double 2 | rat_eval (const double a[], const size_t na, 3 | const double b[], const size_t nb, const double x) 4 | { 5 | size_t i, j; 6 | double u, v, r; 7 | 8 | u = a[na - 1]; 9 | 10 | for (i = na - 1; i > 0; i--) 11 | { 12 | u = x * u + a[i - 1]; 13 | } 14 | 15 | v = b[nb - 1]; 16 | 17 | for (j = nb - 1; j > 0; j--) 18 | { 19 | v = x * v + b[j - 1]; 20 | } 21 | 22 | r = u / v; 23 | 24 | return r; 25 | } 26 | -------------------------------------------------------------------------------- /iqtree_config.h.in: -------------------------------------------------------------------------------- 1 | #define iqtree_VERSION_MAJOR @iqtree_VERSION_MAJOR@ 2 | #define iqtree_VERSION_MINOR @iqtree_VERSION_MINOR@ 3 | #define iqtree_VERSION_PATCH "@iqtree_VERSION_PATCH@" 4 | 5 | /* does the platform provide gettimeofday functions? */ 6 | #cmakedefine HAVE_GETTIMEOFDAY 7 | /* does the platform provide getrusage functions? */ 8 | #cmakedefine HAVE_GETRUSAGE 9 | /* does the platform provide popen functions? */ 10 | /*#cmakedefine HAVE_POPEN*/ 11 | /* does the platform provide pclose functions? */ 12 | /*#cmakedefine HAVE_PCLOSE*/ 13 | /* does the platform provide GlobalMemoryStatusEx functions? */ 14 | #cmakedefine HAVE_GLOBALMEMORYSTATUSEX 15 | #cmakedefine HAVE_STRNDUP 16 | #cmakedefine HAVE_STRTOK_R 17 | 18 | /* does the platform provide backtrace functions? */ 19 | #cmakedefine Backtrace_FOUND 20 | -------------------------------------------------------------------------------- /lbfgsb/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(lbfgsb 2 | lbfgsb_new.cpp 3 | ) 4 | -------------------------------------------------------------------------------- /lib/libiomp5md.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/lib/libiomp5md.dll -------------------------------------------------------------------------------- /lib/libomp.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/lib/libomp.a -------------------------------------------------------------------------------- /lib/libompstatic.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/lib/libompstatic.a -------------------------------------------------------------------------------- /lib/pthreadGC2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/lib/pthreadGC2.dll -------------------------------------------------------------------------------- /lib/pthreadGC2_64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/lib/pthreadGC2_64.dll -------------------------------------------------------------------------------- /lib/pthreadVC2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/lib/pthreadVC2.dll -------------------------------------------------------------------------------- /lib/pthreadVC2.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/lib/pthreadVC2.lib -------------------------------------------------------------------------------- /libmac/libomp.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/libmac/libomp.a -------------------------------------------------------------------------------- /libmac_m1/libomp.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/libmac_m1/libomp.a -------------------------------------------------------------------------------- /main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(main 2 | main.cpp 3 | phyloanalysis.cpp 4 | phyloanalysis.h 5 | phylotesting.cpp 6 | phylotesting.h 7 | treetesting.cpp 8 | treetesting.h 9 | timetree.cpp 10 | timetree.h 11 | alisim.cpp 12 | alisim.h 13 | terraceanalysis.cpp 14 | terraceanalysis.h 15 | ) 16 | 17 | if (USE_BOOSTER) 18 | target_link_libraries(main booster) 19 | endif() 20 | 21 | if (USE_LSD2) 22 | target_link_libraries(main lsd2) 23 | endif() 24 | 25 | if (USE_NN OR USE_OLD_NN) 26 | target_link_libraries(main nn) 27 | endif() 28 | 29 | target_link_libraries(main pda whtest vectorclass terrace) 30 | 31 | if (USE_CMAPLE) 32 | target_link_libraries(main maple) 33 | 34 | if (USE_CMAPLE_AA) 35 | add_library(main-aa 36 | main.cpp 37 | phyloanalysis.cpp 38 | phyloanalysis.h 39 | phylotesting.cpp 40 | phylotesting.h 41 | treetesting.cpp 42 | treetesting.h 43 | timetree.cpp 44 | timetree.h 45 | alisim.cpp 46 | alisim.h 47 | terraceanalysis.cpp 48 | terraceanalysis.h 49 | ) 50 | 51 | if (USE_BOOSTER) 52 | target_link_libraries(main-aa booster) 53 | endif() 54 | 55 | if (USE_LSD2) 56 | target_link_libraries(main-aa lsd2) 57 | endif() 58 | 59 | target_link_libraries(main-aa pda whtest vectorclass terrace maple-aa) 60 | endif() 61 | endif() 62 | -------------------------------------------------------------------------------- /main/terraceanalysis.h: -------------------------------------------------------------------------------- 1 | /* 2 | * terraceanalysis.ch 3 | * Interface to work with terraces 4 | * Created on: Sep 10, 2020 5 | * Author: Olga 6 | */ 7 | 8 | #ifndef terraceanalysis_hpp 9 | #define terraceanalysis_hpp 10 | 11 | #include 12 | #include "utils/tools.h" 13 | #include "terrace/terrace.hpp" 14 | 15 | /* 16 | * Main function for terrace analysis 17 | */ 18 | void runterraceanalysis(Params ¶ms); 19 | 20 | /* 21 | * Run terrace check: 22 | * - check if query trees lie on the same terrace with a representative tree. Naive pairwise comparison of induced partition trees. 23 | */ 24 | void run_terrace_check(Terrace *terrace, Params ¶ms); 25 | 26 | 27 | /** 28 | This is the function that calls generation of terrace trees, when the input data (representative tree and presence-absence matrix are processed already) 29 | */ 30 | void run_generate_trees(Terrace *terrace, Params ¶ms,const int m); 31 | 32 | /** 33 | The function is used to read a set of subtrees to be considered as partition trees for terrace analysis 34 | */ 35 | void read_tree_set(const char *infile, bool &is_rooted, vector &subtrees); 36 | 37 | #endif /* terraceanalysis_hpp */ 38 | -------------------------------------------------------------------------------- /main/timetree.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Time tree for phylogenetic dating 3 | * 4 | * Created on: Apr 4, 2020 5 | * Author: minh 6 | */ 7 | 8 | #ifndef TIMETREE_H_ 9 | #define TIMETREE_H_ 10 | 11 | #include "tree/phylotree.h" 12 | 13 | /** 14 | main function to build time-tree 15 | @param tree input phylogenetic tree 16 | */ 17 | void doTimeTree(PhyloTree *tree); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /model/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(model 2 | modelmarkov.cpp modelmarkov.h 3 | modelbin.cpp modelbin.h 4 | modeldna.cpp modeldna.h 5 | modeldnaerror.cpp modeldnaerror.h 6 | modelfactory.cpp modelfactory.h 7 | modelprotein.cpp modelprotein.h 8 | modelset.cpp modelset.h 9 | modelsubst.cpp modelsubst.h 10 | partitionmodel.cpp partitionmodel.h 11 | partitionmodelplen.cpp partitionmodelplen.h 12 | rategamma.cpp rategamma.h 13 | rategammainvar.cpp rategammainvar.h 14 | ratecontinuousgamma.cpp ratecontinuousgamma.h 15 | ratecontinuousgammainvar.cpp ratecontinuousgammainvar.h 16 | rateheterogeneity.cpp rateheterogeneity.h 17 | rateinvar.cpp rateinvar.h 18 | ratemeyerdiscrete.cpp ratemeyerdiscrete.h 19 | ratemeyerhaeseler.cpp ratemeyerhaeseler.h 20 | ratekategory.cpp ratekategory.h 21 | ratefree.cpp ratefree.h 22 | ratefreeinvar.cpp ratefreeinvar.h 23 | rateheterotachy.cpp rateheterotachy.h 24 | rateheterotachyinvar.cpp rateheterotachyinvar.h 25 | modelcodon.cpp modelcodon.h 26 | modelmorphology.cpp modelmorphology.h 27 | modelmixture.cpp modelmixture.h 28 | modelunrest.cpp modelunrest.h 29 | modelliemarkov.cpp modelliemarkov.h 30 | modelpomo.cpp modelpomo.h 31 | modelpomomixture.cpp modelpomomixture.h 32 | modelfactorymixlen.cpp modelfactorymixlen.h 33 | modelhmm.cpp modelhmm.h 34 | modelhmmgm.cpp modelhmmgm.h 35 | modelhmmtm.cpp modelhmmtm.h 36 | modelcodonmixture.cpp modelcodonmixture.h 37 | ) 38 | 39 | target_link_libraries(model utils) 40 | -------------------------------------------------------------------------------- /model/modelcodonempirical.h: -------------------------------------------------------------------------------- 1 | /* 2 | * modelcodonempirical.h 3 | * 4 | * Created on: May 29, 2013 5 | * Author: minh 6 | */ 7 | 8 | #ifndef MODELCODONEMPIRICAL_H_ 9 | #define MODELCODONEMPIRICAL_H_ 10 | 11 | #include "modelcodon.h" 12 | 13 | /** 14 | * empirical codon model (e.g., Kosiol et al. 2007) 15 | */ 16 | class ModelCodonEmpirical: virtual public ModelCodon { 17 | public: 18 | /** 19 | constructor 20 | @param model_name model name, e.g., GY,YN 21 | @param freq state frequency type 22 | @param tree associated phylogenetic tree 23 | */ 24 | ModelCodonEmpirical(const char *model_name, string model_params, StateFreqType freq, string freq_params, 25 | PhyloTree *tree, bool count_rates = true); 26 | 27 | /** 28 | * destructor 29 | */ 30 | virtual ~ModelCodonEmpirical(); 31 | 32 | /** 33 | initialization, called automatically by the constructor, no need to call it 34 | @param model_name model name, e.g., JC, HKY. 35 | @param freq state frequency type 36 | */ 37 | virtual void init(const char *model_name, string model_params, StateFreqType freq, string freq_params); 38 | 39 | 40 | /** 41 | * read codon model from a stream, modying rates and state_freq accordingly 42 | * @param in input stream containing lower triangular matrix of rates, frequencies and list of codons 43 | */ 44 | void readCodonModel(istream &in); 45 | 46 | }; 47 | 48 | #endif /* MODELCODONEMPIRICAL_H_ */ 49 | -------------------------------------------------------------------------------- /model/modelcodonparametric.h: -------------------------------------------------------------------------------- 1 | /* 2 | * modelcodonparametric.h 3 | * 4 | * Created on: May 29, 2013 5 | * Author: minh 6 | */ 7 | 8 | #ifndef MODELCODONPARAMETRIC_H_ 9 | #define MODELCODONPARAMETRIC_H_ 10 | 11 | #include "modelcodon.h" 12 | 13 | /** 14 | * parametric codon model (e.g., Goldman-Yang, Muse-Gaut) 15 | */ 16 | class ModelCodonParametric: virtual public ModelCodon { 17 | public: 18 | /** 19 | constructor 20 | @param model_name model name, e.g., GY,YN 21 | @param freq state frequency type 22 | @param tree associated phylogenetic tree 23 | */ 24 | ModelCodonParametric(const char *model_name, string model_params, StateFreqType freq, string freq_params, 25 | PhyloTree *tree, bool count_rates = true); 26 | 27 | /** 28 | * destructor 29 | */ 30 | virtual ~ModelCodonParametric(); 31 | 32 | /** 33 | initialization, called automatically by the constructor, no need to call it 34 | @param model_name model name, e.g., JC, HKY. 35 | @param freq state frequency type 36 | */ 37 | virtual void init(const char *model_name, string model_params, StateFreqType freq, string freq_params); 38 | 39 | /** 40 | write information 41 | @param out output stream 42 | */ 43 | virtual void writeInfo(ostream &out); 44 | 45 | protected: 46 | 47 | /** initialize Muse-Gaut 1994 model */ 48 | void initMG94(); 49 | 50 | /** initialize Goldman-Yang 1994 model (simplified version with 2 parameters omega and kappa */ 51 | void initGY94(); 52 | 53 | 54 | }; 55 | 56 | #endif /* MODELCODONPARAMETRIC_H_ */ 57 | -------------------------------------------------------------------------------- /model/modelcodonsemiempirical.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * modelcodonsemiempirical.cpp 3 | * 4 | * Created on: May 29, 2013 5 | * Author: minh 6 | */ 7 | 8 | #include "modelcodonsemiempirical.h" 9 | 10 | ModelCodonSemiEmpirical::ModelCodonSemiEmpirical(const char *model_name, string model_params, 11 | StateFreqType freq, string freq_params, PhyloTree *tree, bool count_rates) : 12 | ModelCodon(tree, count_rates) 13 | { 14 | init(model_name, model_params, freq, freq_params); 15 | } 16 | 17 | 18 | ModelCodonSemiEmpirical::~ModelCodonSemiEmpirical() { 19 | } 20 | 21 | 22 | void ModelCodonSemiEmpirical::init(const char *model_name, string model_params, StateFreqType freq, string freq_params) { 23 | name = full_name = model_name; 24 | size_t pos = name.find('+'); 25 | ASSERT(pos != string::npos); 26 | if (name.substr(0,3) == "ECM") { 27 | ModelCodonEmpirical::init(name.substr(0,pos), "", FREQ_USER_DEFINED, ""); 28 | ModelCodonParametric::init(name.substr(pos), model_params, freq, freq_params); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /model/modelcodonsemiempirical.h: -------------------------------------------------------------------------------- 1 | /* 2 | * modelcodonsemiempirical.h 3 | * 4 | * Created on: May 29, 2013 5 | * Author: minh 6 | */ 7 | 8 | #ifndef MODELCODONSEMIEMPIRICAL_H_ 9 | #define MODELCODONSEMIEMPIRICAL_H_ 10 | 11 | #include "modelcodonempirical.h" 12 | #include "modelcodonparametric.h" 13 | 14 | class ModelCodonSemiEmpirical: public ModelCodonEmpirical, public ModelCodonParametric { 15 | public: 16 | /** 17 | constructor 18 | @param model_name model name, e.g., GY,YN 19 | @param freq state frequency type 20 | @param tree associated phylogenetic tree 21 | */ 22 | ModelCodonSemiEmpirical(const char *model_name, string model_params, StateFreqType freq, string freq_params, 23 | PhyloTree *tree, bool count_rates = true); 24 | 25 | 26 | /** 27 | * destructor 28 | */ 29 | virtual ~ModelCodonSemiEmpirical(); 30 | 31 | /** 32 | initialization, called automatically by the constructor, no need to call it 33 | @param model_name model name, e.g., JC, HKY. 34 | @param freq state frequency type 35 | */ 36 | virtual void init(const char *model_name, string model_params, StateFreqType freq, string freq_params); 37 | 38 | }; 39 | 40 | #endif /* MODELCODONSEMIEMPIRICAL_H_ */ 41 | -------------------------------------------------------------------------------- /model/modelfactorymixlen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * modelfactorymixlen.h 3 | * 4 | * Created on: Sep 2, 2015 5 | * Author: minh 6 | */ 7 | 8 | 9 | #include "modelfactory.h" 10 | 11 | class ModelFactoryMixlen : public ModelFactory { 12 | 13 | public: 14 | 15 | /** 16 | constructor 17 | create substitution model with possible rate heterogeneity. Create proper class objects 18 | for two variables: model and site_rate. It takes the following field of params into account: 19 | model_name, num_rate_cats, freq_type, store_trans_matrix 20 | @param params program parameters 21 | @param tree associated phylogenetic tree 22 | */ 23 | ModelFactoryMixlen(Params ¶ms, string &model_name, PhyloTree *tree, ModelsBlock *models_block); 24 | 25 | /** 26 | optimize model parameters and tree branch lengths 27 | @param fixed_len TRUE to fix branch lengths, default is false 28 | @return the best likelihood 29 | */ 30 | virtual double optimizeParameters(int fixed_len = BRLEN_OPTIMIZE, bool write_info = true, 31 | double logl_epsilon = 0.1, double gradient_epsilon = 0.0001); 32 | 33 | /** 34 | sort classes in ascending order of tree lengths 35 | @return tree string with sorted branch lengths 36 | */ 37 | string sortClassesByTreeLength(); 38 | 39 | 40 | /** 41 | * @param brlen_type either BRLEN_OPTIMIZE, BRLEN_FIX or BRLEN_SCALE 42 | * @return #parameters of the model + # branches 43 | */ 44 | virtual int getNParameters(int brlen_type); 45 | 46 | }; 47 | -------------------------------------------------------------------------------- /model/modelnonrev.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/model/modelnonrev.cpp -------------------------------------------------------------------------------- /model/modelnonrev.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/model/modelnonrev.h -------------------------------------------------------------------------------- /model/modelunrest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * modelunrest.h 3 | * 4 | * Created on: 24/05/2016 5 | * Author: Michael Woodhams 6 | */ 7 | 8 | #ifndef MODELUNREST_H_ 9 | #define MODELUNREST_H_ 10 | 11 | #include "modelmarkov.h" 12 | 13 | class ModelUnrest: public ModelMarkov { 14 | public: 15 | 16 | /** constructor */ 17 | ModelUnrest(PhyloTree *tree, string model_params, StateFreqType freq_type, string freq_params); 18 | 19 | /** 20 | * true if model_name is the name of some known non-reversible model 21 | */ 22 | static bool validModelName(string model_name); 23 | 24 | /** 25 | * setup the bounds for joint optimization with BFGS 26 | */ 27 | virtual void setBounds(double *lower_bound, double *upper_bound, bool *bound_check); 28 | 29 | /** 30 | set the state frequency vector. 31 | @param state_freq state frequency vector. Assume state_freq has size of num_states 32 | */ 33 | virtual void setStateFrequency(double *state_freq); 34 | 35 | /** 36 | start structure for checkpointing 37 | */ 38 | virtual void startCheckpoint(); 39 | 40 | /** 41 | save object into the checkpoint 42 | */ 43 | virtual void saveCheckpoint(); 44 | 45 | /** 46 | restore object from the checkpoint 47 | */ 48 | virtual void restoreCheckpoint(); 49 | 50 | protected: 51 | void writeInfo(ostream &out); 52 | virtual void setRates(); 53 | }; 54 | 55 | #endif /* MODELUNREST_H_ */ 56 | -------------------------------------------------------------------------------- /ncl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(ncl 2 | nxsassumptionsblock.cpp 3 | nxsblock.cpp 4 | nxscharactersblock.cpp 5 | nxsdatablock.cpp 6 | nxsdiscretedatum.cpp 7 | nxsdiscretematrix.cpp 8 | nxsdistancedatum.cpp 9 | nxsdistancesblock.cpp 10 | nxsemptyblock.cpp 11 | nxsexception.cpp 12 | nxsreader.cpp 13 | nxssetreader.cpp 14 | nxsstring.cpp 15 | nxstaxablock.cpp 16 | nxstoken.cpp 17 | nxstreesblock.cpp) 18 | -------------------------------------------------------------------------------- /ncl/nxsdatablock.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 1999-2003 Paul O. Lewis 2 | // 3 | // This file is part of NCL (Nexus Class Library) version 2.0. 4 | // 5 | // NCL is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation; either version 2 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // NCL is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with NCL; if not, write to the Free Software Foundation, Inc., 17 | // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | // 19 | 20 | #ifndef NCL_NXSDATABLOCK_H 21 | #define NCL_NXSDATABLOCK_H 22 | 23 | /*---------------------------------------------------------------------------------------------------------------------- 24 | | This class handles reading and storage for the NEXUS block DATA. It is derived from the NxsCharactersBlock class, 25 | | and differs from NxsCharactersBlock only in name and the fact that `newtaxa' is initially true rather than false. 26 | */ 27 | class NxsDataBlock 28 | : public NxsCharactersBlock 29 | { 30 | public: 31 | NxsDataBlock(NxsTaxaBlock *tb, NxsAssumptionsBlock *ab); 32 | 33 | void TransferTo(NxsCharactersBlock &charactersblock); 34 | void Reset(); 35 | }; 36 | 37 | typedef NxsDataBlock DataBlock; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /ncl/nxsdistancedatum.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 1999-2003 Paul O. Lewis 2 | // 3 | // This file is part of NCL (Nexus Class Library) version 2.0. 4 | // 5 | // NCL is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation; either version 2 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // NCL is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with NCL; if not, write to the Free Software Foundation, Inc., 17 | // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | // 19 | 20 | #include "ncl.h" 21 | 22 | /*---------------------------------------------------------------------------------------------------------------------- 23 | | Initializes value to 0.0 and missing to true. 24 | */ 25 | NxsDistanceDatum::NxsDistanceDatum() 26 | { 27 | missing = true; 28 | value = 0.0; 29 | } 30 | 31 | /*---------------------------------------------------------------------------------------------------------------------- 32 | | Does nothing. 33 | */ 34 | NxsDistanceDatum::~NxsDistanceDatum() 35 | { 36 | } 37 | -------------------------------------------------------------------------------- /nclextra/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(nclextra 2 | mpdablock.cpp mpdablock.h 3 | msetsblock.cpp msetsblock.h 4 | msplitsblock.cpp msplitsblock.h 5 | modelsblock.cpp modelsblock.h 6 | ) 7 | -------------------------------------------------------------------------------- /nn/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(nn 2 | neuralnetwork.cpp 3 | neuralnetwork.h 4 | ) 5 | 6 | target_link_libraries(nn alignment) 7 | -------------------------------------------------------------------------------- /nn/neuralnetwork.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by tamara on 3/8/21. 3 | // 4 | 5 | #ifndef IQTREE_NEURALNETWORK_H 6 | #define IQTREE_NEURALNETWORK_H 7 | 8 | #include 9 | #include 10 | 11 | class NeuralNetwork { 12 | public: 13 | /** constructor */ 14 | NeuralNetwork(Alignment *alignment); 15 | 16 | /** destructor */ 17 | virtual ~NeuralNetwork(); 18 | 19 | double doAlphaInference(); 20 | string doModelInference(); 21 | 22 | Alignment *alignment; 23 | 24 | }; 25 | 26 | 27 | #endif //IQTREE_NEURALNETWORK_H 28 | -------------------------------------------------------------------------------- /nn_models/lanfear_alpha_lstm.onnx: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:0fe3e55d7cddbd7716c2c22c91acba2900831a056d65a5005b5b1e139aed7260 3 | size 82114237 4 | -------------------------------------------------------------------------------- /nn_models/resnet_modelfinder.onnx: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:990e788b2a5480de1dfbc1cedb2acaed097cd7dec7a91325adb05b524de97ba2 3 | size 107534983 4 | -------------------------------------------------------------------------------- /onnxruntimeConfig.cmake: -------------------------------------------------------------------------------- 1 | # Custom cmake config file by jcarius to enable find_package(onnxruntime) without modifying LIBRARY_PATH and LD_LIBRARY_PATH 2 | # Place file at ~/.local/share/cmake/onnxruntime 3 | # This will define the following variables: 4 | # onnxruntime_FOUND -- True if the system has the onnxruntime library 5 | # onnxruntime_INCLUDE_DIRS -- The include directories for onnxruntime 6 | # onnxruntime_LIBRARIES -- Libraries to link against 7 | # onnxruntime_CXX_FLAGS -- Additional (required) compiler flags 8 | 9 | include(FindPackageHandleStandardArgs) 10 | 11 | # Assume we are in /share/cmake/onnxruntime/onnxruntimeConfig.cmake 12 | get_filename_component(CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) 13 | get_filename_component(onnxruntime_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE) 14 | 15 | set(onnxruntime_INCLUDE_DIRS ${onnxruntime_INSTALL_PREFIX}/include) 16 | set(onnxruntime_LIBRARIES onnxruntime) 17 | set(onnxruntime_CXX_FLAGS "") # no flags needed 18 | 19 | 20 | find_library(onnxruntime_LIBRARY onnxruntime 21 | PATHS "${onnxruntime_INSTALL_PREFIX}/lib" 22 | ) 23 | 24 | add_library(onnxruntime SHARED IMPORTED) 25 | set_property(TARGET onnxruntime PROPERTY IMPORTED_LOCATION "${onnxruntime_LIBRARY}") 26 | set_property(TARGET onnxruntime PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${onnxruntime_INCLUDE_DIRS}") 27 | set_property(TARGET onnxruntime PROPERTY INTERFACE_COMPILE_OPTIONS "${onnxruntime_CXX_FLAGS}") 28 | 29 | find_package_handle_standard_args(onnxruntime DEFAULT_MSG onnxruntime_LIBRARY onnxruntime_INCLUDE_DIRS) 30 | -------------------------------------------------------------------------------- /pda/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(pda 2 | circularnetwork.cpp circularnetwork.h 3 | greedy.cpp greedy.h 4 | gurobiwrapper.cpp gurobiwrapper.h 5 | hashsplitset.cpp hashsplitset.h 6 | pdnetwork.cpp pdnetwork.h 7 | pruning.cpp pruning.h 8 | split.cpp split.h 9 | splitgraph.cpp splitgraph.h 10 | splitset.cpp splitset.h 11 | lpwrapper.c lpwrapper.h 12 | ecopd.cpp ecopd.h 13 | graph.cpp graph.h 14 | pdtree.cpp pdtree.h 15 | pdtreeset.cpp pdtreeset.h 16 | ecopdmtreeset.cpp ecopdmtreeset.h 17 | ) 18 | 19 | target_link_libraries(pda nclextra) 20 | -------------------------------------------------------------------------------- /pda/ecopdmtreeset.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * EcoPDmtreeset.cpp 3 | * 4 | * Created on: Nov 4, 2013 5 | * Author: olga 6 | */ 7 | 8 | #include "ecopdmtreeset.h" 9 | #include "tree/mtreeset.h" 10 | 11 | EcoPDmtreeset::EcoPDmtreeset() { 12 | } 13 | 14 | EcoPDmtreeset::~EcoPDmtreeset() { 15 | } 16 | 17 | EcoPDmtreeset::EcoPDmtreeset(const char *userTreeFile, bool &is_rooted, 18 | int burnin, int max_count, const char *tree_weight_file) { 19 | initEcoSD(userTreeFile, is_rooted, burnin, max_count, tree_weight_file); 20 | } 21 | 22 | void EcoPDmtreeset::initEcoSD(const char *userTreeFile, bool &is_rooted, int burnin, int max_count, 23 | const char *tree_weight_file, IntVector *weights, bool compressed) 24 | { 25 | readTrees(userTreeFile, is_rooted, burnin, max_count, weights, compressed); 26 | //checkConsistency(); 27 | 28 | if (tree_weight_file) 29 | readIntVector(tree_weight_file, burnin, max_count, tree_weights); 30 | /* else if (!weights) 31 | tree_weights.resize(size(), 1);*/ 32 | 33 | if (size() != tree_weights.size()) 34 | outError("Tree file and tree weight file have different number of entries"); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /pda/ecopdmtreeset.h: -------------------------------------------------------------------------------- 1 | /* 2 | * EcoPDmtreeset.h 3 | * 4 | * Created on: Nov 4, 2013 5 | * Author: olga 6 | */ 7 | 8 | #ifndef ECOPDMTREESET_H_ 9 | #define ECOPDMTREESET_H_ 10 | 11 | #include "tree/mtreeset.h" 12 | 13 | class EcoPDmtreeset : public MTreeSet 14 | { 15 | public: 16 | EcoPDmtreeset(); 17 | 18 | /** 19 | constructor, read trees from user file 20 | @param userTreeFile the name of the user trees 21 | @param is_rooted (IN/OUT) true if tree is rooted 22 | @param burnin the number of beginning trees to be discarded 23 | @param max_count max number of trees to load 24 | */ 25 | EcoPDmtreeset(const char *userTreeFile, bool &is_rooted, int burnin, int max_count, 26 | const char *tree_weight_file = NULL); 27 | 28 | void initEcoSD(const char *userTreeFile, bool &is_rooted, int burnin, int max_count, 29 | const char *tree_weight_file = NULL, IntVector *weights = NULL, bool compressed = false); 30 | 31 | 32 | virtual ~EcoPDmtreeset(); 33 | }; 34 | 35 | #endif /* ECOPDMTREESET_H_ */ 36 | -------------------------------------------------------------------------------- /pda/graph.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/pda/graph.cpp -------------------------------------------------------------------------------- /pda/graph.h: -------------------------------------------------------------------------------- 1 | /* 2 | * graph.h 3 | * 4 | * Created on: Nov 14, 2013 5 | * Author: olga 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #ifndef GRAPH_H_ 13 | #define GRAPH_H_ 14 | 15 | using namespace std; 16 | 17 | class Graph 18 | { 19 | int V; // No. of vertices 20 | list *adj; // Pointer to an array containing adjacency lists 21 | bool isCyclicUtil(int v, bool visited[], bool *rs); // used by isCyclic() 22 | 23 | public: 24 | Graph(int V); // Constructor 25 | void addEdge(int v, int w); // to add an edge to graph 26 | bool isCyclic(); // returns true if there is a cycle in this graph 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /phylo-yaml/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(phyloYAML 2 | statespace.h 3 | statespace.cpp 4 | ) 5 | 6 | target_link_libraries(phyloYAML yaml-cpp) 7 | -------------------------------------------------------------------------------- /pll/hardware.h: -------------------------------------------------------------------------------- 1 | #ifndef PLL_HARDWARE 2 | #define PLL_HARDWARE 3 | 4 | /* leaf 1 */ 5 | /* edx */ 6 | #define PLL_HAS_MMX 1 << 23 7 | #define PLL_HAS_SSE 1 << 25 8 | #define PLL_HAS_SSE2 1 << 26 9 | 10 | /* ecx */ 11 | #define PLL_HAS_SSE3 1 12 | #define PLL_HAS_SSSE3 1 << 9 13 | #define PLL_HAS_FMA 1 << 12 14 | #define PLL_HAS_SSE41 1 << 19 15 | #define PLL_HAS_SSE42 1 << 20 16 | #define PLL_HAS_AVX 1 << 28 17 | 18 | 19 | /* leaf 7 */ 20 | /* ebx */ 21 | #define PLL_HAS_AVX2 1 << 5 22 | 23 | /* leaf 0x80000001 */ 24 | /* ecx*/ 25 | #define PLL_HAS_SSE4A 1 << 6 26 | #define PLL_HAS_FMA4 1 << 16 27 | 28 | typedef struct 29 | { 30 | int has_mmx; 31 | int has_sse; 32 | int has_sse2; 33 | int has_sse3; 34 | int has_ssse3; 35 | int has_sse41; 36 | int has_sse42; 37 | int has_sse4a; 38 | int has_avx; 39 | int has_avx2; 40 | int has_fma; 41 | int has_fma4; 42 | int cpu_sockets; 43 | int cores; 44 | char vendor[13]; 45 | 46 | } pllHardwareInfo; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /pll/systypes.h: -------------------------------------------------------------------------------- 1 | #ifdef WIN32 2 | #include 3 | #endif 4 | 5 | #if !defined(WIN32) && !defined(WIN64) 6 | #include 7 | #include 8 | #include 9 | #include 10 | #endif 11 | -------------------------------------------------------------------------------- /pll/treeIO.h: -------------------------------------------------------------------------------- 1 | /* 2 | * treeIO.h 3 | * 4 | * Created on: Nov 22, 2012 5 | * Author: tung 6 | */ 7 | 8 | /* 9 | I just put some declarations of the functions that I need here. 10 | Please extend this file. It's important to have a header file. 11 | It make things much easier for the integration with other software. 12 | */ 13 | 14 | #ifndef TREEIO_H_ 15 | #define TREEIO_H_ 16 | 17 | #include "pll.h" 18 | 19 | char *pllTreeToNewick(char *treestr, tree *tr, nodeptr p, pllBoolean printBranchLengths, pllBoolean printNames, pllBoolean printLikelihood, 20 | pllBoolean rellTree, pllBoolean finalPrint, int perGene, pllBoolean branchLabelSupport, pllBoolean printSHSupport); 21 | double getBranchLength(pllInstance *tr, partitionList *pr, int perGene, nodeptr p); 22 | 23 | #endif /* TREEIO_H_ */ 24 | -------------------------------------------------------------------------------- /simulator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(simulator 2 | alisimulator.cpp alisimulator.h 3 | alisimulatorinvar.cpp alisimulatorinvar.h 4 | alisimulatorheterogeneity.cpp alisimulatorheterogeneity.h 5 | alisimulatorheterogeneityinvar.cpp alisimulatorheterogeneityinvar.h 6 | ) 7 | target_link_libraries(simulator alignment ncl gsl model) 8 | -------------------------------------------------------------------------------- /sprng/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(sprng 2 | lcg64.c 3 | makeseed.c 4 | memory.c 5 | store.c 6 | primes-lcg64.c 7 | checkid.c) 8 | -------------------------------------------------------------------------------- /sprng/README: -------------------------------------------------------------------------------- 1 | The original source files are from the SPRNG (Scalable Pseudo Random 2 | Number Generator) library package. 3 | 4 | Mascagni, Michael and Srinivasan, Ashok (2000) 5 | SPRNG: A Scalable Library for Pseudorandom Number Generation. 6 | ACM Trans. Math. Software, 26:436-461, DOI: 10.1145/358407.358427 7 | 8 | -------------------------------------------------------------------------------- /sprng/makeseed.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef __STDC__ 4 | int make_new_seed() 5 | #else 6 | int make_new_seed() 7 | #endif 8 | { 9 | time_t tp; 10 | struct tm *temp; 11 | unsigned int temp2, temp3; 12 | static unsigned int temp4 = 0xe0e1; 13 | 14 | time(&tp); 15 | temp = localtime(&tp); 16 | 17 | temp2 = (temp->tm_sec<<26)+(temp->tm_min<<20)+(temp->tm_hour<<15)+ 18 | (temp->tm_mday<<10)+(temp->tm_mon<<6); 19 | temp3 = (temp->tm_year<<13)+(temp->tm_wday<<10)+(temp->tm_yday<<1)+ 20 | temp->tm_isdst; 21 | temp2 ^= clock()^temp3; 22 | 23 | temp4 = (temp4*0xeeee)%0xffff; 24 | temp2 ^= temp4<<16; 25 | temp4 = (temp4*0xaeee)%0xffff; 26 | temp2 ^= temp4; 27 | 28 | temp2 &= 0x7fffffff; 29 | 30 | return temp2; 31 | } 32 | 33 | 34 | #if 0 35 | main() 36 | { 37 | printf("%u\n", make_new_seed()); 38 | } 39 | #endif 40 | 41 | 42 | -------------------------------------------------------------------------------- /sprng/memory.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #ifdef __STDC__ 5 | void *_mymalloc(long size, int line, char *message) 6 | #else 7 | void *_mymalloc(size, line, message) 8 | long size; 9 | int line; 10 | char *message; 11 | #endif 12 | { 13 | char *temp; 14 | 15 | if(size == 0) 16 | return NULL; 17 | 18 | temp = (char *) malloc(size); 19 | 20 | if(temp == NULL) 21 | { 22 | fprintf(stderr,"\nmemory allocation failure in file: %s at line number: %d\n", message, line); 23 | return NULL; 24 | } 25 | 26 | return (void *) temp; 27 | } 28 | -------------------------------------------------------------------------------- /sprng/memory.h: -------------------------------------------------------------------------------- 1 | #define mymalloc(a) (_mymalloc((a), __LINE__, __FILE__)) 2 | 3 | #ifndef ANSI_ARGS 4 | #ifdef __STDC__ 5 | #define ANSI_ARGS(args) args 6 | #else 7 | #define ANSI_ARGS(args) () 8 | #endif 9 | #endif 10 | 11 | void *_mymalloc ANSI_ARGS((long size, int line, char *message)); 12 | 13 | -------------------------------------------------------------------------------- /sprng/primes-lcg64.h: -------------------------------------------------------------------------------- 1 | #ifndef _primes64_h_ 2 | #define _primes64_h_ 3 | 4 | #ifndef ANSI_ARGS 5 | #ifdef __STDC__ 6 | #define ANSI_ARGS(args) args 7 | #else 8 | #define ANSI_ARGS(args) () 9 | #endif 10 | #endif 11 | 12 | int getprime ANSI_ARGS((int need, unsigned int *prime_array, int offset)); 13 | 14 | #define MAXPRIME 3037000501U /* largest odd # < sqrt(2)*2^31+2 */ 15 | #define MINPRIME 55108 /* sqrt(MAXPRIME) */ 16 | #define MAXPRIMEOFFSET 146138719U /* Total number of available primes */ 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /sprng/store.h: -------------------------------------------------------------------------------- 1 | #ifndef _STORE_H 2 | #define _STORE_H 3 | 4 | /* Numbers are stored with most significant bit first (left most) */ 5 | 6 | int store_long(unsigned long l, int nbytes, unsigned char *c); 7 | int store_longarray(unsigned long *l, int n, int nbytes, unsigned char *c); 8 | int load_long(unsigned char *c, int nbytes, unsigned long *l); 9 | int load_longarray(unsigned char *c, int n, int nbytes, unsigned long *l); 10 | int store_int(unsigned int l, int nbytes, unsigned char *c); 11 | int store_intarray(unsigned int *l, int n, int nbytes, unsigned char *c); 12 | int load_int(unsigned char *c, int nbytes, unsigned int *l); 13 | int load_intarray(unsigned char *c, int n, int nbytes, unsigned int *l); 14 | 15 | 16 | #ifdef _LONG_LONG 17 | 18 | int store_longlong(unsigned long long l, int nbytes, unsigned char *c); 19 | int store_longlongarray(unsigned long long *l, int n, int nbytes, unsigned char *c); 20 | int load_longlong(unsigned char *c, int nbytes, unsigned long long *l); 21 | int load_longlongarray(unsigned char *c, int n, int nbytes, unsigned long long *l); 22 | 23 | #endif /* _LONG_LONG */ 24 | 25 | 26 | #endif /* _STORE_H */ 27 | 28 | -------------------------------------------------------------------------------- /terrace/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(terrace 2 | terracenode.cpp 3 | terracenode.hpp 4 | terracetree.cpp 5 | terracetree.hpp 6 | presenceabsencematrix.cpp 7 | presenceabsencematrix.hpp 8 | terrace.hpp 9 | terrace.cpp 10 | ) 11 | 12 | target_link_libraries(terrace tree) 13 | -------------------------------------------------------------------------------- /terracetphast/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(terracetphast 2 | terracetphast.cpp 3 | terracetphast.h 4 | ) 5 | 6 | target_link_libraries(terracetphast tree alignment terraphast) 7 | -------------------------------------------------------------------------------- /terraphast/.gitattributes: -------------------------------------------------------------------------------- 1 | appveyor.yml eol=crlf 2 | -------------------------------------------------------------------------------- /terraphast/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | .idea 3 | cmake-* 4 | *.o 5 | *.user 6 | .vscode 7 | .ycm_extra_conf.py 8 | .ycm_extra_conf.pyc 9 | callgrind.out.* 10 | *.orig 11 | -------------------------------------------------------------------------------- /terraphast/AUTHORS: -------------------------------------------------------------------------------- 1 | This library was built in a joint effort by 2 | 3 | Peter Boszoky 4 | Tobias Ribizel 5 | Fedor Scholz 6 | Florian Weber 7 | 8 | The C interface was provided by 9 | 10 | Michael Hamann 11 | Bui Quang Minh 12 | Alexandros Stamatakis 13 | -------------------------------------------------------------------------------- /terraphast/app/app.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | int main(int argc, char** argv) try { 12 | auto tree_file_name = std::string{}; 13 | auto data_file_name = std::string{}; 14 | if (argc == 3) { 15 | tree_file_name = argv[1]; 16 | data_file_name = argv[2]; 17 | } else { 18 | std::cerr << "Usage: \n" << argv[0] << " \n"; 19 | return 1; 20 | } 21 | auto trees = std::ostringstream{}; 22 | const auto terraces_count = 23 | terraces::simple::print_terrace_from_file(tree_file_name, data_file_name, trees); 24 | 25 | std::cout << "There are " << terraces_count 26 | << " trees on the terrace.\n\nThe trees in question are:\n" 27 | << trees.str() << '\n'; 28 | } catch (std::exception& e) { 29 | std::cerr << "Error: " << e.what() << "\n"; 30 | } 31 | -------------------------------------------------------------------------------- /terraphast/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 1.0.{build} 2 | configuration: Release 3 | platform: 4 | - x64 5 | - Win32 6 | clone_depth: 1 7 | before_build: 8 | - cmd: 'scripts\build_appveyor.bat' 9 | build: 10 | project: terraphast.sln 11 | parallel: true 12 | verbosity: minimal 13 | test_script: 14 | - cmd: 'Release\unittests.exe' 15 | 16 | -------------------------------------------------------------------------------- /terraphast/catch/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /terraphast/cmake/FindGMP.cmake: -------------------------------------------------------------------------------- 1 | find_path(GMP_INCLUDE_DIR NAMES gmp.h gmpxx.h) 2 | find_library(GMP_LIBRARIES NAMES gmp libgmp) 3 | find_library(GMPXX_LIBRARIES NAMES gmpxx libgmpxx ) 4 | 5 | include(FindPackageHandleStandardArgs) 6 | find_package_handle_standard_args(GMP DEFAULT_MSG GMP_INCLUDE_DIR GMP_LIBRARIES GMPXX_LIBRARIES) 7 | mark_as_advanced(GMP_INCLUDE_DIR GMP_LIBRARIES) 8 | add_library(gmp INTERFACE IMPORTED) 9 | set_target_properties(gmp PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${GMP_INCLUDE_DIR}) 10 | set_target_properties(gmp PROPERTIES INTERFACE_LINK_LIBRARIES ${GMP_LIBRARIES}) 11 | add_library(gmpxx INTERFACE IMPORTED) 12 | set_target_properties(gmpxx PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${GMP_INCLUDE_DIR}) 13 | set_target_properties(gmpxx PROPERTIES INTERFACE_LINK_LIBRARIES ${GMPXX_LIBRARIES}) -------------------------------------------------------------------------------- /terraphast/documentation/Changelog.md: -------------------------------------------------------------------------------- 1 | Since 1st meeting 2 | ================= 3 | 4 | Optimizations 5 | ------------- 6 | 7 | * implement bitvector with rank support 8 | * use bitvector instead of index vectors for subsets 9 | * inline lots of often-used methods 10 | * deduplicate constraints 11 | * remap constraints (removing inner nodes from the numbering) 12 | * halved union-find storage by out-of-bounds parent trick 13 | * avoid allocations by reusing old storage 14 | * some micro-optimizations 15 | 16 | Fixes and Features 17 | ------------------ 18 | 19 | * fast terrace check without traversing the tree to the end 20 | * fixed subtree computation (problematic input data caused an assertion to fail) 21 | * fix counting bug (communication problem) 22 | * don't count incorrectly rooted trees 23 | * extracted all computations to callback methods 24 | * implemented logging + stack state decorators 25 | * implemented isomorphy check 26 | * Visual C++ compatibility checked with appveyor 27 | * extracted intrinsics to stay portable 28 | -------------------------------------------------------------------------------- /terraphast/documentation/Dependencies.md: -------------------------------------------------------------------------------- 1 | 2 | Dependencies 3 | ============ 4 | 5 | This library has multiple Dependencies 6 | 7 | 8 | Detailed List 9 | ------------- 10 | 11 | * [Catch](https://github.com/philsquared/Catch). The header `catch.hpp` is supposed to be in the default include-path. The framework is avaiable multiple distros under the name `catch`. 12 | * ... 13 | 14 | Copyable List for installation 15 | ------------------------------ 16 | 17 | 18 | ``` 19 | catch 20 | ``` 21 | 22 | -------------------------------------------------------------------------------- /terraphast/include/terraces/bigint.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TERRACES_BIGINT_HPP 2 | #define TERRACES_BIGINT_HPP 3 | 4 | #include "definitions.hpp" 5 | 6 | #ifndef USE_GMP 7 | #include "clamped_uint.hpp" 8 | namespace terraces { 9 | using big_integer = terraces::overflow_except_uint; 10 | } 11 | #else 12 | #include 13 | #include 14 | namespace terraces { 15 | class big_integer { 16 | mpz_class m_value; 17 | 18 | public: 19 | big_integer(index i = 0); 20 | big_integer& operator+=(const big_integer& other); 21 | big_integer& operator*=(const big_integer& other); 22 | bool is_clamped() const; 23 | const mpz_class& value() const; 24 | }; 25 | bool operator==(const big_integer& a, const big_integer& b); 26 | bool operator!=(const big_integer& a, const big_integer& b); 27 | big_integer operator+(const big_integer& a, const big_integer& b); 28 | big_integer operator*(const big_integer& a, const big_integer& b); 29 | std::ostream& operator<<(std::ostream& stream, const big_integer& val); 30 | } // namespace terraces 31 | #endif 32 | 33 | #endif // TERRACES_BIGINT_HPP 34 | -------------------------------------------------------------------------------- /terraphast/include/terraces/bitmatrix.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TERRACES_BITMATRIX_HPP 2 | #define TERRACES_BITMATRIX_HPP 3 | 4 | #include 5 | 6 | #include "trees.hpp" 7 | 8 | namespace terraces { 9 | 10 | /** A (memory-wise) compact bitmatrix. */ 11 | class bitmatrix { 12 | public: 13 | /** Constructs a bitmatrix with \p rows rows and \p cols columns. */ 14 | bitmatrix(index rows, index cols); 15 | 16 | /** @returns the number of rows. */ 17 | index rows() const; 18 | /** @returns the number of columns. */ 19 | index cols() const; 20 | 21 | /** Returns the entry at cordinates (row, col). */ 22 | bool get(index row, index col) const; 23 | /** Sets the entry at coordinates (row, col). */ 24 | void set(index row, index col, bool val); 25 | /** Writes the bit rows \p in1 | \p in2 to row \p out. */ 26 | void row_or(index in1, index in2, index out); 27 | 28 | /** Returns a bitmatrix containing only the given columns. */ 29 | bitmatrix get_cols(const std::vector& cols) const; 30 | 31 | /** Tests for equality with another bitmatrix. */ 32 | bool operator==(const bitmatrix& other) const; 33 | /** Tests for inequality with another bitmatrix. */ 34 | bool operator!=(const bitmatrix& other) const; 35 | 36 | private: 37 | index m_rows; 38 | index m_cols; 39 | std::vector m_vec; // yes, it's evil 40 | }; 41 | } 42 | 43 | #endif // TERRACES_BITMATRIX_HPP 44 | -------------------------------------------------------------------------------- /terraphast/include/terraces/clamped_uint.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TERRACES_CLAMPED_UINT_HPP 2 | #define TERRACES_CLAMPED_UINT_HPP 3 | 4 | #include "definitions.hpp" 5 | 6 | #include 7 | 8 | namespace terraces { 9 | 10 | template 11 | class checked_uint { 12 | index m_value; 13 | 14 | public: 15 | checked_uint(index value = 0); 16 | 17 | checked_uint& operator+=(checked_uint other); 18 | checked_uint& operator*=(checked_uint other); 19 | bool is_clamped() const; 20 | index value() const; 21 | }; 22 | 23 | template 24 | bool operator==(checked_uint a, checked_uint b); 25 | 26 | template 27 | bool operator!=(checked_uint a, checked_uint b); 28 | 29 | template 30 | checked_uint operator+(checked_uint a, checked_uint b); 31 | 32 | template 33 | checked_uint operator*(checked_uint a, checked_uint b); 34 | 35 | template 36 | std::ostream& operator<<(std::ostream& stream, checked_uint val); 37 | 38 | using clamped_uint = checked_uint; 39 | using overflow_except_uint = checked_uint; 40 | 41 | } // namespace terraces 42 | 43 | #endif // TERRACES_CLAMPED_UINT_HPP 44 | -------------------------------------------------------------------------------- /terraphast/include/terraces/definitions.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DEFINITIONS_HPP 2 | #define DEFINITIONS_HPP 3 | 4 | #include 5 | 6 | namespace terraces { 7 | 8 | /** Our index type. */ 9 | using index = std::size_t; 10 | 11 | /** Index value used to represent a non-index. */ 12 | #ifdef CLANG_UNDER_VS 13 | #undef max 14 | #endif 15 | constexpr static auto none = std::numeric_limits::max(); 16 | 17 | } // namespace terraces 18 | 19 | #endif // DEFINITIONS_HPP 20 | -------------------------------------------------------------------------------- /terraphast/include/terraces/rooting.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TERRACES_ROOTING_HPP 2 | #define TERRACES_ROOTING_HPP 3 | 4 | #include "trees.hpp" 5 | 6 | namespace terraces { 7 | 8 | /** 9 | * Returns the root split of the given tree. 10 | * The root split is a bitvector of size #leaves that is 1 11 | * for all leaves in the right subtree of the root node. 12 | */ 13 | std::vector root_split(const tree& t, index num_leaves); 14 | 15 | /** 16 | * Re-roots the given tree in-place. 17 | * The node at the given \p node_idx will be placed below the new root node. 18 | */ 19 | tree reroot_at_node(const tree& t, index node_idx); 20 | 21 | /** 22 | * Re-roots the given tree in-place. 23 | * The leaf corresponding to the given \p comp_taxon will be placed to the right of the root. 24 | * child of our new root, with the rest of the tree being the left subtree. 25 | */ 26 | void reroot_at_taxon_inplace(tree& t, index comp_taxon); 27 | 28 | } // namespace terraces 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /terraphast/include/terraces/subtree_extraction.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SUBTREE_EXTRACTION_H 2 | #define SUBTREE_EXTRACTION_H 3 | 4 | #include 5 | 6 | #include "bitmatrix.hpp" 7 | #include "trees.hpp" 8 | 9 | namespace terraces { 10 | 11 | /** 12 | * Extracts all (pruned) subtrees from the given input tree and missing data matrix. 13 | * For every column of the missing data matrix, a corresponding tree is constructed, 14 | * containing only leaves for which this matrix contains a 1. 15 | */ 16 | std::vector subtrees(const tree& t, const bitmatrix& occ); 17 | 18 | } // namespace terraces 19 | 20 | #endif // SUBTREE_EXTRACTION_H 21 | -------------------------------------------------------------------------------- /terraphast/lib/bigint.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #ifdef USE_GMP 6 | namespace terraces { 7 | big_integer::big_integer(index i) : m_value{i} {} 8 | big_integer& big_integer::operator+=(const big_integer& other) { 9 | m_value += other.m_value; 10 | return *this; 11 | } 12 | big_integer& big_integer::operator*=(const big_integer& other) { 13 | m_value *= other.m_value; 14 | return *this; 15 | } 16 | bool big_integer::is_clamped() const { return false; } 17 | const mpz_class& big_integer::value() const { return m_value; } 18 | 19 | big_integer operator+(const big_integer& a, const big_integer& b) { 20 | big_integer result = a; 21 | result += b; 22 | return result; 23 | } 24 | 25 | big_integer operator*(const big_integer& a, const big_integer& b) { 26 | big_integer result = a; 27 | result *= b; 28 | return result; 29 | } 30 | 31 | bool operator==(const big_integer& a, const big_integer& b) { return a.value() == b.value(); } 32 | 33 | bool operator!=(const big_integer& a, const big_integer& b) { return !(a == b); } 34 | 35 | std::ostream& operator<<(std::ostream& stream, const big_integer& val) { 36 | return stream << val.value(); 37 | } 38 | 39 | } // namespace terraces 40 | #endif // USE_GMP 41 | -------------------------------------------------------------------------------- /terraphast/lib/bitmatrix.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | namespace terraces { 6 | 7 | bitmatrix::bitmatrix(index rows, index cols) : m_rows{rows}, m_cols{cols}, m_vec(rows * cols) {} 8 | 9 | index bitmatrix::rows() const { return m_rows; } 10 | index bitmatrix::cols() const { return m_cols; } 11 | 12 | bool bitmatrix::get(index row, index col) const { 13 | assert(row < m_rows && col < m_cols); 14 | return m_vec[row * m_cols + col]; 15 | } 16 | 17 | void bitmatrix::set(index row, index col, bool val) { 18 | assert(row < m_rows && col < m_cols); 19 | m_vec[row * m_cols + col] = val; 20 | } 21 | 22 | void bitmatrix::row_or(index in1, index in2, index out) { 23 | for (index i = 0; i < cols(); ++i) { 24 | set(out, i, get(in1, i) || get(in2, i)); 25 | } 26 | } 27 | 28 | bitmatrix bitmatrix::get_cols(const std::vector& cols) const { 29 | assert(cols.size() <= this->cols()); 30 | auto ret = bitmatrix{rows(), cols.size()}; 31 | for (auto i = std::size_t{}; i < rows(); ++i) { 32 | for (auto j = std::size_t{}; j < cols.size(); ++j) { 33 | ret.set(i, j, get(i, cols[j])); 34 | } 35 | } 36 | return ret; 37 | } 38 | 39 | bool bitmatrix::operator==(const bitmatrix& other) const { 40 | return other.rows() == rows() && other.cols() == cols() && other.m_vec == m_vec; 41 | } 42 | 43 | bool bitmatrix::operator!=(const bitmatrix& other) const { return !(*this == other); } 44 | 45 | } // namespace terraces 46 | -------------------------------------------------------------------------------- /terraphast/lib/bits.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BITS_HPP 2 | #define BITS_HPP 3 | 4 | #include 5 | 6 | namespace terraces { 7 | namespace bits { 8 | 9 | static_assert(std::numeric_limits::radix == 2, "Our integers must be of base 2"); 10 | constexpr index word_bits = std::numeric_limits::digits; 11 | 12 | inline index block_index(index i) { return i / word_bits; } 13 | inline index base_index(index block) { return block * word_bits; } 14 | inline index shift_index(index i) { return i % word_bits; } 15 | inline index set_mask(index i) { return index(1) << (i & (word_bits - 1)); } 16 | inline index clear_mask(index i) { return ~set_mask(i); } 17 | inline index prefix_mask(index i) { return set_mask(i) - 1; } 18 | inline index next_bit(index block, index i) { return i + bitscan(block >> shift_index(i)); } 19 | inline index next_bit0(index block, index i) { return i + bitscan(block); } 20 | inline bool has_next_bit(index block, index i) { return (block >> shift_index(i)) != 0; } 21 | inline bool has_next_bit0(index block) { return block != 0; } 22 | inline index partial_popcount(index block, index i) { return popcount(block & prefix_mask(i)); } 23 | 24 | } // namespace bits 25 | } // namespace terraces 26 | 27 | #endif // BITS_HPP 28 | -------------------------------------------------------------------------------- /terraphast/lib/cl/intrinsics.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef _WIN64 4 | #pragma intrinsic(_BitScanForward64, _BitScanReverse64, __popcnt64) 5 | #else 6 | #pragma intrinsic(_BitScanForward, _BitScanReverse, __popcnt) 7 | #endif 8 | 9 | namespace terraces { 10 | namespace bits { 11 | 12 | #ifdef _WIN64 13 | inline index popcount(index word) { return (index)__popcnt64(word); } 14 | 15 | inline index bitscan(index word) { 16 | unsigned long idx; 17 | _BitScanForward64(&idx, word); 18 | return (index)idx; 19 | } 20 | 21 | inline index rbitscan(index word) { 22 | unsigned long idx; 23 | _BitScanReverse64(&idx, word); 24 | return (index)idx; 25 | } 26 | #else 27 | inline index popcount(index word) { return index(__popcnt(word)); } 28 | 29 | inline index bitscan(index word) { 30 | unsigned long idx; 31 | _BitScanForward(&idx, word); 32 | return index(idx); 33 | } 34 | 35 | inline index rbitscan(index word) { 36 | unsigned long idx; 37 | _BitScanReverse(&idx, word); 38 | return index(idx); 39 | } 40 | #endif 41 | 42 | namespace { 43 | constexpr index max_index = std::numeric_limits::max(); 44 | } 45 | 46 | inline bool add_overflow(index a, index b, index& result) { 47 | result = a + b; 48 | if (max_index - b < a) { 49 | return true; 50 | } else { 51 | return false; 52 | } 53 | } 54 | 55 | inline bool mul_overflow(index a, index b, index& result) { 56 | result = a * b; 57 | if (max_index / b < a) { 58 | return true; 59 | } else { 60 | return false; 61 | } 62 | } 63 | 64 | } // namespace bits 65 | } // namespace terraces 66 | -------------------------------------------------------------------------------- /terraphast/lib/constraints_impl.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CONSTRAINTS_IMPL_HPP 2 | #define CONSTRAINTS_IMPL_HPP 3 | 4 | #include 5 | 6 | namespace terraces { 7 | 8 | namespace utils { 9 | template 10 | struct named_output; 11 | } 12 | 13 | std::ostream& operator<<(std::ostream& stream, utils::named_output output); 14 | 15 | } // namespace terraces 16 | 17 | #endif // CONSTRAINTS_IMPL_HPP 18 | -------------------------------------------------------------------------------- /terraphast/lib/gcc_clang/intrinsics.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace terraces { 4 | namespace bits { 5 | 6 | inline index popcount(index word) { return index(__builtin_popcountll(word)); } 7 | 8 | inline index bitscan(index word) { return index(__builtin_ctzll(word)); } 9 | 10 | static_assert(sizeof(long long) >= sizeof(index), "intrinsic word sizes incompatible"); 11 | 12 | inline index rbitscan(index word) { 13 | return index(std::numeric_limits::digits - __builtin_clzll(word)); 14 | } 15 | 16 | inline bool add_overflow(index a, index b, index& result) { 17 | return __builtin_add_overflow(a, b, &result); 18 | } 19 | 20 | inline bool mul_overflow(index a, index b, index& result) { 21 | return __builtin_mul_overflow(a, b, &result); 22 | } 23 | 24 | } // namespace bits 25 | } // namespace terraces 26 | -------------------------------------------------------------------------------- /terraphast/lib/intel/intrinsics.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace terraces { 4 | namespace bits { 5 | 6 | #if defined(__LP64__) || defined(_LP64) 7 | inline index popcount(index word) { return index(_popcnt64(word)); } 8 | 9 | inline index bitscan(index word) { 10 | unsigned int idx; 11 | _BitScanForward64(&idx, word); 12 | return index(idx); 13 | } 14 | 15 | inline index rbitscan(index word) { 16 | unsigned int idx; 17 | _BitScanReverse64(&idx, word); 18 | return index(idx); 19 | } 20 | #else 21 | inline index popcount(index word) { return index(_popcnt(word)); } 22 | 23 | inline index bitscan(index word) { 24 | unsigned int idx; 25 | _BitScanForward(&idx, word); 26 | return index(idx); 27 | } 28 | 29 | inline index rbitscan(index word) { 30 | unsigned int idx; 31 | _BitScanReverse(&idx, word); 32 | return index(idx); 33 | } 34 | #endif 35 | 36 | namespace { 37 | constexpr index max_index = std::numeric_limits::max(); 38 | } 39 | 40 | inline bool add_overflow(index a, index b, index& result) { 41 | result = a + b; 42 | if (max_index - b < a) { 43 | return true; 44 | } else { 45 | return false; 46 | } 47 | } 48 | 49 | inline bool mul_overflow(index a, index b, index& result) { 50 | result = a * b; 51 | if (max_index / b < a) { 52 | return true; 53 | } else { 54 | return false; 55 | } 56 | } 57 | 58 | } // namespace bits 59 | } // namespace terraces 60 | -------------------------------------------------------------------------------- /terraphast/lib/nodes.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | namespace terraces { 6 | 7 | std::ostream& operator<<(std::ostream& s, const node& n) { 8 | auto print_index = [&s](index i) { 9 | if (i == none) { 10 | s << "none"; 11 | } else { 12 | s << i; 13 | } 14 | }; 15 | s << '('; 16 | print_index(n.data[0]); 17 | s << ", "; 18 | print_index(n.data[1]); 19 | s << ", "; 20 | print_index(n.data[2]); 21 | s << ')'; 22 | return s; 23 | } 24 | 25 | } // namespace terraces 26 | -------------------------------------------------------------------------------- /terraphast/lib/subtree_extraction_impl.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SUBTREE_EXTRACTION_IMPL_HPP 2 | #define SUBTREE_EXTRACTION_IMPL_HPP 3 | 4 | #include 5 | 6 | namespace terraces { 7 | 8 | std::pair> compute_node_occ(const tree& t, const bitmatrix& occ); 9 | 10 | index induced_lca(const tree& t, const bitmatrix& node_occ, index column); 11 | 12 | tree subtree(const tree& t, const bitmatrix& node_occ, 13 | const std::vector& num_leaves_per_site, index site); 14 | 15 | } // namespace terraces 16 | 17 | #endif // SUBTREE_EXTRACTION_IMPL_HPP 18 | -------------------------------------------------------------------------------- /terraphast/lib/union_find.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TERRACES_UNION_FIND_HPP 2 | #define TERRACES_UNION_FIND_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include "stack_allocator.hpp" 9 | 10 | namespace terraces { 11 | 12 | class union_find { 13 | public: 14 | using value_type = index; 15 | 16 | private: 17 | std::vector> m_parent; 18 | #ifndef NDEBUG 19 | bool m_compressed; 20 | #endif // NDEBUG 21 | 22 | public: 23 | union_find(index, utils::stack_allocator a); 24 | index find(index); 25 | index simple_find(index x) const { 26 | assert(m_compressed); 27 | return is_representative(x) ? x : m_parent[x]; 28 | } 29 | index size() const { return m_parent.size(); } 30 | void compress(); 31 | void merge(index, index); 32 | bool is_representative(index x) const { return m_parent[x] >= m_parent.size(); } 33 | 34 | static union_find make_bipartition(const std::vector& split, 35 | utils::stack_allocator alloc); 36 | }; 37 | 38 | } // namespace terraces 39 | 40 | #endif // TERRACES_UNION_FIND_HPP 41 | -------------------------------------------------------------------------------- /terraphast/lib/utils.hpp: -------------------------------------------------------------------------------- 1 | 2 | #ifndef TERRACES_UTILS_HPP 3 | #define TERRACES_UTILS_HPP 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | namespace terraces { 10 | namespace utils { 11 | 12 | template 13 | T exchange(T& obj, U&& new_value) { 14 | T old_value = std::move(obj); 15 | obj = std::forward(new_value); 16 | return old_value; 17 | } 18 | 19 | template 20 | Iterator skip_ws(Iterator it, Iterator last) { 21 | while (it != last and std::isspace(*it)) { 22 | ++it; 23 | } 24 | return it; 25 | } 26 | 27 | template 28 | Iterator reverse_skip_ws(Iterator first, Iterator last) { 29 | while (first != last) { 30 | if (std::isspace(*std::prev(last))) { 31 | --last; 32 | } else { 33 | break; 34 | } 35 | } 36 | return last; 37 | } 38 | 39 | template 40 | void ensure(bool b, Args&&... args) { 41 | if (not b) { 42 | throw Exception{std::forward(args)...}; 43 | } 44 | } 45 | 46 | } // namespace utils 47 | } // namespace terraces 48 | 49 | #endif // TERRACES_UTILS_HPP 50 | -------------------------------------------------------------------------------- /terraphast/lib/validation.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VALIDATION_HPP 2 | #define VALIDATION_HPP 3 | 4 | #include 5 | #include 6 | 7 | #include "bitvector.hpp" 8 | 9 | namespace terraces { 10 | 11 | bool is_isomorphic_unrooted(const tree& fst, const tree& snd); 12 | 13 | bool is_isomorphic_rooted(const tree& fst, const tree& snd); 14 | 15 | std::vector tree_bipartitions(const tree& t); 16 | 17 | } // namespace terraces 18 | 19 | #endif // TREE_BIPARTITIONS_HPP 20 | -------------------------------------------------------------------------------- /terraphast/scripts/build_appveyor.bat: -------------------------------------------------------------------------------- 1 | IF "%Platform%" == "x64" ( 2 | cmake -G "Visual Studio 14 2015 Win64" -DTERRAPHAST_USE_GMP=OFF -DTERRAPHAST_BUILD_CLIB=OFF . 3 | ) ELSE ( 4 | cmake -G "Visual Studio 14 2015" -DTERRAPHAST_USE_GMP=OFF -DTERRAPHAST_BUILD_CLIB=OFF . 5 | ) 6 | -------------------------------------------------------------------------------- /terraphast/scripts/format.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | STYLE="{ 4 | \"BasedOnStyle\": \"llvm\", 5 | \"IndentWidth\": 8, 6 | \"TabWidth\": 8, 7 | \"ContinuationIndentWidth\": 8, 8 | \"UseTab\": \"ForIndentation\", 9 | \"BreakBeforeBraces\": \"Attach\", 10 | \"AlwaysBreakTemplateDeclarations\": \"true\", 11 | \"ColumnLimit\": 100, 12 | \"PointerBindsToType\": \"true\", 13 | \"AccessModifierOffset\": -8, 14 | \"ConstructorInitializerIndentWidth\": 8, 15 | }" 16 | 17 | MODE=$1 18 | 19 | function format_file() { 20 | if ! diff -u <(cat "$1") <(clang-format -style="$STYLE" $1) &> "/dev/null"; then 21 | if [ "$MODE" == "check" ] 22 | then 23 | exit 1 24 | fi 25 | echo formatting "$1" 26 | clang-format -style="$STYLE" -i "$1" 27 | fi 28 | } 29 | 30 | for FILE in $(find include -iname "*.[hc]pp"); do format_file "$FILE"; done 31 | for FILE in $(find lib -iname "*.[hc]pp"); do format_file "$FILE"; done 32 | for FILE in $(find app -iname "*.[hc]pp"); do format_file "$FILE"; done 33 | for FILE in $(find tools -iname "*.[hc]pp"); do format_file "$FILE"; done 34 | for FILE in $(find test -iname "*.[hc]pp"); do format_file "$FILE"; done 35 | for FILE in $(find c_include -iname "*.[hc]"); do format_file "$FILE"; done 36 | for FILE in $(find c_lib -iname "*.[hc]pp"); do format_file "$FILE"; done 37 | 38 | 39 | -------------------------------------------------------------------------------- /terraphast/scripts/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # link this file in your git-hooks, for example with: 4 | # ln .git/hooks/pre-commit pre-commit 5 | 6 | if ./scripts/format.sh check 7 | then 8 | echo "nothing to format" 9 | else 10 | echo "unformatted files, please format and stage again" >&2 11 | exit 1 12 | fi 13 | 14 | if lizard include lib app test &> "/dev/null"; then 15 | echo "no overcomplicated functions found" 16 | else 17 | echo "lizard-warnings found... aborting" >&2 18 | exit 1 19 | fi 20 | 21 | cd "build/debug" 22 | if ninja ;then 23 | echo "debug-build successfull" 24 | else 25 | echo "build-failure... aborting" >&2 26 | exit 2 27 | fi 28 | cd "../.." 29 | 30 | cd "build/debug" 31 | if ninja test &> "/dev/null";then 32 | echo "unit-tests run succesfully" 33 | else 34 | echo "unit-tests failed... aborting" >&2 35 | exit 2 36 | fi 37 | cd "../.." 38 | -------------------------------------------------------------------------------- /terraphast/scripts/setup_workspace.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # This script is for when you intend to actually work on the code. 4 | # Do not use it, if all you want to do is build the library for 5 | # actual use. If that is what you want, just go through the usual 6 | # way steps for building a cmake-project. 7 | 8 | ln -s "../../scripts/pre-commit" ".git/hooks/pre-commit" 9 | 10 | if command -v "ninja" >/dev/null; then 11 | echo "found ninja" 12 | BUILD_BACKEND="-GNinja" 13 | else 14 | echo "failed to find ninja" 15 | BUILD_BACKEND="" 16 | fi 17 | 18 | CC=$(which clang) 19 | CXX=$(which clang++) 20 | 21 | mkdir "build" 22 | mkdir "build/release" 23 | mkdir "build/debug" 24 | 25 | cd "build/release" 26 | CC=$CC CXX=$CXX cmake "-DCMAKE_BUILD_TYPE=Release" "-DDEV_ENVIRONMENT=ON" "-DBUILD_TESTS=ON" "$BUILD_BACKEND" "../.." 27 | cd "../.." 28 | 29 | cd "build/debug" 30 | CC=$CC CXX=$CXX cmake "-DCMAKE_BUILD_TYPE=Debug" "-DDEV_ENVIRONMENT=ON" "-DBUILD_TESTS=ON" "$BUILD_BACKEND" "../.." 31 | cd "../.." 32 | 33 | -------------------------------------------------------------------------------- /terraphast/scripts/setup_workspace_windows.sh: -------------------------------------------------------------------------------- 1 | mkdir build 2 | cd build 3 | cmake "-DBUILD_TESTS=ON" -G "Visual Studio 14 2015 Win64" .. 4 | cd .. 5 | -------------------------------------------------------------------------------- /terraphast/test/bipartitions.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include "../lib/bipartitions.hpp" 6 | #include "../lib/ranked_bitvector.hpp" 7 | #include "../lib/union_find.hpp" 8 | 9 | namespace terraces { 10 | namespace tests { 11 | 12 | TEST_CASE("bipartition1", "[bipartition]") { 13 | auto fl = utils::free_list{}; 14 | auto alloc = utils::stack_allocator{fl, 4}; 15 | union_find u(4, alloc); 16 | ranked_bitvector s{4, alloc}; 17 | s.set(0); 18 | s.set(1); 19 | s.set(2); 20 | s.set(3); 21 | s.update_ranks(); 22 | u.merge(0, 1); 23 | u.compress(); 24 | bipartitions bip_it(s, u, alloc); 25 | CHECK(bip_it.end_bip() == 4); 26 | CHECK(bip_it.num_bip() == 3); 27 | CHECK(bip_it.begin_bip() == 1); 28 | auto set = bip_it.get_first_set(1, alloc); 29 | CHECK(!set.get(0)); 30 | CHECK(!set.get(1)); 31 | CHECK(set.get(2)); 32 | CHECK(!set.get(3)); 33 | set = bip_it.get_first_set(2, alloc); 34 | CHECK(!set.get(0)); 35 | CHECK(!set.get(1)); 36 | CHECK(!set.get(2)); 37 | CHECK(set.get(3)); 38 | set = bip_it.get_first_set(3, alloc); 39 | CHECK(!set.get(0)); 40 | CHECK(!set.get(1)); 41 | CHECK(set.get(2)); 42 | CHECK(set.get(3)); 43 | CHECK(bip_it.end_bip() == 4); 44 | CHECK(bip_it.num_bip() == 3); 45 | } 46 | 47 | } // namespace tests 48 | } // namespace terraces 49 | -------------------------------------------------------------------------------- /terraphast/test/bitmatrix.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | namespace terraces { 6 | namespace tests { 7 | 8 | TEST_CASE("bitmatrix-construction", "[bitmatrix]") { 9 | auto mat = bitmatrix{10, 5}; 10 | CHECK(mat.rows() == 10); 11 | CHECK(mat.cols() == 5); 12 | } 13 | 14 | TEST_CASE("bitmatrix set/get", "[bitmatrix]") { 15 | auto mat = bitmatrix{3, 4}; 16 | 17 | CHECK(!mat.get(1, 2)); 18 | mat.set(1, 2, true); 19 | CHECK(mat.get(1, 2)); 20 | } 21 | 22 | } // namespace tests 23 | } // namespace terraces 24 | -------------------------------------------------------------------------------- /terraphast/test/clamped_uint.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | namespace terraces { 9 | namespace tests { 10 | 11 | TEST_CASE("clamped_uint", "[checked_uint]") { 12 | auto max = std::numeric_limits::max(); 13 | CHECK((clamped_uint{10} + clamped_uint{417}).value() == 10 + 417); 14 | CHECK((clamped_uint{10} * clamped_uint{417}).value() == 10 * 417); 15 | CHECK((clamped_uint{max} + clamped_uint{1}).is_clamped()); 16 | CHECK((clamped_uint{max} + clamped_uint{1}).value() == max); 17 | CHECK((clamped_uint{max / 2} * clamped_uint{3}).is_clamped()); 18 | CHECK((clamped_uint{max / 2} * clamped_uint{3}).value() == max); 19 | } 20 | 21 | TEST_CASE("overflow_except_uint", "[checked_uint]") { 22 | auto max = std::numeric_limits::max(); 23 | CHECK((overflow_except_uint{10} + overflow_except_uint{417}).value() == 10 + 417); 24 | CHECK((overflow_except_uint{10} * overflow_except_uint{417}).value() == 10 * 417); 25 | CHECK_THROWS_AS(overflow_except_uint{max} + overflow_except_uint{1}, 26 | terraces::tree_count_overflow_error); 27 | CHECK_THROWS_AS(overflow_except_uint{max / 2} * overflow_except_uint{3}, 28 | terraces::tree_count_overflow_error); 29 | } 30 | 31 | } // namespace tests 32 | } // namespace terraces 33 | -------------------------------------------------------------------------------- /terraphast/test/fast_set.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "../lib/ranked_bitvector.hpp" 4 | 5 | namespace terraces { 6 | namespace tests { 7 | 8 | TEST_CASE("fast_set1", "[fast_set]") { 9 | basic_ranked_bitvector> set{10, {}}; 10 | for (auto&& el : set) { 11 | (void)el; 12 | FAIL("element in empty set!"); 13 | } 14 | set.set(4); 15 | set.update_ranks(); 16 | CHECK(*set.begin() == 4); 17 | CHECK((++set.begin()) == set.end()); 18 | CHECK(set.get(4)); 19 | CHECK(!set.get(5)); 20 | set.clr(4); 21 | set.set(5); 22 | set.update_ranks(); 23 | CHECK(!set.get(4)); 24 | CHECK(set.get(5)); 25 | CHECK(*set.begin() == 5); 26 | CHECK((++set.begin()) == set.end()); 27 | set.set(2); 28 | set.update_ranks(); 29 | index count = 0; 30 | for (auto&& el : set) { 31 | (void)el; 32 | ++count; 33 | } 34 | CHECK(count == set.count()); 35 | } 36 | 37 | } // namespace tests 38 | } // namespace terraces 39 | -------------------------------------------------------------------------------- /terraphast/test/integration.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | namespace terraces { 9 | 10 | namespace tests { 11 | 12 | TEST_CASE("full_run_disjoint", "[rerooting],[tree_extraction],[constraints],[supertree]") { 13 | tree t{{none, 1, 2, none}, {0, 3, 4, none}, {0, none, none, 0}, 14 | {1, 5, 6, none}, {1, 7, 8, none}, {3, none, none, 1}, 15 | {3, none, none, 2}, {4, none, none, 3}, {4, none, none, 4}}; 16 | bitmatrix b{5, 2}; 17 | b.set(0, 0, true); 18 | b.set(0, 1, true); 19 | b.set(1, 1, true); 20 | b.set(2, 1, true); 21 | b.set(3, 0, true); 22 | b.set(4, 0, true); 23 | auto ts = subtrees(t, b); 24 | auto cs = compute_constraints(ts); 25 | auto names = name_map(t.size()); 26 | index root = 0; 27 | CHECK(count_terrace({cs, 5, root}) == 15); 28 | } 29 | 30 | } // namespace tests 31 | } // namespace terraces 32 | -------------------------------------------------------------------------------- /terraphast/test/main.cc: -------------------------------------------------------------------------------- 1 | #define CATCH_CONFIG_MAIN 2 | #include 3 | -------------------------------------------------------------------------------- /terraphast/test/small_bipartition.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "../lib/small_bipartition.hpp" 4 | #include "../lib/validation.hpp" 5 | 6 | namespace terraces { 7 | namespace tests { 8 | 9 | TEST_CASE("small_bipartition", "[unconstrained]") { 10 | small_bipartition bip{0b00101001011100}; 11 | auto step = [&](index i) { 12 | CHECK(bip.is_valid()); 13 | CHECK(bip.left_mask() == i); 14 | bip.next(); 15 | }; 16 | CHECK(bip.leftmost_leaf() == 2); 17 | CHECK(bip.rightmost_leaf() == 11); 18 | CHECK(bip.num_leaves() == 6); 19 | 20 | step(0b00000000000100); 21 | step(0b00000000001000); 22 | step(0b00000000001100); 23 | step(0b00000000010000); 24 | step(0b00000000010100); 25 | step(0b00000000011000); 26 | step(0b00000000011100); 27 | step(0b00000001000000); 28 | step(0b00000001000100); 29 | step(0b00000001001000); 30 | step(0b00000001001100); 31 | step(0b00000001010000); 32 | step(0b00000001010100); 33 | step(0b00000001011000); 34 | step(0b00000001011100); 35 | step(0b00001000000000); 36 | step(0b00001000000100); 37 | step(0b00001000001000); 38 | step(0b00001000001100); 39 | step(0b00001000010000); 40 | step(0b00001000010100); 41 | step(0b00001000011000); 42 | step(0b00001000011100); 43 | step(0b00001001000000); 44 | step(0b00001001000100); 45 | step(0b00001001001000); 46 | step(0b00001001001100); 47 | step(0b00001001010000); 48 | step(0b00001001010100); 49 | step(0b00001001011000); 50 | step(0b00001001011100); 51 | CHECK(!bip.is_valid()); 52 | } 53 | 54 | } // namespace tests 55 | } // namespace terraces 56 | -------------------------------------------------------------------------------- /terraphast/test/stack_allocator.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "../lib/stack_allocator.hpp" 4 | 5 | namespace terraces { 6 | namespace tests { 7 | 8 | TEST_CASE("stack_allocator basic", "[utils][utils::stack_allocator]") { 9 | utils::free_list fl; 10 | utils::stack_allocator alloc{fl, 10}; 11 | std::vector> vec(alloc); 12 | CHECK_NOTHROW(vec.reserve(10)); 13 | } 14 | 15 | } // namespace tests 16 | } // namespace terraces 17 | -------------------------------------------------------------------------------- /terraphast/tools/nwk_to_dot.cpp: -------------------------------------------------------------------------------- 1 | #include "../lib/io_utils.hpp" 2 | #include "../lib/trees_impl.hpp" 3 | 4 | #include 5 | #include 6 | 7 | int main(int argc, char** argv) { 8 | if (argc < 3) { 9 | std::cerr << "Usage: " << argv[0] << " [treefile] [rooted]"; 10 | return -1; 11 | } 12 | auto tree = terraces::parse_new_nwk(terraces::utils::read_file_full(argv[1])); 13 | bool rooted = bool(std::stoi(argv[2])); 14 | terraces::print_tree_dot(tree.tree, tree.names, std::cout, rooted); 15 | } -------------------------------------------------------------------------------- /terraphast/tools/reroot.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | int main(int argc, char** argv) try { 10 | if (argc != 3) { 11 | std::cerr << "Usage: " << argv[0] << " " << std::endl; 12 | return 1; 13 | } 14 | auto data_file = std::ifstream{argv[2]}; 15 | const auto data = terraces::parse_bitmatrix(data_file); 16 | 17 | auto tree_file = std::ifstream{argv[1]}; 18 | auto tree_string = std::string{}; 19 | std::getline(tree_file, tree_string); 20 | auto tree = terraces::parse_nwk(tree_string, data.indices); 21 | auto comp_taxon = terraces::find_comprehensive_taxon(data.matrix); 22 | 23 | if (comp_taxon == terraces::none) { 24 | std::cerr << "Cannot find a comprehensive taxon for the tree\n"; 25 | return 1; 26 | } 27 | 28 | terraces::reroot_at_taxon_inplace(tree, comp_taxon); 29 | 30 | std::cout << as_newick(tree, data.names); 31 | } catch (std::exception& e) { 32 | std::cerr << "Error: " << e.what() << "\n"; 33 | } 34 | -------------------------------------------------------------------------------- /terraphast/tools/site_gen.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(int argc, char** argv) { 6 | if (argc != 4) { 7 | std::cerr << "Usage: " << argv[0] 8 | << " \n"; 9 | return 1; 10 | } 11 | const auto num_species = std::stoul(argv[1]); 12 | const auto num_sites = std::stoul(argv[2]); 13 | const auto prob = std::stod(argv[3]); 14 | 15 | auto gen = std::default_random_engine{std::random_device{}()}; 16 | auto dist_p = std::uniform_real_distribution{0.0, 1.0}; 17 | 18 | const auto root_species = 19 | std::uniform_int_distribution{0u, num_species}(gen); 20 | 21 | std::cout << num_species << ' ' << num_sites << '\n'; 22 | for (auto i = 0ul; i < num_species; ++i) { 23 | if (i == root_species) { 24 | for (auto j = 0ul; j < num_sites; ++j) { 25 | std::cout << "1 "; 26 | } 27 | } else { 28 | for (auto j = 0ul; j < num_sites; ++j) { 29 | std::cout << (dist_p(gen) < prob) << ' '; 30 | } 31 | } 32 | std::cout << 's' << i << '\n'; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /terraphast/tools/subtree.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | int main(int argc, char** argv) try { 13 | if (argc != 3) { 14 | std::cerr << "Usage: " << argv[0] << " " << std::endl; 15 | return 1; 16 | } 17 | auto tree_file = std::ifstream{argv[1]}; 18 | auto tree_string = std::string{}; 19 | std::getline(tree_file, tree_string); 20 | auto data = terraces::parse_new_nwk(tree_string); 21 | 22 | auto names_file = std::ifstream{argv[2]}; 23 | std::set names; 24 | std::copy(std::istream_iterator(names_file), 25 | std::istream_iterator(), std::inserter(names, names.begin())); 26 | terraces::bitmatrix occ{data.tree.size(), 1}; 27 | for (auto& species_pair : data.indices) { 28 | if (names.find(species_pair.first) != names.end()) { 29 | occ.set(species_pair.second, 0, true); 30 | } 31 | } 32 | terraces::reroot_at_taxon_inplace(data.tree, data.indices[*names.begin()]); 33 | auto subtree = terraces::subtrees(data.tree, occ)[0]; 34 | std::cout << as_newick(subtree, data.names); 35 | } catch (std::exception& e) { 36 | std::cerr << "Error: " << e.what() << "\n"; 37 | } 38 | -------------------------------------------------------------------------------- /test_scripts/iqtree2.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBIQTREE2_FUN 2 | #define LIBIQTREE2_FUN 3 | 4 | #include 5 | 6 | using namespace std; 7 | 8 | // Calculates the RF distance between two trees 9 | int calculate_RF_distance(const string& tree1, const string& tree2); 10 | 11 | // Generates a random phylogenetic tree 12 | void generate_random_tree_file(int numtaxa, int seed, string tree_gen_mode, string outfile); 13 | 14 | // perform phylogenetic analysis on the input alignment file 15 | void phylogenetic_analysis(string& align_file, int ncpus = 1); 16 | 17 | #endif /* LIBIQTREE2_FUN */ 18 | -------------------------------------------------------------------------------- /test_scripts/linux_universal.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ARCH=$(uname -m) 4 | BINARY="" 5 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 6 | 7 | if [[ "$ARCH" == "x86_64" ]]; then 8 | BINARY="iqtree3_intel" 9 | elif [[ "$ARCH" == "aarch64" ]]; then 10 | BINARY="iqtree3_arm" 11 | else 12 | echo "Unsupported architecture: $ARCH" 13 | exit 1 14 | fi 15 | 16 | # Run the appropriate binary 17 | exec "${SCRIPT_DIR}/$BINARY" "$@" 18 | -------------------------------------------------------------------------------- /test_scripts/make_linux_universal.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ $# -eq 0 ]; 3 | then 4 | echo "Syntax: $0 [*-intel.tar.gz] [*-arm.tar.gz]" 5 | exit 6 | fi 7 | 8 | intelname=`basename $1 .tar.gz` 9 | armname=`basename $2 .tar.gz` 10 | universalname=`basename $1 -intel.tar.gz` 11 | 12 | tar -xvf $1 13 | tar -xvf $2 14 | mkdir -p $universalname 15 | mkdir -p $universalname/bin 16 | cp $intelname/*.* $universalname 17 | 18 | cp $intelname/bin/iqtree3 $universalname/bin/iqtree3_intel 19 | cp $armname/bin/iqtree3 $universalname/bin/iqtree3_arm 20 | 21 | # Make the final file executable 22 | chmod +x test_scripts/linux_universal.sh 23 | cp test_scripts/linux_universal.sh $universalname/bin/iqtree3 24 | 25 | 26 | rm -rf $intelname 27 | rm -rf $armname 28 | 29 | tar czf $universalname.tar.gz $universalname 30 | 31 | rm -rf $universalname -------------------------------------------------------------------------------- /test_scripts/make_universal.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ $# -eq 0 ]; 3 | then 4 | echo "Syntax: $0 [intel.zip] [arm.zip]" 5 | exit 6 | fi 7 | 8 | intelname=`basename $1 .zip` 9 | armname=`basename $2 .zip` 10 | universalname=`basename $1 -intel.zip` 11 | 12 | unzip $1 13 | unzip $2 14 | mkdir $universalname 15 | mkdir $universalname/bin 16 | cp $intelname/*.* $universalname 17 | lipo -create -output $universalname/bin/iqtree3 $intelname/bin/iqtree3 $armname/bin/iqtree3 18 | zip -vr $universalname.zip $universalname -x "*.DS_Store" 19 | -------------------------------------------------------------------------------- /test_scripts/submit_jobs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash - 2 | #=============================================================================== 3 | # 4 | # FILE: submit_jobs.sh 5 | # 6 | # USAGE: ./submit_jobs.sh 7 | # 8 | # DESCRIPTION: 9 | # 10 | # OPTIONS: --- 11 | # REQUIREMENTS: --- 12 | # BUGS: --- 13 | # NOTES: --- 14 | # AUTHOR: Tung Nguyen 15 | # ORGANIZATION: 16 | # CREATED: 02/06/2015 02:21:40 PM CET 17 | # REVISION: --- 18 | #=============================================================================== 19 | 20 | set -o nounset # Treat unset variables as an error 21 | 22 | if [ $# -ne 4 ] 23 | then 24 | echo "USAGE: $0 " 25 | exit 1 26 | fi 27 | numThreads=$1 28 | cmd_file=$2 29 | aln_dir=$3 30 | out_dir=$4 31 | 32 | if [ -d $out_dir ] 33 | then 34 | rm -rf $out_dir 35 | fi 36 | mkdir $out_dir 37 | cp ${aln_dir}/* $out_dir 38 | cp $cmd_file $out_dir 39 | cd $out_dir 40 | submitCMD="submit2sge -N iqtree_system_test -s $numThreads \"../jobmanager.py -f $cmd_file -c $numThreads\"" 41 | #echo "../jobmanager.py -f $cmd_file -c $numThreads" | qsub -V -S /bin/bash -cwd -j y -r y -N iqtree_system_test -l zuseX -l cluster -pe threads 16 -q q.norm@zuse02 42 | $submitCMD 43 | cd .. 44 | -------------------------------------------------------------------------------- /test_scripts/test_configs.txt: -------------------------------------------------------------------------------- 1 | START_PARTITION_ALN 2 | example.phy example.nex 3 | d59_8.phy d59_8.nex 4 | d69_31.phy d69_31.nex 5 | END_PARTITION_ALN 6 | 7 | START_SINGLE_ALN 8 | d59_8.phy 9 | d69_31.phy 10 | example.phy 11 | prot_M126_27_269.phy 12 | END_SINGLE_ALN 13 | 14 | START_PARTITION_OPTIONS 15 | -sp 16 | -spp 17 | -spj 18 | END_PARTITION_OPTIONS 19 | 20 | START_GENERIC_OPTIONS 21 | -m TEST 22 | -m TESTNEW 23 | -m TEST -bb 10000 -alrt 1000 -lbp 1000 24 | -m TESTNEW -bb 10000 -alrt 1000 -lbp 1000 25 | -m TEST -b 100 26 | -m TESTNEW -b 100 27 | END_GENERIC_OPTIONS 28 | -------------------------------------------------------------------------------- /test_scripts/test_data/d59_8.nex: -------------------------------------------------------------------------------- 1 | #nexus 2 | begin sets; 3 | charset ndhf1st = 1-2183; 4 | charset rbcl1st = 2184-3527; 5 | charset rpoc23rd = 3528-4207; 6 | charset cprs = 4208-4571; 7 | charset phyb3rd = 4572-5753; 8 | charset set5_8S = 5754-5913; 9 | charset its2 = 5914-6177; 10 | charset gbss13rd = 6178-6951; 11 | end; 12 | -------------------------------------------------------------------------------- /test_scripts/test_data/example.nex: -------------------------------------------------------------------------------- 1 | #nexus 2 | begin sets; 3 | charset part1 = 1-100; 4 | charset part2 = 101-384; 5 | end; 6 | -------------------------------------------------------------------------------- /test_scripts/unify-static-libs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Creates one static library from several. 4 | # 5 | # Usage: copy all your libs to a single directory and call this script. 6 | # 7 | if [[ $# -ne 2 ]]; then 8 | echo "Usage: unify-static-libs.sh output-name path-to-libs" 9 | exit 2 10 | fi 11 | # Inputs 12 | LIBNAME=$1 13 | LIBSDIR=$2 14 | # Tmp dir 15 | OBJDIR=/tmp/unify-static-libs 16 | # Command to evaluate 17 | cmd="ar -crs $LIBNAME" 18 | mkdir -p ${OBJDIR} 19 | # Extract .o 20 | echo "Extracting objects to ${OBJDIR}..." 21 | for i in ${LIBSDIR}/*.a 22 | do 23 | echo $i 24 | mkdir -p ${OBJDIR}/$i 25 | ar --output ${OBJDIR}/$i -x $i 26 | cmd="${cmd} ${OBJDIR}/$i/*.o" 27 | done 28 | # Link objects into a single lib 29 | echo "Creating $LIBNAME from objects..." 30 | eval "$cmd" 31 | # ar -crs $LIBNAME $OBJDIR/*.o 32 | # Clean up 33 | # rm -rf ${OBJDIR} 34 | echo "Done." 35 | -------------------------------------------------------------------------------- /tree/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(tree 2 | constrainttree.cpp 3 | constrainttree.h 4 | candidateset.cpp candidateset.h 5 | iqtree.cpp 6 | iqtree.h 7 | iqtreemix.cpp 8 | iqtreemix.h 9 | iqtreemixhmm.cpp 10 | iqtreemixhmm.h 11 | matree.cpp 12 | matree.h 13 | memslot.cpp memslot.h 14 | mexttree.cpp 15 | mexttree.h 16 | mtree.cpp 17 | mtree.h 18 | mtreeset.cpp 19 | mtreeset.h 20 | ncbitree.cpp 21 | ncbitree.h 22 | node.cpp 23 | node.h 24 | genomenode.h 25 | genomenode.cpp 26 | genometree.h 27 | genometree.cpp 28 | phylokernel.h 29 | phylokernelnew.h 30 | phylokernelnonrev.h 31 | phylonode.cpp 32 | phylonode.h 33 | phylonodemixlen.cpp 34 | phylonodemixlen.h 35 | phylosuperhmm.cpp 36 | phylosuperhmm.h 37 | phylosupertree.cpp 38 | phylosupertree.h 39 | phylosupertreeplen.cpp 40 | phylosupertreeplen.h 41 | phylosupertreeunlinked.cpp 42 | phylosupertreeunlinked.h 43 | phylotree.cpp 44 | phylotree.h 45 | phylotreemixlen.cpp 46 | phylotreemixlen.h 47 | phylotreepars.cpp 48 | phylotreesse.cpp 49 | quartet.cpp 50 | supernode.cpp 51 | supernode.h 52 | tinatree.cpp 53 | tinatree.h 54 | parstree.cpp 55 | parstree.h 56 | discordance.cpp 57 | phylohmm.cpp 58 | phylohmm.h 59 | ) 60 | 61 | target_link_libraries(tree pll model alignment) 62 | -------------------------------------------------------------------------------- /tree/phylonodemixlen.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // phylonodemixlen.cpp 3 | // iqtree 4 | // 5 | // Created by Minh Bui on 24/08/15. 6 | // 7 | // 8 | 9 | #include "phylonodemixlen.h" 10 | 11 | void PhyloNodeMixlen::addNeighbor(Node *node, double length, int id) { 12 | neighbors.push_back(new PhyloNeighborMixlen(node, length, id)); 13 | } 14 | 15 | void PhyloNodeMixlen::addNeighbor(Node *node, DoubleVector &length, int id) { 16 | if (length.empty()) 17 | addNeighbor(node, -1.0, id); 18 | else if (length.size() == 1) 19 | addNeighbor(node, length[0], id); 20 | else 21 | neighbors.push_back(new PhyloNeighborMixlen(node, length, id)); 22 | } 23 | -------------------------------------------------------------------------------- /tree/phylotreeeigen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * phylotreeeigen.cpp 3 | * 4 | * Created on: Sep 15, 2014 5 | * Author: minh 6 | */ 7 | 8 | 9 | 10 | #include "phylotree.h" 11 | #include "modelgtr.h" 12 | -------------------------------------------------------------------------------- /utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(utils 2 | eigendecomposition.cpp eigendecomposition.h 3 | gzstream.cpp gzstream.h 4 | optimization.cpp optimization.h 5 | stoprule.cpp stoprule.h 6 | tools.cpp tools.h 7 | pllnni.cpp pllnni.h 8 | checkpoint.cpp checkpoint.h 9 | MPIHelper.cpp MPIHelper.h 10 | starttree.cpp starttree.h 11 | bionj.cpp bionj2.cpp bionj2.h 12 | progress.cpp progress.h 13 | timeutil.h hammingdistance.h 14 | operatingsystem.cpp operatingsystem.h 15 | heapsort.h 16 | ) 17 | 18 | if(ZLIB_FOUND) 19 | target_link_libraries(utils ${ZLIB_LIBRARIES}) 20 | else(ZLIB_FOUND) 21 | target_link_libraries(utils zlibstatic) 22 | endif(ZLIB_FOUND) 23 | 24 | target_link_libraries(utils lbfgsb sprng) 25 | 26 | ################################################################## 27 | # Whether to build the decenttree executable file (default: ON) 28 | ################################################################## 29 | option(BUILD_DECENTTREE "build decenttree" ON) 30 | 31 | if(BUILD_DECENTTREE) 32 | add_executable(decentTree 33 | decenttree.cpp 34 | starttree.cpp bionj.cpp bionj2.cpp 35 | gzstream.cpp progress.cpp operatingsystem.cpp) 36 | endif(BUILD_DECENTTREE) 37 | 38 | if(ZLIB_FOUND) 39 | target_link_libraries(decentTree ${ZLIB_LIBRARIES}) 40 | else(ZLIB_FOUND) 41 | target_link_libraries(decentTree zlibstatic) 42 | endif(ZLIB_FOUND) 43 | 44 | if(CLANG AND WIN32) 45 | target_link_libraries(decentTree ${PROJECT_SOURCE_DIR}/lib/libiomp5md.dll) 46 | endif() 47 | -------------------------------------------------------------------------------- /utils/TreeCollection.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by tung on 6/23/15. 3 | // 4 | 5 | #ifndef IQTREE_TREECOLLECTION_H 6 | #define IQTREE_TREECOLLECTION_H 7 | #include "tree/candidateset.h" 8 | 9 | /** 10 | * A container for a set of trees together with their scores 11 | */ 12 | class TreeCollection { 13 | private: 14 | vector treeStrings; 15 | vector scores; 16 | vector sourceProcID; 17 | public: 18 | 19 | /** 20 | * Constructor 21 | */ 22 | TreeCollection() {}; 23 | 24 | TreeCollection(vector& trees, vector& scores, vector &sourceProcID); 25 | 26 | void addTrees(TreeCollection &trees); 27 | 28 | void addTrees(CandidateSet& candidateTrees); 29 | 30 | 31 | /* 32 | * Get i-th tree and its score 33 | */ 34 | pair getTree(int i); 35 | 36 | void clear(); 37 | 38 | void setTreeStrings(const vector treeStrings) { 39 | TreeCollection::treeStrings = treeStrings; 40 | } 41 | 42 | void setScores(const vector scores) { 43 | TreeCollection::scores = scores; 44 | } 45 | 46 | size_t getNumTrees(); 47 | 48 | const vector &getTreeStrings() const { 49 | return treeStrings; 50 | } 51 | 52 | const vector &getScores() const { 53 | return scores; 54 | } 55 | 56 | const vector &getSourceProcID() const { 57 | return sourceProcID; 58 | } 59 | 60 | }; 61 | 62 | 63 | #endif //IQTREE_TREECOLLECTION_H 64 | -------------------------------------------------------------------------------- /utils/bionj2.h: -------------------------------------------------------------------------------- 1 | // 2 | // bionj2.h 3 | // alignment 4 | // 5 | // Created by James Barbetti on 18/6/20. 6 | // 7 | 8 | #ifndef bionj2_h 9 | #define bionj2_h 10 | 11 | #include 12 | #include 13 | class BIONJ2 14 | { 15 | public: 16 | void constructTree 17 | ( const std::string &distanceMatrixFilePath 18 | , const std::string & newickTreeFilePath); 19 | void constructTreeRapid 20 | ( const std::string &distanceMatrixFilePath 21 | , const std::string & newickTreeFilePath); 22 | }; 23 | 24 | #endif /* bionj2_hpp */ 25 | -------------------------------------------------------------------------------- /utils/operatingsystem.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // operatingsystem.cpp 3 | // alignment 4 | // 5 | // Created by James Barbetti on 29/7/20. 6 | // 7 | 8 | #include "operatingsystem.h" 9 | #include 10 | #include 11 | #if defined(WIN32) || defined(WIN64) 12 | #include //for _isatty 13 | #else 14 | #include //for isatty 15 | #endif 16 | 17 | std::string getOSName() { 18 | std::stringstream out; 19 | #if defined _WIN32 || defined WIN32 || defined WIN64 20 | out << "Windows"; 21 | #elif defined __APPLE__ || defined __MACH__ 22 | out << "Mac OS X"; 23 | #elif defined __linux__ 24 | out << "Linux"; 25 | #elif defined __unix__ || defined __unix 26 | out << "Unix"; 27 | #else 28 | out << "Unknown Platform"; 29 | #endif 30 | out << " " << 8*sizeof(void*) << "-bit"; 31 | return out.str(); 32 | } 33 | 34 | bool isStandardOutputATerminal() { 35 | #if defined(WIN32) || defined(WIN64) 36 | return _isatty(fileno(stdout)); 37 | #else 38 | return isatty(fileno(stdout)); 39 | #endif 40 | } 41 | -------------------------------------------------------------------------------- /utils/operatingsystem.h: -------------------------------------------------------------------------------- 1 | // 2 | // operatingsystem.h 3 | // iqtree 4 | // 5 | // Created by James Barbetti on 29/7/20. 6 | // 7 | 8 | #ifndef operatingsystem_h 9 | #define operatingsystem_h 10 | 11 | #include 12 | 13 | std::string getOSName(); 14 | bool isStandardOutputATerminal(); 15 | 16 | #endif /* operatingsystem_h */ 17 | -------------------------------------------------------------------------------- /utils/progress.h: -------------------------------------------------------------------------------- 1 | // 2 | // progress.hpp 3 | // alignment 4 | // 5 | // Created by James Barbetti on 28/7/20. 6 | // 7 | 8 | #ifndef progress_h 9 | #define progress_h 10 | 11 | #include 12 | #include "timeutil.h" 13 | 14 | class progress_display { 15 | public: 16 | double startTime; 17 | double startCPUTime; 18 | double totalWorkToDo; 19 | double workDone; //Amount of work done so far 20 | std::string taskDescription; //A description of the task 21 | bool isDone; //True if the task has been completed 22 | std::string workVerb; //A past tense verb (e.g. sorted) 23 | std::string workUnitName; //A singular noun (e.g. row) 24 | double lastReportedWork; //Last reported work done 25 | double lastReportedTime; //Last reported wall-clock time 26 | double lastReportedCPUTime; //Last reported CPU time 27 | 28 | explicit progress_display ( double workToDo, const char* doingWhat="" 29 | , const char* verb="", const char* unitName=""); 30 | ~progress_display(); 31 | progress_display& operator += (double incrementalWork); 32 | progress_display& operator ++ (); 33 | progress_display& operator = (double workDoneNow); 34 | progress_display& hide (); 35 | progress_display& show (); 36 | progress_display& done (); 37 | void reportProgress(double time, double cpu, bool newline); 38 | static void setProgressDisplay(bool displayIt); 39 | static bool getProgressDisplay(); 40 | }; 41 | 42 | 43 | #endif /* progress_hpp */ 44 | -------------------------------------------------------------------------------- /vectorclass/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(vectorclass 2 | instrset_detect.cpp 3 | instrset.h 4 | vectorclass.h 5 | vectorf64.h 6 | vectorf128.h 7 | vectorf256.h 8 | vectorf512.h 9 | ) 10 | -------------------------------------------------------------------------------- /vectorclass/vectormath_common.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/vectorclass/vectormath_common.h -------------------------------------------------------------------------------- /whtest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories("${PROJECT_BINARY_DIR}") 3 | 4 | add_library(whtest 5 | eigen.c 6 | eigen_sym.c 7 | random.c 8 | weisslambda.c 9 | weisslambda_sub.c 10 | whtest.c 11 | whtest_sub.c 12 | whtest_wrapper.cpp whtest_wrapper.h 13 | ) 14 | 15 | #install (TARGETS whtest DESTINATION bin) 16 | #install (FILES eigen.h eigen_sym.h random.h tools.h weisslambda_sub.h whtest.h whtest_sub.h DESTINATION include) 17 | -------------------------------------------------------------------------------- /yaml-cpp/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Style 2 | 3 | This project is formatted with [clang-format][fmt] using the style file at the root of the repository. Please run clang-format before sending a pull request. 4 | 5 | In general, try to follow the style of surrounding code. We mostly follow the [Google C++ style guide][cpp-style]. 6 | 7 | Commit messages should be in the imperative mood, as described in the [Git contributing file][git-contrib]: 8 | 9 | > Describe your changes in imperative mood, e.g. "make xyzzy do frotz" 10 | > instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy 11 | > to do frotz", as if you are giving orders to the codebase to change 12 | > its behaviour. 13 | 14 | [fmt]: http://clang.llvm.org/docs/ClangFormat.html 15 | [cpp-style]: https://google.github.io/styleguide/cppguide.html 16 | [git-contrib]: http://git.kernel.org/cgit/git/git.git/tree/Documentation/SubmittingPatches?id=HEAD 17 | 18 | # Tests 19 | 20 | Please verify the tests pass by running the target `tests/run_tests`. 21 | 22 | If you are adding functionality, add tests accordingly. 23 | 24 | # Pull request process 25 | 26 | Every pull request undergoes a code review. Unfortunately, github's code review process isn't great, but we'll manage. During the code review, if you make changes, add new commits to the pull request for each change. Once the code review is complete, rebase against the master branch and squash into a single commit. 27 | -------------------------------------------------------------------------------- /yaml-cpp/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008-2015 Jesse Beder. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /yaml-cpp/include/yaml-cpp/anchor.h: -------------------------------------------------------------------------------- 1 | #ifndef ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | #include 11 | 12 | namespace YAML { 13 | typedef std::size_t anchor_t; 14 | const anchor_t NullAnchor = 0; 15 | } 16 | 17 | #endif // ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 18 | -------------------------------------------------------------------------------- /yaml-cpp/include/yaml-cpp/contrib/anchordict.h: -------------------------------------------------------------------------------- 1 | #ifndef ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | #include 11 | 12 | #include "../anchor.h" 13 | 14 | namespace YAML { 15 | /** 16 | * An object that stores and retrieves values correlating to {@link anchor_t} 17 | * values. 18 | * 19 | *

Efficient implementation that can make assumptions about how 20 | * {@code anchor_t} values are assigned by the {@link Parser} class. 21 | */ 22 | template 23 | class AnchorDict { 24 | public: 25 | AnchorDict() : m_data{} {} 26 | void Register(anchor_t anchor, T value) { 27 | if (anchor > m_data.size()) { 28 | m_data.resize(anchor); 29 | } 30 | m_data[anchor - 1] = value; 31 | } 32 | 33 | T Get(anchor_t anchor) const { return m_data[anchor - 1]; } 34 | 35 | private: 36 | std::vector m_data; 37 | }; 38 | } // namespace YAML 39 | 40 | #endif // ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 41 | -------------------------------------------------------------------------------- /yaml-cpp/include/yaml-cpp/emitterdef.h: -------------------------------------------------------------------------------- 1 | #ifndef EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | namespace YAML { 11 | struct EmitterNodeType { 12 | enum value { NoType, Property, Scalar, FlowSeq, BlockSeq, FlowMap, BlockMap }; 13 | }; 14 | } 15 | 16 | #endif // EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66 17 | -------------------------------------------------------------------------------- /yaml-cpp/include/yaml-cpp/emitterstyle.h: -------------------------------------------------------------------------------- 1 | #ifndef EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | namespace YAML { 11 | struct EmitterStyle { 12 | enum value { Default, Block, Flow }; 13 | }; 14 | } 15 | 16 | #endif // EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 17 | -------------------------------------------------------------------------------- /yaml-cpp/include/yaml-cpp/mark.h: -------------------------------------------------------------------------------- 1 | #ifndef MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | #include "yaml-cpp/dll.h" 11 | 12 | namespace YAML { 13 | struct YAML_CPP_API Mark { 14 | Mark() : pos(0), line(0), column(0) {} 15 | 16 | static const Mark null_mark() { return Mark(-1, -1, -1); } 17 | 18 | bool is_null() const { return pos == -1 && line == -1 && column == -1; } 19 | 20 | int pos; 21 | int line, column; 22 | 23 | private: 24 | Mark(int pos_, int line_, int column_) 25 | : pos(pos_), line(line_), column(column_) {} 26 | }; 27 | } 28 | 29 | #endif // MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66 30 | -------------------------------------------------------------------------------- /yaml-cpp/include/yaml-cpp/node/detail/bool_type.h: -------------------------------------------------------------------------------- 1 | #ifndef NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | namespace YAML { 11 | namespace detail { 12 | struct unspecified_bool { 13 | struct NOT_ALLOWED; 14 | static void true_value(NOT_ALLOWED*) {} 15 | }; 16 | typedef void (*unspecified_bool_type)(unspecified_bool::NOT_ALLOWED*); 17 | } 18 | } 19 | 20 | #define YAML_CPP_OPERATOR_BOOL() \ 21 | operator YAML::detail::unspecified_bool_type() const { \ 22 | return this->operator!() ? 0 \ 23 | : &YAML::detail::unspecified_bool::true_value; \ 24 | } 25 | 26 | #endif // NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 27 | -------------------------------------------------------------------------------- /yaml-cpp/include/yaml-cpp/node/detail/iterator_fwd.h: -------------------------------------------------------------------------------- 1 | #ifndef VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | #include "yaml-cpp/dll.h" 11 | #include 12 | #include 13 | #include 14 | 15 | namespace YAML { 16 | 17 | namespace detail { 18 | struct iterator_value; 19 | template 20 | class iterator_base; 21 | } 22 | 23 | typedef detail::iterator_base iterator; 24 | typedef detail::iterator_base const_iterator; 25 | } 26 | 27 | #endif // VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66 28 | -------------------------------------------------------------------------------- /yaml-cpp/include/yaml-cpp/node/detail/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | #include 11 | 12 | #include "yaml-cpp/dll.h" 13 | #include "yaml-cpp/node/ptr.h" 14 | 15 | namespace YAML { 16 | namespace detail { 17 | class node; 18 | } // namespace detail 19 | } // namespace YAML 20 | 21 | namespace YAML { 22 | namespace detail { 23 | class YAML_CPP_API memory { 24 | public: 25 | memory() : m_nodes{} {} 26 | node& create_node(); 27 | void merge(const memory& rhs); 28 | 29 | private: 30 | typedef std::set Nodes; 31 | Nodes m_nodes; 32 | }; 33 | 34 | class YAML_CPP_API memory_holder { 35 | public: 36 | memory_holder() : m_pMemory(new memory) {} 37 | 38 | node& create_node() { return m_pMemory->create_node(); } 39 | void merge(memory_holder& rhs); 40 | 41 | private: 42 | shared_memory m_pMemory; 43 | }; 44 | } // namespace detail 45 | } // namespace YAML 46 | 47 | #endif // VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66 48 | -------------------------------------------------------------------------------- /yaml-cpp/include/yaml-cpp/node/emit.h: -------------------------------------------------------------------------------- 1 | #ifndef NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | #include 11 | #include 12 | 13 | #include "yaml-cpp/dll.h" 14 | 15 | namespace YAML { 16 | class Emitter; 17 | class Node; 18 | 19 | /** 20 | * Emits the node to the given {@link Emitter}. If there is an error in writing, 21 | * {@link Emitter#good} will return false. 22 | */ 23 | YAML_CPP_API Emitter& operator<<(Emitter& out, const Node& node); 24 | 25 | /** Emits the node to the given output stream. */ 26 | YAML_CPP_API std::ostream& operator<<(std::ostream& out, const Node& node); 27 | 28 | /** Converts the node to a YAML string. */ 29 | YAML_CPP_API std::string Dump(const Node& node); 30 | } // namespace YAML 31 | 32 | #endif // NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 33 | -------------------------------------------------------------------------------- /yaml-cpp/include/yaml-cpp/node/iterator.h: -------------------------------------------------------------------------------- 1 | #ifndef VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | #include "yaml-cpp/dll.h" 11 | #include "yaml-cpp/node/node.h" 12 | #include "yaml-cpp/node/detail/iterator_fwd.h" 13 | #include "yaml-cpp/node/detail/iterator.h" 14 | #include 15 | #include 16 | #include 17 | 18 | namespace YAML { 19 | namespace detail { 20 | struct iterator_value : public Node, std::pair { 21 | iterator_value() {} 22 | explicit iterator_value(const Node& rhs) 23 | : Node(rhs), 24 | std::pair(Node(Node::ZombieNode), Node(Node::ZombieNode)) {} 25 | explicit iterator_value(const Node& key, const Node& value) 26 | : Node(Node::ZombieNode), std::pair(key, value) {} 27 | }; 28 | } 29 | } 30 | 31 | #endif // VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 32 | -------------------------------------------------------------------------------- /yaml-cpp/include/yaml-cpp/node/ptr.h: -------------------------------------------------------------------------------- 1 | #ifndef VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | #include "yaml-cpp/dll.h" 11 | #include 12 | 13 | namespace YAML { 14 | namespace detail { 15 | class node; 16 | class node_ref; 17 | class node_data; 18 | class memory; 19 | class memory_holder; 20 | 21 | typedef std::shared_ptr shared_node; 22 | typedef std::shared_ptr shared_node_ref; 23 | typedef std::shared_ptr shared_node_data; 24 | typedef std::shared_ptr shared_memory_holder; 25 | typedef std::shared_ptr shared_memory; 26 | } 27 | } 28 | 29 | #endif // VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 30 | -------------------------------------------------------------------------------- /yaml-cpp/include/yaml-cpp/node/type.h: -------------------------------------------------------------------------------- 1 | #ifndef VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | namespace YAML { 11 | struct NodeType { 12 | enum value { Undefined, Null, Scalar, Sequence, Map }; 13 | }; 14 | } 15 | 16 | #endif // VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 17 | -------------------------------------------------------------------------------- /yaml-cpp/include/yaml-cpp/noncopyable.h: -------------------------------------------------------------------------------- 1 | #ifndef NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | #include "yaml-cpp/dll.h" 11 | 12 | namespace YAML { 13 | // this is basically boost::noncopyable 14 | class YAML_CPP_API noncopyable { 15 | protected: 16 | noncopyable() {} 17 | ~noncopyable() {} 18 | 19 | private: 20 | noncopyable(const noncopyable&); 21 | const noncopyable& operator=(const noncopyable&); 22 | }; 23 | } 24 | 25 | #endif // NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 26 | -------------------------------------------------------------------------------- /yaml-cpp/include/yaml-cpp/null.h: -------------------------------------------------------------------------------- 1 | #ifndef NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | #include "yaml-cpp/dll.h" 11 | #include 12 | 13 | namespace YAML { 14 | class Node; 15 | 16 | struct YAML_CPP_API _Null {}; 17 | inline bool operator==(const _Null&, const _Null&) { return true; } 18 | inline bool operator!=(const _Null&, const _Null&) { return false; } 19 | 20 | YAML_CPP_API bool IsNull(const Node& node); // old API only 21 | YAML_CPP_API bool IsNullString(const std::string& str); 22 | 23 | extern YAML_CPP_API _Null Null; 24 | } 25 | 26 | #endif // NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 27 | -------------------------------------------------------------------------------- /yaml-cpp/include/yaml-cpp/yaml.h: -------------------------------------------------------------------------------- 1 | #ifndef YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | #include "yaml-cpp/parser.h" 11 | #include "yaml-cpp/emitter.h" 12 | #include "yaml-cpp/emitterstyle.h" 13 | #include "yaml-cpp/stlemitter.h" 14 | #include "yaml-cpp/exceptions.h" 15 | 16 | #include "yaml-cpp/node/node.h" 17 | #include "yaml-cpp/node/impl.h" 18 | #include "yaml-cpp/node/convert.h" 19 | #include "yaml-cpp/node/iterator.h" 20 | #include "yaml-cpp/node/detail/impl.h" 21 | #include "yaml-cpp/node/parse.h" 22 | #include "yaml-cpp/node/emit.h" 23 | 24 | #endif // YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66 25 | -------------------------------------------------------------------------------- /yaml-cpp/install.txt: -------------------------------------------------------------------------------- 1 | *** With CMake *** 2 | 3 | yaml-cpp uses CMake to support cross-platform building. In a UNIX-like system, the basic steps to build are: 4 | 5 | 1. Download and install CMake (if you don't have root privileges, just install to a local directory, like ~/bin) 6 | 7 | 2. From the source directory, run: 8 | 9 | mkdir build 10 | cd build 11 | cmake .. 12 | 13 | and then the usual 14 | 15 | make 16 | make install 17 | 18 | 3. To clean up, just remove the 'build' directory. 19 | 20 | *** Without CMake *** 21 | 22 | If you don't want to use CMake, just add all .cpp files to a makefile. yaml-cpp does not need any special build settings, so no 'configure' file is necessary. 23 | 24 | (Note: this is pretty tedious. It's sooo much easier to use CMake.) 25 | -------------------------------------------------------------------------------- /yaml-cpp/src/collectionstack.h: -------------------------------------------------------------------------------- 1 | #ifndef COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | #include 11 | #include 12 | 13 | namespace YAML { 14 | struct CollectionType { 15 | enum value { NoCollection, BlockMap, BlockSeq, FlowMap, FlowSeq, CompactMap }; 16 | }; 17 | 18 | class CollectionStack { 19 | public: 20 | CollectionStack() : collectionStack{} {} 21 | CollectionType::value GetCurCollectionType() const { 22 | if (collectionStack.empty()) 23 | return CollectionType::NoCollection; 24 | return collectionStack.top(); 25 | } 26 | 27 | void PushCollectionType(CollectionType::value type) { 28 | collectionStack.push(type); 29 | } 30 | void PopCollectionType(CollectionType::value type) { 31 | assert(type == GetCurCollectionType()); 32 | (void)type; 33 | collectionStack.pop(); 34 | } 35 | 36 | private: 37 | std::stack collectionStack; 38 | }; 39 | } // namespace YAML 40 | 41 | #endif // COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66 42 | -------------------------------------------------------------------------------- /yaml-cpp/src/contrib/graphbuilder.cpp: -------------------------------------------------------------------------------- 1 | #include "graphbuilderadapter.h" 2 | 3 | #include "yaml-cpp/parser.h" // IWYU pragma: keep 4 | 5 | namespace YAML { 6 | class GraphBuilderInterface; 7 | 8 | void* BuildGraphOfNextDocument(Parser& parser, 9 | GraphBuilderInterface& graphBuilder) { 10 | GraphBuilderAdapter eventHandler(graphBuilder); 11 | if (parser.HandleNextDocument(eventHandler)) { 12 | return eventHandler.RootNode(); 13 | } else { 14 | return nullptr; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /yaml-cpp/src/contrib/yaml-cpp.natvis.md: -------------------------------------------------------------------------------- 1 | # MSVC debugger visualizer for YAML::Node 2 | 3 | ## How to use 4 | Add yaml-cpp.natvis to your Visual C++ project like any other source file. It will be included in the debug information, and improve debugger display on YAML::Node and contained types. 5 | 6 | ## Compatibility and Troubleshooting 7 | 8 | This has been tested for MSVC 2017. It is expected to be compatible with VS 2015 and VS 2019. If you have any problems, you can open an issue here: https://github.com/peterchen-cp/yaml-cpp-natvis 9 | 10 | -------------------------------------------------------------------------------- /yaml-cpp/src/directives.cpp: -------------------------------------------------------------------------------- 1 | #include "directives.h" 2 | 3 | namespace YAML { 4 | Directives::Directives() : version{true, 1, 2}, tags{} {} 5 | 6 | const std::string Directives::TranslateTagHandle( 7 | const std::string& handle) const { 8 | std::map::const_iterator it = tags.find(handle); 9 | if (it == tags.end()) { 10 | if (handle == "!!") 11 | return "tag:yaml.org,2002:"; 12 | return handle; 13 | } 14 | 15 | return it->second; 16 | } 17 | } // namespace YAML 18 | -------------------------------------------------------------------------------- /yaml-cpp/src/directives.h: -------------------------------------------------------------------------------- 1 | #ifndef DIRECTIVES_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define DIRECTIVES_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | #include 11 | #include 12 | 13 | namespace YAML { 14 | struct Version { 15 | bool isDefault; 16 | int major, minor; 17 | }; 18 | 19 | struct Directives { 20 | Directives(); 21 | 22 | const std::string TranslateTagHandle(const std::string& handle) const; 23 | 24 | Version version; 25 | std::map tags; 26 | }; 27 | } 28 | 29 | #endif // DIRECTIVES_H_62B23520_7C8E_11DE_8A39_0800200C9A66 30 | -------------------------------------------------------------------------------- /yaml-cpp/src/emit.cpp: -------------------------------------------------------------------------------- 1 | #include "yaml-cpp/node/emit.h" 2 | #include "yaml-cpp/emitfromevents.h" 3 | #include "yaml-cpp/emitter.h" 4 | #include "nodeevents.h" 5 | 6 | namespace YAML { 7 | Emitter& operator<<(Emitter& out, const Node& node) { 8 | EmitFromEvents emitFromEvents(out); 9 | NodeEvents events(node); 10 | events.Emit(emitFromEvents); 11 | return out; 12 | } 13 | 14 | std::ostream& operator<<(std::ostream& out, const Node& node) { 15 | Emitter emitter(out); 16 | emitter << node; 17 | return out; 18 | } 19 | 20 | std::string Dump(const Node& node) { 21 | Emitter emitter; 22 | emitter << node; 23 | return emitter.c_str(); 24 | } 25 | } // namespace YAML 26 | -------------------------------------------------------------------------------- /yaml-cpp/src/exceptions.cpp: -------------------------------------------------------------------------------- 1 | #include "yaml-cpp/exceptions.h" 2 | 3 | // This is here for compatibility with older versions of Visual Studio 4 | // which don't support noexcept 5 | #if defined(_MSC_VER) && _MSC_VER < 1900 6 | #define YAML_CPP_NOEXCEPT _NOEXCEPT 7 | #else 8 | #define YAML_CPP_NOEXCEPT noexcept 9 | #endif 10 | 11 | namespace YAML { 12 | 13 | // These destructors are defined out-of-line so the vtable is only emitted once. 14 | Exception::~Exception() YAML_CPP_NOEXCEPT {} 15 | ParserException::~ParserException() YAML_CPP_NOEXCEPT {} 16 | RepresentationException::~RepresentationException() YAML_CPP_NOEXCEPT {} 17 | InvalidScalar::~InvalidScalar() YAML_CPP_NOEXCEPT {} 18 | KeyNotFound::~KeyNotFound() YAML_CPP_NOEXCEPT {} 19 | InvalidNode::~InvalidNode() YAML_CPP_NOEXCEPT {} 20 | BadConversion::~BadConversion() YAML_CPP_NOEXCEPT {} 21 | BadDereference::~BadDereference() YAML_CPP_NOEXCEPT {} 22 | BadSubscript::~BadSubscript() YAML_CPP_NOEXCEPT {} 23 | BadPushback::~BadPushback() YAML_CPP_NOEXCEPT {} 24 | BadInsert::~BadInsert() YAML_CPP_NOEXCEPT {} 25 | EmitterException::~EmitterException() YAML_CPP_NOEXCEPT {} 26 | BadFile::~BadFile() YAML_CPP_NOEXCEPT {} 27 | } 28 | 29 | #undef YAML_CPP_NOEXCEPT 30 | 31 | 32 | -------------------------------------------------------------------------------- /yaml-cpp/src/indentation.h: -------------------------------------------------------------------------------- 1 | #ifndef INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | #include 11 | #include 12 | 13 | #include "yaml-cpp/ostream_wrapper.h" 14 | 15 | namespace YAML { 16 | struct Indentation { 17 | Indentation(std::size_t n_) : n(n_) {} 18 | std::size_t n; 19 | }; 20 | 21 | inline ostream_wrapper& operator<<(ostream_wrapper& out, 22 | const Indentation& indent) { 23 | for (std::size_t i = 0; i < indent.n; i++) 24 | out << ' '; 25 | return out; 26 | } 27 | 28 | struct IndentTo { 29 | IndentTo(std::size_t n_) : n(n_) {} 30 | std::size_t n; 31 | }; 32 | 33 | inline ostream_wrapper& operator<<(ostream_wrapper& out, 34 | const IndentTo& indent) { 35 | while (out.col() < indent.n) 36 | out << ' '; 37 | return out; 38 | } 39 | } 40 | 41 | #endif // INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66 42 | -------------------------------------------------------------------------------- /yaml-cpp/src/memory.cpp: -------------------------------------------------------------------------------- 1 | #include "yaml-cpp/node/detail/memory.h" 2 | #include "yaml-cpp/node/detail/node.h" // IWYU pragma: keep 3 | #include "yaml-cpp/node/ptr.h" 4 | 5 | namespace YAML { 6 | namespace detail { 7 | 8 | void memory_holder::merge(memory_holder& rhs) { 9 | if (m_pMemory == rhs.m_pMemory) 10 | return; 11 | 12 | m_pMemory->merge(*rhs.m_pMemory); 13 | rhs.m_pMemory = m_pMemory; 14 | } 15 | 16 | node& memory::create_node() { 17 | shared_node pNode(new node); 18 | m_nodes.insert(pNode); 19 | return *pNode; 20 | } 21 | 22 | void memory::merge(const memory& rhs) { 23 | m_nodes.insert(rhs.m_nodes.begin(), rhs.m_nodes.end()); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /yaml-cpp/src/node.cpp: -------------------------------------------------------------------------------- 1 | #include "yaml-cpp/node/node.h" 2 | #include "nodebuilder.h" 3 | #include "nodeevents.h" 4 | 5 | namespace YAML { 6 | Node Clone(const Node& node) { 7 | NodeEvents events(node); 8 | NodeBuilder builder; 9 | events.Emit(builder); 10 | return builder.Root(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /yaml-cpp/src/null.cpp: -------------------------------------------------------------------------------- 1 | #include "yaml-cpp/null.h" 2 | 3 | namespace YAML { 4 | _Null Null; 5 | 6 | bool IsNullString(const std::string& str) { 7 | return str.empty() || str == "~" || str == "null" || str == "Null" || 8 | str == "NULL"; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /yaml-cpp/src/ptr_vector.h: -------------------------------------------------------------------------------- 1 | #ifndef PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | namespace YAML { 16 | 17 | // TODO: This class is no longer needed 18 | template 19 | class ptr_vector { 20 | public: 21 | ptr_vector() : m_data{} {} 22 | ptr_vector(const ptr_vector&) = delete; 23 | ptr_vector(ptr_vector&&) = default; 24 | ptr_vector& operator=(const ptr_vector&) = delete; 25 | ptr_vector& operator=(ptr_vector&&) = default; 26 | 27 | void clear() { m_data.clear(); } 28 | 29 | std::size_t size() const { return m_data.size(); } 30 | bool empty() const { return m_data.empty(); } 31 | 32 | void push_back(std::unique_ptr&& t) { m_data.push_back(std::move(t)); } 33 | T& operator[](std::size_t i) { return *m_data[i]; } 34 | const T& operator[](std::size_t i) const { return *m_data[i]; } 35 | 36 | T& back() { return *(m_data.back().get()); } 37 | 38 | const T& back() const { return *(m_data.back().get()); } 39 | 40 | private: 41 | std::vector> m_data; 42 | }; 43 | } // namespace YAML 44 | 45 | #endif // PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 46 | -------------------------------------------------------------------------------- /yaml-cpp/src/regex_yaml.cpp: -------------------------------------------------------------------------------- 1 | #include "regex_yaml.h" 2 | 3 | namespace YAML { 4 | // constructors 5 | 6 | RegEx::RegEx(REGEX_OP op) : m_op(op), m_a(0), m_z(0), m_params{} {} 7 | RegEx::RegEx() : RegEx(REGEX_EMPTY) {} 8 | 9 | RegEx::RegEx(char ch) : m_op(REGEX_MATCH), m_a(ch), m_z(0), m_params{} {} 10 | 11 | RegEx::RegEx(char a, char z) : m_op(REGEX_RANGE), m_a(a), m_z(z), m_params{} {} 12 | 13 | RegEx::RegEx(const std::string& str, REGEX_OP op) 14 | : m_op(op), m_a(0), m_z(0), m_params(str.begin(), str.end()) {} 15 | 16 | // combination constructors 17 | RegEx operator!(const RegEx& ex) { 18 | RegEx ret(REGEX_NOT); 19 | ret.m_params.push_back(ex); 20 | return ret; 21 | } 22 | 23 | RegEx operator|(const RegEx& ex1, const RegEx& ex2) { 24 | RegEx ret(REGEX_OR); 25 | ret.m_params.push_back(ex1); 26 | ret.m_params.push_back(ex2); 27 | return ret; 28 | } 29 | 30 | RegEx operator&(const RegEx& ex1, const RegEx& ex2) { 31 | RegEx ret(REGEX_AND); 32 | ret.m_params.push_back(ex1); 33 | ret.m_params.push_back(ex2); 34 | return ret; 35 | } 36 | 37 | RegEx operator+(const RegEx& ex1, const RegEx& ex2) { 38 | RegEx ret(REGEX_SEQ); 39 | ret.m_params.push_back(ex1); 40 | ret.m_params.push_back(ex2); 41 | return ret; 42 | } 43 | } // namespace YAML 44 | -------------------------------------------------------------------------------- /yaml-cpp/src/scantag.h: -------------------------------------------------------------------------------- 1 | #ifndef SCANTAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define SCANTAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | #include 11 | #include "stream.h" 12 | 13 | namespace YAML { 14 | const std::string ScanVerbatimTag(Stream& INPUT); 15 | const std::string ScanTagHandle(Stream& INPUT, bool& canBeHandle); 16 | const std::string ScanTagSuffix(Stream& INPUT); 17 | } 18 | 19 | #endif // SCANTAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66 20 | -------------------------------------------------------------------------------- /yaml-cpp/src/stringsource.h: -------------------------------------------------------------------------------- 1 | #ifndef STRINGSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define STRINGSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | #include 11 | 12 | namespace YAML { 13 | class StringCharSource { 14 | public: 15 | StringCharSource(const char* str, std::size_t size) 16 | : m_str(str), m_size(size), m_offset(0) {} 17 | 18 | operator bool() const { return m_offset < m_size; } 19 | char operator[](std::size_t i) const { return m_str[m_offset + i]; } 20 | bool operator!() const { return !static_cast(*this); } 21 | 22 | const StringCharSource operator+(int i) const { 23 | StringCharSource source(*this); 24 | if (static_cast(source.m_offset) + i >= 0) 25 | source.m_offset += i; 26 | else 27 | source.m_offset = 0; 28 | return source; 29 | } 30 | 31 | StringCharSource& operator++() { 32 | ++m_offset; 33 | return *this; 34 | } 35 | 36 | StringCharSource& operator+=(std::size_t offset) { 37 | m_offset += offset; 38 | return *this; 39 | } 40 | 41 | private: 42 | const char* m_str; 43 | std::size_t m_size; 44 | std::size_t m_offset; 45 | }; 46 | } 47 | 48 | #endif // STRINGSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 49 | -------------------------------------------------------------------------------- /yaml-cpp/src/tag.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "directives.h" // IWYU pragma: keep 5 | #include "tag.h" 6 | #include "token.h" 7 | 8 | namespace YAML { 9 | Tag::Tag(const Token& token) 10 | : type(static_cast(token.data)), handle{}, value{} { 11 | switch (type) { 12 | case VERBATIM: 13 | value = token.value; 14 | break; 15 | case PRIMARY_HANDLE: 16 | value = token.value; 17 | break; 18 | case SECONDARY_HANDLE: 19 | value = token.value; 20 | break; 21 | case NAMED_HANDLE: 22 | handle = token.value; 23 | value = token.params[0]; 24 | break; 25 | case NON_SPECIFIC: 26 | break; 27 | default: 28 | assert(false); 29 | } 30 | } 31 | 32 | const std::string Tag::Translate(const Directives& directives) { 33 | switch (type) { 34 | case VERBATIM: 35 | return value; 36 | case PRIMARY_HANDLE: 37 | return directives.TranslateTagHandle("!") + value; 38 | case SECONDARY_HANDLE: 39 | return directives.TranslateTagHandle("!!") + value; 40 | case NAMED_HANDLE: 41 | return directives.TranslateTagHandle("!" + handle + "!") + value; 42 | case NON_SPECIFIC: 43 | // TODO: 44 | return "!"; 45 | default: 46 | assert(false); 47 | } 48 | throw std::runtime_error("yaml-cpp: internal error, bad tag type"); 49 | } 50 | } // namespace YAML 51 | -------------------------------------------------------------------------------- /yaml-cpp/src/tag.h: -------------------------------------------------------------------------------- 1 | #ifndef TAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66 2 | #define TAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66 3 | 4 | #if defined(_MSC_VER) || \ 5 | (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ 6 | (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 7 | #pragma once 8 | #endif 9 | 10 | #include 11 | 12 | namespace YAML { 13 | struct Directives; 14 | struct Token; 15 | 16 | struct Tag { 17 | enum TYPE { 18 | VERBATIM, 19 | PRIMARY_HANDLE, 20 | SECONDARY_HANDLE, 21 | NAMED_HANDLE, 22 | NON_SPECIFIC 23 | }; 24 | 25 | Tag(const Token& token); 26 | const std::string Translate(const Directives& directives); 27 | 28 | TYPE type; 29 | std::string handle, value; 30 | }; 31 | } 32 | 33 | #endif // TAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66 34 | -------------------------------------------------------------------------------- /yaml-cpp/util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | add_sources(parse.cpp) 4 | add_executable(parse parse.cpp) 5 | target_link_libraries(parse yaml-cpp) 6 | 7 | add_sources(sandbox.cpp) 8 | add_executable(sandbox sandbox.cpp) 9 | target_link_libraries(sandbox yaml-cpp) 10 | 11 | add_sources(read.cpp) 12 | add_executable(read read.cpp) 13 | target_link_libraries(read yaml-cpp) 14 | 15 | -------------------------------------------------------------------------------- /yaml-cpp/util/sandbox.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "yaml-cpp/emitterstyle.h" 4 | #include "yaml-cpp/eventhandler.h" 5 | #include "yaml-cpp/yaml.h" // IWYU pragma: keep 6 | 7 | class NullEventHandler : public YAML::EventHandler { 8 | public: 9 | typedef YAML::Mark Mark; 10 | typedef YAML::anchor_t anchor_t; 11 | 12 | NullEventHandler() {} 13 | 14 | virtual void OnDocumentStart(const Mark&) {} 15 | virtual void OnDocumentEnd() {} 16 | virtual void OnNull(const Mark&, anchor_t) {} 17 | virtual void OnAlias(const Mark&, anchor_t) {} 18 | virtual void OnScalar(const Mark&, const std::string&, anchor_t, 19 | const std::string&) {} 20 | virtual void OnSequenceStart(const Mark&, const std::string&, anchor_t, 21 | YAML::EmitterStyle::value style) {} 22 | virtual void OnSequenceEnd() {} 23 | virtual void OnMapStart(const Mark&, const std::string&, anchor_t, 24 | YAML::EmitterStyle::value style) {} 25 | virtual void OnMapEnd() {} 26 | }; 27 | 28 | int main() { 29 | YAML::Node root; 30 | 31 | for (;;) { 32 | YAML::Node node; 33 | root = node; 34 | } 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /yaml-cpp/yaml-cpp-config-version.cmake.in: -------------------------------------------------------------------------------- 1 | set(PACKAGE_VERSION "@YAML_CPP_VERSION@") 2 | 3 | # Check whether the requested PACKAGE_FIND_VERSION is compatible 4 | if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") 5 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 6 | else() 7 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 8 | if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") 9 | set(PACKAGE_VERSION_EXACT TRUE) 10 | endif() 11 | endif() 12 | -------------------------------------------------------------------------------- /yaml-cpp/yaml-cpp-config.cmake.in: -------------------------------------------------------------------------------- 1 | # - Config file for the yaml-cpp package 2 | # It defines the following variables 3 | # YAML_CPP_INCLUDE_DIR - include directory 4 | # YAML_CPP_LIBRARIES - libraries to link against 5 | 6 | # Compute paths 7 | get_filename_component(YAML_CPP_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) 8 | set(YAML_CPP_INCLUDE_DIR "@CONFIG_INCLUDE_DIRS@") 9 | 10 | # Our library dependencies (contains definitions for IMPORTED targets) 11 | include("${YAML_CPP_CMAKE_DIR}/yaml-cpp-targets.cmake") 12 | 13 | # These are IMPORTED targets created by yaml-cpp-targets.cmake 14 | set(YAML_CPP_LIBRARIES "@EXPORT_TARGETS@") 15 | -------------------------------------------------------------------------------- /yaml-cpp/yaml-cpp.pc.cmake: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=${prefix} 3 | includedir=${prefix}/@INCLUDE_INSTALL_ROOT_DIR@ 4 | libdir=${exec_prefix}/@LIB_INSTALL_DIR@ 5 | 6 | Name: Yaml-cpp 7 | Description: A YAML parser and emitter for C++ 8 | Version: @YAML_CPP_VERSION@ 9 | Requires: 10 | Libs: -L${libdir} -lyaml-cpp 11 | Cflags: -I${includedir} 12 | -------------------------------------------------------------------------------- /zlib-1.2.7/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/zlib-1.2.7/ChangeLog -------------------------------------------------------------------------------- /zlib-1.2.7/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | -@echo "Please use ./configure first. Thank you." 3 | 4 | distclean: 5 | make -f Makefile.in distclean 6 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/README.contrib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/zlib-1.2.7/contrib/README.contrib -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/ada/zlib.gpr: -------------------------------------------------------------------------------- 1 | project Zlib is 2 | 3 | for Languages use ("Ada"); 4 | for Source_Dirs use ("."); 5 | for Object_Dir use "."; 6 | for Main use ("test.adb", "mtest.adb", "read.adb", "buffer_demo"); 7 | 8 | package Compiler is 9 | for Default_Switches ("ada") use ("-gnatwcfilopru", "-gnatVcdfimorst", "-gnatyabcefhiklmnoprst"); 10 | end Compiler; 11 | 12 | package Linker is 13 | for Default_Switches ("ada") use ("-lz"); 14 | end Linker; 15 | 16 | package Builder is 17 | for Default_Switches ("ada") use ("-s", "-gnatQ"); 18 | end Builder; 19 | 20 | end Zlib; 21 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/blast/Makefile: -------------------------------------------------------------------------------- 1 | blast: blast.c blast.h 2 | cc -DTEST -o blast blast.c 3 | 4 | test: blast 5 | blast < test.pk | cmp - test.txt 6 | 7 | clean: 8 | rm -f blast blast.o 9 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/blast/README: -------------------------------------------------------------------------------- 1 | Read blast.h for purpose and usage. 2 | 3 | Mark Adler 4 | madler@alumni.caltech.edu 5 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/blast/test.pk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/zlib-1.2.7/contrib/blast/test.pk -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/blast/test.txt: -------------------------------------------------------------------------------- 1 | AIAIAIAIAIAIA -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/delphi/ZLibConst.pas: -------------------------------------------------------------------------------- 1 | unit ZLibConst; 2 | 3 | interface 4 | 5 | resourcestring 6 | sTargetBufferTooSmall = 'ZLib error: target buffer may be too small'; 7 | sInvalidStreamOp = 'Invalid stream operation'; 8 | 9 | implementation 10 | 11 | end. 12 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/dotzlib/DotZLib.build: -------------------------------------------------------------------------------- 1 |  2 | 3 | A .Net wrapper library around ZLib1.dll 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 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/dotzlib/DotZLib.chm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/zlib-1.2.7/contrib/dotzlib/DotZLib.chm -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/dotzlib/DotZLib.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 8.00 2 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotZLib", "DotZLib\DotZLib.csproj", "{BB1EE0B1-1808-46CB-B786-949D91117FC5}" 3 | ProjectSection(ProjectDependencies) = postProject 4 | EndProjectSection 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfiguration) = preSolution 8 | Debug = Debug 9 | Release = Release 10 | EndGlobalSection 11 | GlobalSection(ProjectConfiguration) = postSolution 12 | {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Debug.ActiveCfg = Debug|.NET 13 | {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Debug.Build.0 = Debug|.NET 14 | {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Release.ActiveCfg = Release|.NET 15 | {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Release.Build.0 = Release|.NET 16 | EndGlobalSection 17 | GlobalSection(ExtensibilityGlobals) = postSolution 18 | EndGlobalSection 19 | GlobalSection(ExtensibilityAddIns) = postSolution 20 | EndGlobalSection 21 | EndGlobal 22 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/dotzlib/DotZLib/ChecksumImpl.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/zlib-1.2.7/contrib/dotzlib/DotZLib/ChecksumImpl.cs -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/dotzlib/DotZLib/CircularBuffer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/zlib-1.2.7/contrib/dotzlib/DotZLib/CircularBuffer.cs -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/dotzlib/DotZLib/CodecBase.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/zlib-1.2.7/contrib/dotzlib/DotZLib/CodecBase.cs -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/dotzlib/DotZLib/Deflater.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/zlib-1.2.7/contrib/dotzlib/DotZLib/Deflater.cs -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/dotzlib/DotZLib/DotZLib.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/zlib-1.2.7/contrib/dotzlib/DotZLib/DotZLib.cs -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/dotzlib/DotZLib/GZipStream.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/zlib-1.2.7/contrib/dotzlib/DotZLib/GZipStream.cs -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/dotzlib/DotZLib/Inflater.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/zlib-1.2.7/contrib/dotzlib/DotZLib/Inflater.cs -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/dotzlib/DotZLib/UnitTests.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/zlib-1.2.7/contrib/dotzlib/DotZLib/UnitTests.cs -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/dotzlib/LICENSE_1_0.txt: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/infback9/README: -------------------------------------------------------------------------------- 1 | See infback9.h for what this is and how to use it. 2 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/iostream/test.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "zfstream.h" 3 | 4 | int main() { 5 | 6 | // Construct a stream object with this filebuffer. Anything sent 7 | // to this stream will go to standard out. 8 | gzofstream os( 1, ios::out ); 9 | 10 | // This text is getting compressed and sent to stdout. 11 | // To prove this, run 'test | zcat'. 12 | os << "Hello, Mommy" << endl; 13 | 14 | os << setcompressionlevel( Z_NO_COMPRESSION ); 15 | os << "hello, hello, hi, ho!" << endl; 16 | 17 | setcompressionlevel( os, Z_DEFAULT_COMPRESSION ) 18 | << "I'm compressing again" << endl; 19 | 20 | os.close(); 21 | 22 | return 0; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/iostream2/zstream_test.cpp: -------------------------------------------------------------------------------- 1 | #include "zstream.h" 2 | #include 3 | #include 4 | #include 5 | 6 | void main() { 7 | char h[256] = "Hello"; 8 | char* g = "Goodbye"; 9 | ozstream out("temp.gz"); 10 | out < "This works well" < h < g; 11 | out.close(); 12 | 13 | izstream in("temp.gz"); // read it back 14 | char *x = read_string(in), *y = new char[256], z[256]; 15 | in > y > z; 16 | in.close(); 17 | cout << x << endl << y << endl << z << endl; 18 | 19 | out.open("temp.gz"); // try ascii output; zcat temp.gz to see the results 20 | out << setw(50) << setfill('#') << setprecision(20) << x << endl << y << endl << z << endl; 21 | out << z << endl << y << endl << x << endl; 22 | out << 1.1234567890123456789 << endl; 23 | 24 | delete[] x; delete[] y; 25 | } 26 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/iostream3/TODO: -------------------------------------------------------------------------------- 1 | Possible upgrades to gzfilebuf: 2 | 3 | - The ability to do putback (e.g. putbackfail) 4 | 5 | - The ability to seek (zlib supports this, but could be slow/tricky) 6 | 7 | - Simultaneous read/write access (does it make sense?) 8 | 9 | - Support for ios_base::ate open mode 10 | 11 | - Locale support? 12 | 13 | - Check public interface to see which calls give problems 14 | (due to dependence on library internals) 15 | 16 | - Override operator<<(ostream&, gzfilebuf*) to allow direct copying 17 | of stream buffer to stream ( i.e. os << is.rdbuf(); ) 18 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/masmx64/bld_ml64.bat: -------------------------------------------------------------------------------- 1 | ml64.exe /Flinffasx64 /c /Zi inffasx64.asm 2 | ml64.exe /Flgvmat64 /c /Zi gvmat64.asm 3 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/masmx64/readme.txt: -------------------------------------------------------------------------------- 1 | Summary 2 | ------- 3 | This directory contains ASM implementations of the functions 4 | longest_match() and inflate_fast(), for 64 bits x86 (both AMD64 and Intel EM64t), 5 | for use with Microsoft Macro Assembler (x64) for AMD64 and Microsoft C++ 64 bits. 6 | 7 | gvmat64.asm is written by Gilles Vollant (2005), by using Brian Raiter 686/32 bits 8 | assembly optimized version from Jean-loup Gailly original longest_match function 9 | 10 | inffasx64.asm and inffas8664.c were written by Chris Anderson, by optimizing 11 | original function from Mark Adler 12 | 13 | Use instructions 14 | ---------------- 15 | Assemble the .asm files using MASM and put the object files into the zlib source 16 | directory. You can also get object files here: 17 | 18 | http://www.winimage.com/zLibDll/zlib124_masm_obj.zip 19 | 20 | define ASMV and ASMINF in your project. Include inffas8664.c in your source tree, 21 | and inffasx64.obj and gvmat64.obj as object to link. 22 | 23 | 24 | Build instructions 25 | ------------------ 26 | run bld_64.bat with Microsoft Macro Assembler (x64) for AMD64 (ml64.exe) 27 | 28 | ml64.exe is given with Visual Studio 2005, Windows 2003 server DDK 29 | 30 | You can get Windows 2003 server DDK with ml64 and cl for AMD64 from 31 | http://www.microsoft.com/whdc/devtools/ddk/default.mspx for low price) 32 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/masmx86/bld_ml32.bat: -------------------------------------------------------------------------------- 1 | ml /coff /Zi /c /Flmatch686.lst match686.asm 2 | ml /coff /Zi /c /Flinffas32.lst inffas32.asm 3 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/masmx86/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | Summary 3 | ------- 4 | This directory contains ASM implementations of the functions 5 | longest_match() and inflate_fast(). 6 | 7 | 8 | Use instructions 9 | ---------------- 10 | Assemble using MASM, and copy the object files into the zlib source 11 | directory, then run the appropriate makefile, as suggested below. You can 12 | donwload MASM from here: 13 | 14 | http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=7a1c9da0-0510-44a2-b042-7ef370530c64 15 | 16 | You can also get objects files here: 17 | 18 | http://www.winimage.com/zLibDll/zlib124_masm_obj.zip 19 | 20 | Build instructions 21 | ------------------ 22 | * With Microsoft C and MASM: 23 | nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" OBJA="match686.obj inffas32.obj" 24 | 25 | * With Borland C and TASM: 26 | make -f win32/Makefile.bor LOCAL_ZLIB="-DASMV -DASMINF" OBJA="match686.obj inffas32.obj" OBJPA="+match686c.obj+match686.obj+inffas32.obj" 27 | 28 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/minizip/Makefile: -------------------------------------------------------------------------------- 1 | CC=cc 2 | CFLAGS=-O -I../.. 3 | 4 | UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a 5 | ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a 6 | 7 | .c.o: 8 | $(CC) -c $(CFLAGS) $*.c 9 | 10 | all: miniunz minizip 11 | 12 | miniunz: $(UNZ_OBJS) 13 | $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS) 14 | 15 | minizip: $(ZIP_OBJS) 16 | $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) 17 | 18 | test: miniunz minizip 19 | ./minizip test readme.txt 20 | ./miniunz -l test.zip 21 | mv readme.txt readme.old 22 | ./miniunz test.zip 23 | 24 | clean: 25 | /bin/rm -f *.o *~ minizip miniunz 26 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/minizip/Makefile.am: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES = libminizip.la 2 | 3 | if COND_DEMOS 4 | bin_PROGRAMS = miniunzip minizip 5 | endif 6 | 7 | zlib_top_srcdir = $(top_srcdir)/../.. 8 | zlib_top_builddir = $(top_builddir)/../.. 9 | 10 | AM_CPPFLAGS = -I$(zlib_top_srcdir) 11 | AM_LDFLAGS = -L$(zlib_top_builddir) 12 | 13 | if WIN32 14 | iowin32_src = iowin32.c 15 | iowin32_h = iowin32.h 16 | endif 17 | 18 | libminizip_la_SOURCES = \ 19 | ioapi.c \ 20 | mztools.c \ 21 | unzip.c \ 22 | zip.c \ 23 | ${iowin32_src} 24 | 25 | libminizip_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0 -lz 26 | 27 | minizip_includedir = $(includedir)/minizip 28 | minizip_include_HEADERS = \ 29 | crypt.h \ 30 | ioapi.h \ 31 | mztools.h \ 32 | unzip.h \ 33 | zip.h \ 34 | ${iowin32_h} 35 | 36 | pkgconfigdir = $(libdir)/pkgconfig 37 | pkgconfig_DATA = minizip.pc 38 | 39 | EXTRA_PROGRAMS = miniunzip minizip 40 | 41 | miniunzip_SOURCES = miniunz.c 42 | miniunzip_LDADD = libminizip.la 43 | 44 | minizip_SOURCES = minizip.c 45 | minizip_LDADD = libminizip.la -lz 46 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/minizip/MiniZip64_Changes.txt: -------------------------------------------------------------------------------- 1 | 2 | MiniZip 1.1 was derrived from MiniZip at version 1.01f 3 | 4 | Change in 1.0 (Okt 2009) 5 | - **TODO - Add history** 6 | 7 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/minizip/configure.ac: -------------------------------------------------------------------------------- 1 | # -*- Autoconf -*- 2 | # Process this file with autoconf to produce a configure script. 3 | 4 | AC_INIT([minizip], [1.2.7], [bugzilla.redhat.com]) 5 | AC_CONFIG_SRCDIR([minizip.c]) 6 | AM_INIT_AUTOMAKE([foreign]) 7 | LT_INIT 8 | 9 | AC_MSG_CHECKING([whether to build example programs]) 10 | AC_ARG_ENABLE([demos], AC_HELP_STRING([--enable-demos], [build example programs])) 11 | AM_CONDITIONAL([COND_DEMOS], [test "$enable_demos" = yes]) 12 | if test "$enable_demos" = yes 13 | then 14 | AC_MSG_RESULT([yes]) 15 | else 16 | AC_MSG_RESULT([no]) 17 | fi 18 | 19 | case "${host}" in 20 | *-mingw* | mingw*) 21 | WIN32="yes" 22 | ;; 23 | *) 24 | ;; 25 | esac 26 | AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"]) 27 | 28 | 29 | AC_SUBST([HAVE_UNISTD_H], [0]) 30 | AC_CHECK_HEADER([unistd.h], [HAVE_UNISTD_H=1], []) 31 | AC_CONFIG_FILES([Makefile minizip.pc]) 32 | AC_OUTPUT 33 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/minizip/iowin32.h: -------------------------------------------------------------------------------- 1 | /* iowin32.h -- IO base function header for compress/uncompress .zip 2 | Version 1.1, February 14h, 2010 3 | part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 4 | 5 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) 6 | 7 | Modifications for Zip64 support 8 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) 9 | 10 | For more info read MiniZip_info.txt 11 | 12 | */ 13 | 14 | #include 15 | 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); 22 | void fill_win32_filefunc64 OF((zlib_filefunc64_def* pzlib_filefunc_def)); 23 | void fill_win32_filefunc64A OF((zlib_filefunc64_def* pzlib_filefunc_def)); 24 | void fill_win32_filefunc64W OF((zlib_filefunc64_def* pzlib_filefunc_def)); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/minizip/make_vms.com: -------------------------------------------------------------------------------- 1 | $ if f$search("ioapi.h_orig") .eqs. "" then copy ioapi.h ioapi.h_orig 2 | $ open/write zdef vmsdefs.h 3 | $ copy sys$input: zdef 4 | $ deck 5 | #define unix 6 | #define fill_zlib_filefunc64_32_def_from_filefunc32 fillzffunc64from 7 | #define Write_Zip64EndOfCentralDirectoryLocator Write_Zip64EoDLocator 8 | #define Write_Zip64EndOfCentralDirectoryRecord Write_Zip64EoDRecord 9 | #define Write_EndOfCentralDirectoryRecord Write_EoDRecord 10 | $ eod 11 | $ close zdef 12 | $ copy vmsdefs.h,ioapi.h_orig ioapi.h 13 | $ cc/include=[--]/prefix=all ioapi.c 14 | $ cc/include=[--]/prefix=all miniunz.c 15 | $ cc/include=[--]/prefix=all unzip.c 16 | $ cc/include=[--]/prefix=all minizip.c 17 | $ cc/include=[--]/prefix=all zip.c 18 | $ link miniunz,unzip,ioapi,[--]libz.olb/lib 19 | $ link minizip,zip,ioapi,[--]libz.olb/lib 20 | $ mcr []minizip test minizip_info.txt 21 | $ mcr []miniunz -l test.zip 22 | $ rename minizip_info.txt; minizip_info.txt_old 23 | $ mcr []miniunz test.zip 24 | $ delete test.zip;* 25 | $exit 26 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/minizip/minizip.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@/minizip 5 | 6 | Name: minizip 7 | Description: Minizip zip file manipulation library 8 | Requires: 9 | Version: @PACKAGE_VERSION@ 10 | Libs: -L${libdir} -lminizip 11 | Libs.private: -lz 12 | Cflags: -I${includedir} 13 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/minizip/mztools.h: -------------------------------------------------------------------------------- 1 | /* 2 | Additional tools for Minizip 3 | Code: Xavier Roche '2004 4 | License: Same as ZLIB (www.gzip.org) 5 | */ 6 | 7 | #ifndef _zip_tools_H 8 | #define _zip_tools_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #ifndef _ZLIB_H 15 | #include "zlib.h" 16 | #endif 17 | 18 | #include "unzip.h" 19 | 20 | /* Repair a ZIP file (missing central directory) 21 | file: file to recover 22 | fileOut: output file after recovery 23 | fileOutTmp: temporary file name used for recovery 24 | */ 25 | extern int ZEXPORT unzRepair(const char* file, 26 | const char* fileOut, 27 | const char* fileOutTmp, 28 | uLong* nRecovered, 29 | uLong* bytesRecovered); 30 | 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/puff/puff.h: -------------------------------------------------------------------------------- 1 | /* puff.h 2 | Copyright (C) 2002-2010 Mark Adler, all rights reserved 3 | version 2.2, 25 Apr 2010 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the author be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | 21 | Mark Adler madler@alumni.caltech.edu 22 | */ 23 | 24 | 25 | /* 26 | * See puff.c for purpose and usage. 27 | */ 28 | #ifndef NIL 29 | # define NIL ((unsigned char *)0) /* for no output option */ 30 | #endif 31 | 32 | int puff(unsigned char *dest, /* pointer to destination pointer */ 33 | unsigned long *destlen, /* amount of output space */ 34 | const unsigned char *source, /* pointer to source data pointer */ 35 | unsigned long *sourcelen); /* amount of input available */ 36 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/puff/zeros.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/zlib-1.2.7/contrib/puff/zeros.raw -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/testzlib/testzlib.txt: -------------------------------------------------------------------------------- 1 | To build testzLib with Visual Studio 2005: 2 | 3 | copy to a directory file from : 4 | - root of zLib tree 5 | - contrib/testzlib 6 | - contrib/masmx86 7 | - contrib/masmx64 8 | - contrib/vstudio/vc7 9 | 10 | and open testzlib8.sln -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/untgz/Makefile: -------------------------------------------------------------------------------- 1 | CC=cc 2 | CFLAGS=-g 3 | 4 | untgz: untgz.o ../../libz.a 5 | $(CC) $(CFLAGS) -o untgz untgz.o -L../.. -lz 6 | 7 | untgz.o: untgz.c ../../zlib.h 8 | $(CC) $(CFLAGS) -c -I../.. untgz.c 9 | 10 | ../../libz.a: 11 | cd ../..; ./configure; make 12 | 13 | clean: 14 | rm -f untgz untgz.o *~ 15 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/untgz/Makefile.msc: -------------------------------------------------------------------------------- 1 | CC=cl 2 | CFLAGS=-MD 3 | 4 | untgz.exe: untgz.obj ..\..\zlib.lib 5 | $(CC) $(CFLAGS) untgz.obj ..\..\zlib.lib 6 | 7 | untgz.obj: untgz.c ..\..\zlib.h 8 | $(CC) $(CFLAGS) -c -I..\.. untgz.c 9 | 10 | ..\..\zlib.lib: 11 | cd ..\.. 12 | $(MAKE) -f win32\makefile.msc 13 | cd contrib\untgz 14 | 15 | clean: 16 | -del untgz.obj 17 | -del untgz.exe 18 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/vstudio/vc10/miniunz.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {048af943-022b-4db6-beeb-a54c34774ee2} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm 7 | 8 | 9 | {c1d600d2-888f-4aea-b73e-8b0dd9befa0c} 10 | h;hpp;hxx;hm;inl;inc 11 | 12 | 13 | {0844199a-966b-4f19-81db-1e0125e141b9} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/vstudio/vc10/miniunz.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/vstudio/vc10/minizip.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {c0419b40-bf50-40da-b153-ff74215b79de} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm 7 | 8 | 9 | {bb87b070-735b-478e-92ce-7383abb2f36c} 10 | h;hpp;hxx;hm;inl;inc 11 | 12 | 13 | {f46ab6a6-548f-43cb-ae96-681abb5bd5db} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/vstudio/vc10/minizip.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/vstudio/vc10/testzlib.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/vstudio/vc10/testzlibdll.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {fa61a89f-93fc-4c89-b29e-36224b7592f4} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm 7 | 8 | 9 | {d4b85da0-2ba2-4934-b57f-e2584e3848ee} 10 | h;hpp;hxx;hm;inl;inc 11 | 12 | 13 | {e573e075-00bd-4a7d-bd67-a8cc9bfc5aca} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/vstudio/vc10/testzlibdll.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/vstudio/vc10/zlib.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define IDR_VERSION1 1 4 | IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE 5 | FILEVERSION 1.2.7,0 6 | PRODUCTVERSION 1.2.7,0 7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 8 | FILEFLAGS 0 9 | FILEOS VOS_DOS_WINDOWS32 10 | FILETYPE VFT_DLL 11 | FILESUBTYPE 0 // not used 12 | BEGIN 13 | BLOCK "StringFileInfo" 14 | BEGIN 15 | BLOCK "040904E4" 16 | //language ID = U.S. English, char set = Windows, Multilingual 17 | 18 | BEGIN 19 | VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" 20 | VALUE "FileVersion", "1.2.7\0" 21 | VALUE "InternalName", "zlib\0" 22 | VALUE "OriginalFilename", "zlib.dll\0" 23 | VALUE "ProductName", "ZLib.DLL\0" 24 | VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" 25 | VALUE "LegalCopyright", "(C) 1995-2012 Jean-loup Gailly & Mark Adler\0" 26 | END 27 | END 28 | BLOCK "VarFileInfo" 29 | BEGIN 30 | VALUE "Translation", 0x0409, 1252 31 | END 32 | END 33 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/vstudio/vc10/zlibstat.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/vstudio/vc10/zlibvc.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /zlib-1.2.7/contrib/vstudio/vc9/zlib.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define IDR_VERSION1 1 4 | IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE 5 | FILEVERSION 1.2.7,0 6 | PRODUCTVERSION 1.2.7,0 7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 8 | FILEFLAGS 0 9 | FILEOS VOS_DOS_WINDOWS32 10 | FILETYPE VFT_DLL 11 | FILESUBTYPE 0 // not used 12 | BEGIN 13 | BLOCK "StringFileInfo" 14 | BEGIN 15 | BLOCK "040904E4" 16 | //language ID = U.S. English, char set = Windows, Multilingual 17 | 18 | BEGIN 19 | VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" 20 | VALUE "FileVersion", "1.2.7\0" 21 | VALUE "InternalName", "zlib\0" 22 | VALUE "OriginalFilename", "zlib.dll\0" 23 | VALUE "ProductName", "ZLib.DLL\0" 24 | VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" 25 | VALUE "LegalCopyright", "(C) 1995-2012 Jean-loup Gailly & Mark Adler\0" 26 | END 27 | END 28 | BLOCK "VarFileInfo" 29 | BEGIN 30 | VALUE "Translation", 0x0409, 1252 31 | END 32 | END 33 | -------------------------------------------------------------------------------- /zlib-1.2.7/gzclose.c: -------------------------------------------------------------------------------- 1 | /* gzclose.c -- zlib gzclose() function 2 | * Copyright (C) 2004, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | #include "gzguts.h" 7 | 8 | /* gzclose() is in a separate file so that it is linked in only if it is used. 9 | That way the other gzclose functions can be used instead to avoid linking in 10 | unneeded compression or decompression routines. */ 11 | int ZEXPORT gzclose(file) 12 | gzFile file; 13 | { 14 | #ifndef NO_GZCOMPRESS 15 | gz_statep state; 16 | 17 | if (file == NULL) 18 | return Z_STREAM_ERROR; 19 | state = (gz_statep)file; 20 | 21 | return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); 22 | #else 23 | return gzclose_r(file); 24 | #endif 25 | } 26 | -------------------------------------------------------------------------------- /zlib-1.2.7/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /zlib-1.2.7/nintendods/README: -------------------------------------------------------------------------------- 1 | This Makefile requires devkitARM (http://www.devkitpro.org/category/devkitarm/) and works inside "contrib/nds". It is based on a devkitARM template. 2 | 3 | Eduardo Costa 4 | January 3, 2009 5 | 6 | -------------------------------------------------------------------------------- /zlib-1.2.7/old/README: -------------------------------------------------------------------------------- 1 | This directory contains files that have not been updated for zlib 1.2.x 2 | 3 | (Volunteers are encouraged to help clean this up. Thanks.) 4 | -------------------------------------------------------------------------------- /zlib-1.2.7/old/os2/zlib.def: -------------------------------------------------------------------------------- 1 | ; 2 | ; Slightly modified version of ../nt/zlib.dnt :-) 3 | ; 4 | 5 | LIBRARY Z 6 | DESCRIPTION "Zlib compression library for OS/2" 7 | CODE PRELOAD MOVEABLE DISCARDABLE 8 | DATA PRELOAD MOVEABLE MULTIPLE 9 | 10 | EXPORTS 11 | adler32 12 | compress 13 | crc32 14 | deflate 15 | deflateCopy 16 | deflateEnd 17 | deflateInit2_ 18 | deflateInit_ 19 | deflateParams 20 | deflateReset 21 | deflateSetDictionary 22 | gzclose 23 | gzdopen 24 | gzerror 25 | gzflush 26 | gzopen 27 | gzread 28 | gzwrite 29 | inflate 30 | inflateEnd 31 | inflateInit2_ 32 | inflateInit_ 33 | inflateReset 34 | inflateSetDictionary 35 | inflateSync 36 | uncompress 37 | zlibVersion 38 | gzprintf 39 | gzputc 40 | gzgetc 41 | gzseek 42 | gzrewind 43 | gztell 44 | gzeof 45 | gzsetparams 46 | zError 47 | inflateSyncPoint 48 | get_crc_table 49 | compress2 50 | gzputs 51 | gzgets 52 | -------------------------------------------------------------------------------- /zlib-1.2.7/watcom/watcom_l.mak: -------------------------------------------------------------------------------- 1 | # Makefile for zlib 2 | # OpenWatcom large model 3 | # Last updated: 28-Dec-2005 4 | 5 | # To use, do "wmake -f watcom_l.mak" 6 | 7 | C_SOURCE = adler32.c compress.c crc32.c deflate.c & 8 | gzclose.c gzlib.c gzread.c gzwrite.c & 9 | infback.c inffast.c inflate.c inftrees.c & 10 | trees.c uncompr.c zutil.c 11 | 12 | OBJS = adler32.obj compress.obj crc32.obj deflate.obj & 13 | gzclose.obj gzlib.obj gzread.obj gzwrite.obj & 14 | infback.obj inffast.obj inflate.obj inftrees.obj & 15 | trees.obj uncompr.obj zutil.obj 16 | 17 | CC = wcc 18 | LINKER = wcl 19 | CFLAGS = -zq -ml -s -bt=dos -oilrtfm -fr=nul -wx 20 | ZLIB_LIB = zlib_l.lib 21 | 22 | .C.OBJ: 23 | $(CC) $(CFLAGS) $[@ 24 | 25 | all: $(ZLIB_LIB) example.exe minigzip.exe 26 | 27 | $(ZLIB_LIB): $(OBJS) 28 | wlib -b -c $(ZLIB_LIB) -+adler32.obj -+compress.obj -+crc32.obj 29 | wlib -b -c $(ZLIB_LIB) -+gzclose.obj -+gzlib.obj -+gzread.obj -+gzwrite.obj 30 | wlib -b -c $(ZLIB_LIB) -+deflate.obj -+infback.obj 31 | wlib -b -c $(ZLIB_LIB) -+inffast.obj -+inflate.obj -+inftrees.obj 32 | wlib -b -c $(ZLIB_LIB) -+trees.obj -+uncompr.obj -+zutil.obj 33 | 34 | example.exe: $(ZLIB_LIB) example.obj 35 | $(LINKER) -fe=example.exe example.obj $(ZLIB_LIB) 36 | 37 | minigzip.exe: $(ZLIB_LIB) minigzip.obj 38 | $(LINKER) -fe=minigzip.exe minigzip.obj $(ZLIB_LIB) 39 | 40 | clean: .SYMBOLIC 41 | del *.obj 42 | del $(ZLIB_LIB) 43 | @echo Cleaning done 44 | -------------------------------------------------------------------------------- /zlib-1.2.7/win32/VisualC.txt: -------------------------------------------------------------------------------- 1 | 2 | To build zlib using the Microsoft Visual C++ environment, 3 | use the appropriate project from the projects/ directory. 4 | -------------------------------------------------------------------------------- /zlib-1.2.7/win32/zlib1.rc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "../zlib.h" 3 | 4 | #ifdef GCC_WINDRES 5 | VS_VERSION_INFO VERSIONINFO 6 | #else 7 | VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE 8 | #endif 9 | FILEVERSION ZLIB_VER_MAJOR,ZLIB_VER_MINOR,ZLIB_VER_REVISION,0 10 | PRODUCTVERSION ZLIB_VER_MAJOR,ZLIB_VER_MINOR,ZLIB_VER_REVISION,0 11 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 12 | #ifdef _DEBUG 13 | FILEFLAGS 1 14 | #else 15 | FILEFLAGS 0 16 | #endif 17 | FILEOS VOS__WINDOWS32 18 | FILETYPE VFT_DLL 19 | FILESUBTYPE 0 // not used 20 | BEGIN 21 | BLOCK "StringFileInfo" 22 | BEGIN 23 | BLOCK "040904E4" 24 | //language ID = U.S. English, char set = Windows, Multilingual 25 | BEGIN 26 | VALUE "FileDescription", "zlib data compression library\0" 27 | VALUE "FileVersion", ZLIB_VERSION "\0" 28 | VALUE "InternalName", "zlib1.dll\0" 29 | VALUE "LegalCopyright", "(C) 1995-2006 Jean-loup Gailly & Mark Adler\0" 30 | VALUE "OriginalFilename", "zlib1.dll\0" 31 | VALUE "ProductName", "zlib\0" 32 | VALUE "ProductVersion", ZLIB_VERSION "\0" 33 | VALUE "Comments", "For more information visit http://www.zlib.net/\0" 34 | END 35 | END 36 | BLOCK "VarFileInfo" 37 | BEGIN 38 | VALUE "Translation", 0x0409, 1252 39 | END 40 | END 41 | -------------------------------------------------------------------------------- /zlib-1.2.7/zlib.3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iqtree/iqtree3/4c823e9757857e098e99c4aba611748d5c4cc8db/zlib-1.2.7/zlib.3.pdf -------------------------------------------------------------------------------- /zlib-1.2.7/zlib.map: -------------------------------------------------------------------------------- 1 | ZLIB_1.2.0 { 2 | global: 3 | compressBound; 4 | deflateBound; 5 | inflateBack; 6 | inflateBackEnd; 7 | inflateBackInit_; 8 | inflateCopy; 9 | local: 10 | deflate_copyright; 11 | inflate_copyright; 12 | inflate_fast; 13 | inflate_table; 14 | zcalloc; 15 | zcfree; 16 | z_errmsg; 17 | gz_error; 18 | gz_intmax; 19 | _*; 20 | }; 21 | 22 | ZLIB_1.2.0.2 { 23 | gzclearerr; 24 | gzungetc; 25 | zlibCompileFlags; 26 | } ZLIB_1.2.0; 27 | 28 | ZLIB_1.2.0.8 { 29 | deflatePrime; 30 | } ZLIB_1.2.0.2; 31 | 32 | ZLIB_1.2.2 { 33 | adler32_combine; 34 | crc32_combine; 35 | deflateSetHeader; 36 | inflateGetHeader; 37 | } ZLIB_1.2.0.8; 38 | 39 | ZLIB_1.2.2.3 { 40 | deflateTune; 41 | gzdirect; 42 | } ZLIB_1.2.2; 43 | 44 | ZLIB_1.2.2.4 { 45 | inflatePrime; 46 | } ZLIB_1.2.2.3; 47 | 48 | ZLIB_1.2.3.3 { 49 | adler32_combine64; 50 | crc32_combine64; 51 | gzopen64; 52 | gzseek64; 53 | gztell64; 54 | inflateUndermine; 55 | } ZLIB_1.2.2.4; 56 | 57 | ZLIB_1.2.3.4 { 58 | inflateReset2; 59 | inflateMark; 60 | } ZLIB_1.2.3.3; 61 | 62 | ZLIB_1.2.3.5 { 63 | gzbuffer; 64 | gzoffset; 65 | gzoffset64; 66 | gzclose_r; 67 | gzclose_w; 68 | } ZLIB_1.2.3.4; 69 | 70 | ZLIB_1.2.5.1 { 71 | deflatePending; 72 | } ZLIB_1.2.3.5; 73 | 74 | ZLIB_1.2.5.2 { 75 | deflateResetKeep; 76 | gzgetc_; 77 | inflateResetKeep; 78 | } ZLIB_1.2.5.1; 79 | -------------------------------------------------------------------------------- /zlib-1.2.7/zlib.pc.cmakein: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=@CMAKE_INSTALL_PREFIX@ 3 | libdir=@INSTALL_LIB_DIR@ 4 | sharedlibdir=@INSTALL_LIB_DIR@ 5 | includedir=@INSTALL_INC_DIR@ 6 | 7 | Name: zlib 8 | Description: zlib compression library 9 | Version: @VERSION@ 10 | 11 | Requires: 12 | Libs: -L${libdir} -L${sharedlibdir} -lz 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /zlib-1.2.7/zlib.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | sharedlibdir=@sharedlibdir@ 5 | includedir=@includedir@ 6 | 7 | Name: zlib 8 | Description: zlib compression library 9 | Version: @VERSION@ 10 | 11 | Requires: 12 | Libs: -L${libdir} -L${sharedlibdir} -lz 13 | Cflags: -I${includedir} 14 | --------------------------------------------------------------------------------