Implementation of the Gibbs-Poole-Stockmeyer and Gibbs-King Algorithms (ACM transactions on mathematical software, 1982)