Added matrix-valued inputs.