Implement apply()
Fix build
Minor improvements
Implement inverse()
Merge pull request #1 from wcandillon/ts

apply() implementation