Scalable Algorithms For Inference And Simulation Under Complex Phylogenetic Models