Example #1
0
 public static bool igual(matriz esta, matriz outra)
 {
     if (esta.colunas == outra.colunas)
     {
         if (esta.linhas == outra.linhas)
         {
             for (int i = 0; i < esta.linhas; i++)
             {
                 for (int j = 0; j < esta.colunas; j++)
                 {
                     if (esta.elementos[i][j] != outra.elementos[i][j])
                     {
                         return(false);
                     }
                 }
             }
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
Example #2
0
        public matriz submatriz(int linha_removida, int coluna_removida)
        {
            matriz sub = new matriz(this.linhas - 1, this.colunas - 1);
            int    k = 0, i = 0, j = 0;

            sub.elementos = new List <List <complexo> >();
            while (i < this.linhas)
            {
                if (i != linha_removida)
                {
                    sub.elementos.Add(new List <complexo>());
                    j = 0;
                    while (j < this.colunas)
                    {
                        if (j != coluna_removida)
                        {
                            sub.elementos[k].Add(this.elementos[i][j]);
                        }
                        j++;
                    }
                    k++;
                }
                i++;
            }
            return(sub);
        }
Example #3
0
 public matriz multiplicar(matriz outra)
 {
     if (outra.linhas == this.colunas)
     {
         matriz esta = new matriz(this.linhas, outra.colunas);
         esta.elementos = new List <List <complexo> >();
         for (int i = 0; i < this.linhas; i++)
         {
             esta.elementos[i] = new List <complexo>();
             for (int j = 0; j < outra.colunas; j++)
             {
                 esta.elementos[i].Add(new complexo(0, 0));
                 for (int k = 0; k < this.colunas; k++)
                 {
                     esta.elementos[i][j] += this.elementos[i][k] * outra.elementos[k][j];
                 }
             }
         }
         return(esta);
     }
     else
     {
         return(new matriz('u', outra.colunas));
     }
 }
Example #4
0
        public matriz transposta()
        {
            matriz temp = new matriz(this.colunas, this.linhas);

            for (int i = 0; i < temp.linhas; i++)
            {
                for (int j = 0; j < temp.colunas; j++)
                {
                    temp.elementos[j].Add(this.elementos[i][j]);
                }
            }
            return(temp);
        }
Example #5
0
 public matriz copiar(matriz outra)
 {
     this.linhas  = outra.linhas;
     this.colunas = outra.colunas;
     for (int i = 0; i < linhas; i++)
     {
         for (int j = 0; j < colunas; j++)
         {
             elementos[i][j] = outra.elementos[i][j];
         }
     }
     return(outra);
 }
Example #6
0
        public matriz multiplicar(double escalar)
        {
            matriz esta = new matriz(this.linhas, this.colunas);

            esta.elementos = new List <List <complexo> >();
            for (int i = 0; i < this.linhas; i++)
            {
                esta.elementos[i] = new List <complexo>();
                for (int j = 0; j < this.colunas; j++)
                {
                    esta.elementos[i].Add(escalar * this.elementos[i][j]);
                }
            }
            return(esta);
        }