Exemple #1
0
      public Matrix AddRow()
      {
         var m = new Matrix(rows + 1, cols);

         for (int i = 0; i < rows; i++)
         {
            for (int j = 0; j < cols; j++)
            {
               m[i, j] = values[i, j];
            }
         }

         return m;
      }
Exemple #2
0
      public Matrix RemoveRow(int index)
      {
         var m = new Matrix(rows - 1, cols);

         for (var i = 0; i < rows; i++)
         {
            for (var j = 0; j < cols; j++)
            {
               if (i < index)
               {
                  m[i, j] = values[i, j];
               }
               else if (i > index)
               {
                  m[i - 1, j] = values[i, j];
               }
            }   
         }

         return m;
      }
Exemple #3
0
      public Matrix InsertRow(int index)
      {
         var m = new Matrix(rows + 1, cols);

         for (int i = 0; i < rows; i++)
         {
            for (int j = 0; j < cols; j++)
            {
               if (i >= index)
               {
                  m[i + 1, j] = values[i, j];
               }
               else
               {
                  m[i, j] = values[i, j];
               }
            }
         }

         return m;
      }
Exemple #4
0
      public Matrix RemoveColumn(int index)
      {
         var m = new Matrix(rows, cols - 1);

         for (var i = 0; i < rows; i++)
         {
            for (var j = 0; j < cols; j++)
            {
               if (j < index)
               {
                  m[i, j] = values[i, j];
               }
               else if (j > index)
               {
                  m[i, j - 1] = values[i, j];
               }
            }
         }

         return m;
      }
Exemple #5
0
      public Matrix InsertColumn(int index)
      {
         var m = new Matrix(rows, cols + 1);

         for (int i = 0; i < rows; i++)
         {
            for (int j = 0; j < cols; j++)
            {
               if (j >= index)
               {
                  m[i, j + 1] = values[i, j];
               }
               else
               {
                  m[i, j] = values[i, j];
               }
            }
         }

         return m;
      }