Remove many type annotations and generalize acceptable types

This supports various element types (e.g., Float32). It also supports more general matrix-like objects (not necessarily even `AbstractArray`s, as long as they support operations like size, eltype, and multiplication.