first cut at linear algebra
use indexedseq for O(1) random access and lists otherwise