feature distance replaced
variables mat or array