/* Uses factorization to solve. */
void
ClpCholeskyWssmpKKT::solveKKT (double * region1, double * region2, const double * diagonal,
                               double diagonalScaleFactor)
{
    int numberRowsModel = model_->numberRows();
    int numberColumns = model_->numberColumns();
    int numberTotal = numberColumns + numberRowsModel;
    double * array = new double [numberRows_];
    CoinMemcpyN(region1, numberTotal, array);
    CoinMemcpyN(region2, numberRowsModel, array + numberTotal);
    int i1 = 1;
    int i0 = 0;
    integerParameters_[1] = 4;
    integerParameters_[2] = 4;
#if 0
    integerParameters_[5] = 3;
    doubleParameters_[5] = 1.0e-10;
    integerParameters_[6] = 6;
#endif
    F77_FUNC(wssmp,WSSMP)(&numberRows_, choleskyStart_, choleskyRow_, sparseFactor_,
                          NULL, permute_, permuteInverse_, array, &numberRows_, &i1,
                          NULL, &i0, NULL, integerParameters_, doubleParameters_);
#if 0
    int iRow;
    for (iRow = 0; iRow < numberTotal; iRow++) {
        if (rowsDropped_[iRow] && fabs(array[iRow]) > 1.0e-8) {
            printf("row region1 %d dropped %g\n", iRow, array[iRow]);
        }
    }
    for (; iRow < numberRows_; iRow++) {
        if (rowsDropped_[iRow] && fabs(array[iRow]) > 1.0e-8) {
            printf("row region2 %d dropped %g\n", iRow, array[iRow]);
        }
    }
#endif
    CoinMemcpyN(array + numberTotal, numberRowsModel, region2);
#if 1
    CoinMemcpyN(array, numberTotal, region1);
#else
    multiplyAdd(region2, numberRowsModel, -1.0, array + numberColumns, 0.0);
    CoinZeroN(array, numberColumns);
    model_->clpMatrix()->transposeTimes(1.0, region2, array);
    for (int iColumn = 0; iColumn < numberTotal; iColumn++)
        region1[iColumn] = diagonal[iColumn] * (array[iColumn] - region1[iColumn]);
#endif
    delete [] array;
#if 0
    if (integerParameters_[5]) {
        std::cout << integerParameters_[5] << " refinements ";
    }
    std::cout << doubleParameters_[6] << std::endl;
#endif
}
示例#2
0
static void
MULADD_M2(State &state, const ControlFlowInst &cf, const AluInst &alu)
{
   multiplyAdd(state, cf, alu, " * 2");
}