private Matrix FromVM(MatrixVM matrix)
        {
            uint   rows = (uint)matrix.Mask.GetLength(0);
            uint   cols = (uint)matrix.Mask.GetLength(0);
            Matrix m    = new Matrix(rows, cols);

            for (uint row = 0; row < rows; row++)
            {
                for (uint col = 0; col < cols; col++)
                {
                    m[row, col] = matrix.Mask[row, col].Value;
                }
            }
            return(m);
        }