コード例 #1
0
/*--------------------------------------------------------------------------*/
int sci_taucs_chdel(char* fname, unsigned long l)
{

    int mC_ptr = 0, nC_ptr = 0, lC_ptr = 0, it_flag = 0;
    taucs_handle_factors * pC = NULL;
    CellAdr * Cell = NULL;
    int NbRhsVar;

    Rhs = Max(Rhs, 0);

    /* Check numbers of input/output arguments */
    CheckRhs(0, 1);
    CheckLhs(1, 1);

    NbRhsVar = Rhs;

    if (NbRhsVar == 0)      /* destroy all */
    {
        while ( ListCholFactors )
        {
            Cell = ListCholFactors;
            ListCholFactors = ListCholFactors->next;
            pC = (taucs_handle_factors *) Cell->adr;
            taucs_supernodal_factor_free(pC->C);  /* free the super nodal struct */
            FREE(pC->p);                          /* free the permutation vector */
            FREE(pC);                             /* free the handle             */
            FREE(Cell);                           
        }
    }
    else
    {
        /* get the pointer to the Cholesky factors */
        GetRhsVar(1, SCILAB_POINTER_DATATYPE, &mC_ptr, &nC_ptr, &lC_ptr);
        pC = (taucs_handle_factors *) ((unsigned long int) *stk(lC_ptr));

        /* Check if the pointer is a valid ref to ... */
        if (RetrieveAdrFromList(pC, &ListCholFactors, &it_flag)) 
            /* free the memory of the objects */
        {
            taucs_supernodal_factor_free(pC->C);
            FREE(pC->p);
            FREE(pC);
        }
        else
        {
            Scierror(999,_("%s: Wrong value for input argument #%d: not a valid reference to Cholesky factors.\n"), fname, 1);
            return 0;
        }
    }

    PutLhsVar();
    return 0;
}
コード例 #2
0
ファイル: ClpCholeskyTaucs.cpp プロジェクト: marvin2k/ogdf
//----------------------------------------------------------------
// Assignment operator
//-------------------------------------------------------------------
ClpCholeskyTaucs &
ClpCholeskyTaucs::operator=(const ClpCholeskyTaucs& rhs)
{
     if (this != &rhs) {
          ClpCholeskyBase::operator=(rhs);
          taucs_ccs_free(matrix_);
          if (factorization_)
               taucs_supernodal_factor_free(factorization_);
          factorization_ = NULL;
          sizeFactorT_ = rhs.sizeFactorT_;
          matrix_ = rhs.matrix_;
          if (matrix_) {
               choleskyStartT_ = (int *) malloc((numberRows_ + 1) * sizeof(int));
               CoinMemcpyN(rhs.choleskyStartT_, (numberRows_ + 1), choleskyStartT_);
               choleskyRowT_ = (int *) malloc(sizeFactorT_ * sizeof(int));
               CoinMemcpyN(rhs.choleskyRowT_, sizeFactorT_, choleskyRowT_);
               sparseFactorT_ = (double *) malloc(sizeFactorT_ * sizeof(double));
               CoinMemcpyN(rhs.sparseFactorT_, sizeFactorT_, sparseFactorT_);
               matrix_->colptr = choleskyStartT_;
               matrix_->rowind = choleskyRowT_;
               matrix_->values.d = sparseFactorT_;
          } else {
               sparseFactorT_ = NULL;
               choleskyStartT_ = NULL;
               choleskyRowT_ = NULL;
          }
          delete rowCopyT_;
          rowCopyT_ = rhs.rowCopyT_->clone();
     }
     return *this;
}
コード例 #3
0
ファイル: ClpCholeskyTaucs.cpp プロジェクト: marvin2k/ogdf
//-------------------------------------------------------------------
// Destructor
//-------------------------------------------------------------------
ClpCholeskyTaucs::~ClpCholeskyTaucs ()
{
     taucs_ccs_free(matrix_);
     if (factorization_)
          taucs_supernodal_factor_free(factorization_);
     delete rowCopyT_;
}
コード例 #4
0
ファイル: my_solver.c プロジェクト: damody/dm-hw
DllExport void FreeSymbolicSolver(void *sp)
{
	struct SymbolicSolver_tag * s = (struct SymbolicSolver_tag *) sp;
	if (s == NULL) return;
	if (s->matrix) taucs_ccs_free(s->matrix);
	if (s->factorization) taucs_supernodal_factor_free(s->factorization);
	if (s->perm) free(s->perm);
	if (s->invperm) free(s->invperm);
	if (s->tmp_b) free (s->tmp_b);
	if (s->tmp_x) free (s->tmp_x);
	s->matrix = s->factorization = NULL;
	s->perm = s->invperm = NULL;
	s->tmp_b = s->tmp_x = NULL;
}
コード例 #5
0
	void Clear() {
		if (PAP)      { taucs_ccs_free(PAP);               PAP     = 0; }
		if (SL)       { taucs_supernodal_factor_free(SL);  SL      = 0; }
		if (perm)     { free(perm);                        perm    = 0; }
		if (invperm)  { free(invperm);                     invperm = 0; }
	}