public override bool Equals(object obj) { mat m = obj as mat; if (m != null) return this.matrix == m.matrix; return matrix.Equals(obj); }