Use numpy tensordot for vector-to-matrix operations.