writing matvec_segscan