ssm function

Self-similarity matrix