Boost LA

scalar_traits

#include <boost/la/scalar_traits.hpp>

namespace
boost
    {
    namespace
    la
        {
        template <class Scalar>
        struct
        scalar_traits
            {
            static Scalar zero() { return Scalar(0); }
            static Scalar one() { return Scalar(1); }
            };
        }
    }

This template can be specialized for user-defined scalar types to define the appropriate values to use as zero and one.