예제 #1
0
파일: Matrix.cpp 프로젝트: radixvinni/aal
//**********************************    Транспонирование матрицы   *******************************************
  //TEST(Matrix, Transpose)
  Matrix & Matrix::Transpose()
  {
    Matrix::CodingSystem oldCoding = getCoding();
    conversionMatrix();
    setCoding(oldCoding);
    return *this;
  }
예제 #2
0
파일: Matrix.cpp 프로젝트: radixvinni/aal
  Matrix& Matrix::gausRightTrianForEquation(Polynom & right)
  {
    if ((getCoding() == ON_LINE) && (getTrianType() == NONE))
    {
      uint maxDigits = 0, row = getRowCount();
      for (uint i = 0; i < row; i++)
        if (maxDigits < plMatrix[i]->getNumberDigits())
          maxDigits = plMatrix[i]->getNumberDigits();

      uint activeRow = 0;
      int activeCol = maxDigits - 1;
      while ((activeRow < row)&&(activeCol >= 0))
      {
        uint max = 0, j = activeRow, digit;
        for (uint i = activeRow; i < row; i++)
        {
          digit = plMatrix[i]->getDigit(activeCol);
          if (max < digit)
          {
            max = digit;
            j = i;
          }
        }
        if (max)
        {
          uint r = degree(max);
          uint ar = 1<<r;
          if (plMatrix[activeRow]->getDigit((uint)activeCol) < ar)
          {
            plMatrix[activeRow]->Xor(*plMatrix[j], *plMatrix[activeRow]);
            right.setBit(activeRow, right.getBit(j)^right.getBit(activeRow));
          }
          for (uint i = activeRow + 1; i < row; i++)
          {
            if (plMatrix[i]->getDigit((uint)activeCol) >= ar)
            {
              plMatrix[i]->Xor(*plMatrix[i], *plMatrix[activeRow]);
              right.setBit(i, right.getBit(i)^right.getBit(activeRow));
            }
          }
          activeRow++;
        }
        else
          activeCol--;
      }
      setTrianType(RIGHT);
    }
    else
        throw new Exception("Матрица должна быть упакована по строкам и не приведена к треугольному виду");
    return *this;
  }
예제 #3
0
inline void GenabelSnp::genotypeToAlleles(UBYTE genotype, string& alleles) const {
	genotype_to_allele(genotype, getCoding(), alleles);
}