fix #3: ensure dtype consistency in matvec