Rank-1 Markov-chain learner and generator.