It seems that the Matrix protocol offers optional end-to-end encryption on a room-by-room basis via Double Ratchet Algorithm that was introduced by the Signal Protocol [0]. This is the academic paper that Wikipedia cites for that claim [1].
[0] https://en.m.wikipedia.org/wiki/Signal_Protocol#Influence [1] https://link.springer.com/chapter/10.1007/978-3-319-45982-0_...