This is very very well known. Cf https://en.wikipedia.org/wiki/Affine_group
I don't see how people should glorify this with the word "algorithm". It is a trivial undergrad homework exercise, once you give the hint "use parallel reduce / fold / prefixsum".
This may involve more interesting tradeoffs if you deal with large or sparse matrices or matrix-free operators.