Efficient algorithms and implementations of entropy-based moment closures for rarefied gases