Beispiel #1
0
        public static PermutationMatrix operator *(PermutationMatrix a, PermutationMatrix b)
        {
            PermutationMatrix ret = new PermutationMatrix(a.Rows, a.Columns);

            for (int i = 0; i < ret.Rows; i++)
            {
                for (int j = 0; j < ret.Columns; j++)
                {
                    for (int k = 0; k < ret.Columns; k++)
                    {
                        ret.InternalRep[i, j] += a.InternalRep[i, k] * b.InternalRep[k, j];
                    }
                }
            }

            StringBuilder sb = new StringBuilder();

            sb.Append(a.ToLatex());
            sb.Append(b.ToLatex());
            sb.Append(" = ");
            sb.Append(ret.ToLatex());

            ret.FullRep = sb.ToString();


            return(ret);
        }
Beispiel #2
0
        public PermutationMatrix Inverse()
        {
            PermutationMatrix ret = this.Transpose();
            StringBuilder     sb  = new StringBuilder();

            sb.Append(this.ToLatex() + "^{-1}");
            sb.Append(" = ");
            sb.Append(ret.ToLatex());

            ret.FullRep = sb.ToString();

            return(ret);
        }