示例#1
0
    public Matriz Subtrair(Matriz m)
    {
        Matriz res = new Matriz(this.linhas, this.colunas);

        for (int a = 0; a < linhas; ++a)
        {
            for (int b = 0; b < colunas; ++b)
            {
                res.SetValue(a + 1, b + 1, matriz[a, b] - m.GetValue(a + 1, b + 1));
            }
        }

        return(res);
    }
示例#2
0
    public Matriz Somar(Matriz m)
    {
        Matriz res = new Matriz(this.linhas, this.colunas);

        for (int a = 0, l = linhas; a < l; ++a)
        {
            for (int b = 0, l2 = colunas; b < l2; ++b)
            {
                res.SetValue(a + 1, b + 1, matriz[a, b] + m.GetValue(a + 1, b + 1));
            }
        }

        return(res);
    }