Efficient differential algebra computations

Numerical Differential Algebra (DA) is a powerful tool for studying non-linear motion in accelerators, beam and optics devices. Implementation of DA is the easiest in an object oriented programming language, especially C++. In addition to standard object oriented features, C++ allows for operator overloading and static polymorphism via templates. In this paper we discuss (1) use of templates for polymorphic use of the code, so it can treat both dynamical variables and DA maps, (2) methods of optimisation for speed needed for efficient use DA in accelerator physics and other applications.