BUG: use the actual matrix type in at<T> instead of the output value type which result in a reinterpretation