embedding and sampling matrix storage needs to have type specified, otherwise very slow