Lines Matching refs:lu
62 Mat_SuperLU *lu = (Mat_SuperLU *)A->data; in MatView_Info_SuperLU() local
66 options = lu->options; in MatView_Info_SuperLU()
79 PetscCall(PetscViewerASCIIPrintf(viewer, " lwork: %" PetscInt_FMT "\n", lu->lwork)); in MatView_Info_SuperLU()
93 Mat_SuperLU *lu = (Mat_SuperLU *)A->data; in MatSolve_SuperLU_Private() local
101 if (lu->lwork == -1) PetscFunctionReturn(PETSC_SUCCESS); in MatSolve_SuperLU_Private()
107 lu->B.ncol = 1; /* Set the number of right-hand side */ in MatSolve_SuperLU_Private()
108 if (lu->options.Equil && !lu->rhs_dup) { in MatSolve_SuperLU_Private()
110 PetscCall(PetscMalloc1(n, &lu->rhs_dup)); in MatSolve_SuperLU_Private()
112 if (lu->options.Equil) { in MatSolve_SuperLU_Private()
115 PetscCall(PetscArraycpy(lu->rhs_dup, barray, n)); in MatSolve_SuperLU_Private()
117 barray = lu->rhs_dup; in MatSolve_SuperLU_Private()
125 ((DNformat *)lu->B.Store)->nzval = (singlecomplex *)barray; in MatSolve_SuperLU_Private()
126 ((DNformat *)lu->X.Store)->nzval = (singlecomplex *)xarray; in MatSolve_SuperLU_Private()
128 ((DNformat *)lu->B.Store)->nzval = (doublecomplex *)barray; in MatSolve_SuperLU_Private()
129 ((DNformat *)lu->X.Store)->nzval = (doublecomplex *)xarray; in MatSolve_SuperLU_Private()
132 ((DNformat *)lu->B.Store)->nzval = (void *)barray; in MatSolve_SuperLU_Private()
133 ((DNformat *)lu->X.Store)->nzval = xarray; in MatSolve_SuperLU_Private()
136 lu->options.Fact = FACTORED; /* Indicate the factored form of A is supplied. */ in MatSolve_SuperLU_Private()
140 …lu->options, &lu->A, lu->perm_c, lu->perm_r, lu->etree, lu->equed, lu->R, lu->C, &lu->L, &lu->U, l… in MatSolve_SuperLU_Private()
142 …lu->options, &lu->A, lu->perm_c, lu->perm_r, lu->etree, lu->equed, lu->R, lu->C, &lu->L, &lu->U, l… in MatSolve_SuperLU_Private()
146 …lu->options, &lu->A, lu->perm_c, lu->perm_r, lu->etree, lu->equed, lu->R, lu->C, &lu->L, &lu->U, l… in MatSolve_SuperLU_Private()
148 …lu->options, &lu->A, lu->perm_c, lu->perm_r, lu->etree, lu->equed, lu->R, lu->C, &lu->L, &lu->U, l… in MatSolve_SuperLU_Private()
154 …lu->options, &lu->A, lu->perm_c, lu->perm_r, lu->etree, lu->equed, lu->R, lu->C, &lu->L, &lu->U, l… in MatSolve_SuperLU_Private()
156 …lu->options, &lu->A, lu->perm_c, lu->perm_r, lu->etree, lu->equed, lu->R, lu->C, &lu->L, &lu->U, l… in MatSolve_SuperLU_Private()
160 …lu->options, &lu->A, lu->perm_c, lu->perm_r, lu->etree, lu->equed, lu->R, lu->C, &lu->L, &lu->U, l… in MatSolve_SuperLU_Private()
162 …lu->options, &lu->A, lu->perm_c, lu->perm_r, lu->etree, lu->equed, lu->R, lu->C, &lu->L, &lu->U, l… in MatSolve_SuperLU_Private()
166 if (!lu->options.Equil) PetscCall(VecRestoreArrayRead(b, &barray)); in MatSolve_SuperLU_Private()
169 if (!info || info == lu->A.ncol + 1) { in MatSolve_SuperLU_Private()
170 if (lu->options.IterRefine) { in MatSolve_SuperLU_Private()
173 …; ++i) PetscCall(PetscPrintf(PETSC_COMM_SELF, " %8d%8d%16e%16e\n", i + 1, lu->stat.RefineSteps, f… in MatSolve_SuperLU_Private()
176 if (lu->lwork == -1) { in MatSolve_SuperLU_Private()
177 …tscPrintf(PETSC_COMM_SELF, " ** Estimated memory: %" PetscInt_FMT " bytes\n", info - lu->A.ncol)); in MatSolve_SuperLU_Private()
183 if (lu->options.PrintStat) { in MatSolve_SuperLU_Private()
185 PetscStackCallExternalVoid("SuperLU:StatPrint", StatPrint(&lu->stat)); in MatSolve_SuperLU_Private()
192 Mat_SuperLU *lu = (Mat_SuperLU *)A->data; in MatSolve_SuperLU() local
202 oldOption = lu->options.Trans; in MatSolve_SuperLU()
203 lu->options.Trans = TRANS; in MatSolve_SuperLU()
205 lu->options.Trans = oldOption; in MatSolve_SuperLU()
211 Mat_SuperLU *lu = (Mat_SuperLU *)A->data; in MatSolveTranspose_SuperLU() local
221 oldOption = lu->options.Trans; in MatSolveTranspose_SuperLU()
222 lu->options.Trans = NOTRANS; in MatSolveTranspose_SuperLU()
224 lu->options.Trans = oldOption; in MatSolveTranspose_SuperLU()
230 Mat_SuperLU *lu = (Mat_SuperLU *)F->data; in MatLUFactorNumeric_SuperLU() local
238 if (lu->flg == SAME_NONZERO_PATTERN) { /* successive numerical factorization */ in MatLUFactorNumeric_SuperLU()
239 lu->options.Fact = SamePattern; in MatLUFactorNumeric_SuperLU()
241 Destroy_SuperMatrix_Store(&lu->A); in MatLUFactorNumeric_SuperLU()
242 if (lu->A_dup) PetscCall(MatCopy_SeqAIJ(A, lu->A_dup, SAME_NONZERO_PATTERN)); in MatLUFactorNumeric_SuperLU()
244 if (lu->lwork >= 0) { in MatLUFactorNumeric_SuperLU()
245 … PetscStackCallExternalVoid("SuperLU:Destroy_SuperNode_Matrix", Destroy_SuperNode_Matrix(&lu->L)); in MatLUFactorNumeric_SuperLU()
246 PetscStackCallExternalVoid("SuperLU:Destroy_CompCol_Matrix", Destroy_CompCol_Matrix(&lu->U)); in MatLUFactorNumeric_SuperLU()
247 lu->options.Fact = SamePattern; in MatLUFactorNumeric_SuperLU()
254 if (lu->A_dup) { in MatLUFactorNumeric_SuperLU()
255 aa = (Mat_SeqAIJ *)lu->A_dup->data; in MatLUFactorNumeric_SuperLU()
261 …PetscStackCallExternalVoid("SuperLU:cCreate_CompCol_Matrix", cCreate_CompCol_Matrix(&lu->A, A->cma… in MatLUFactorNumeric_SuperLU()
263 …PetscStackCallExternalVoid("SuperLU:zCreate_CompCol_Matrix", zCreate_CompCol_Matrix(&lu->A, A->cma… in MatLUFactorNumeric_SuperLU()
267 …PetscStackCallExternalVoid("SuperLU:sCreate_CompCol_Matrix", sCreate_CompCol_Matrix(&lu->A, A->cma… in MatLUFactorNumeric_SuperLU()
269 …PetscStackCallExternalVoid("SuperLU:dCreate_CompCol_Matrix", dCreate_CompCol_Matrix(&lu->A, A->cma… in MatLUFactorNumeric_SuperLU()
274 lu->B.ncol = 0; /* Indicate not to solve the system */ in MatLUFactorNumeric_SuperLU()
278 …lu->options, &lu->A, lu->perm_c, lu->perm_r, lu->etree, lu->equed, lu->R, lu->C, &lu->L, &lu->U, l… in MatLUFactorNumeric_SuperLU()
280 …lu->options, &lu->A, lu->perm_c, lu->perm_r, lu->etree, lu->equed, lu->R, lu->C, &lu->L, &lu->U, l… in MatLUFactorNumeric_SuperLU()
284 …lu->options, &lu->A, lu->perm_c, lu->perm_r, lu->etree, lu->equed, lu->R, lu->C, &lu->L, &lu->U, l… in MatLUFactorNumeric_SuperLU()
286 …lu->options, &lu->A, lu->perm_c, lu->perm_r, lu->etree, lu->equed, lu->R, lu->C, &lu->L, &lu->U, l… in MatLUFactorNumeric_SuperLU()
293 …lu->options, &lu->A, lu->perm_c, lu->perm_r, lu->etree, lu->equed, lu->R, lu->C, &lu->L, &lu->U, l… in MatLUFactorNumeric_SuperLU()
295 …lu->options, &lu->A, lu->perm_c, lu->perm_r, lu->etree, lu->equed, lu->R, lu->C, &lu->L, &lu->U, l… in MatLUFactorNumeric_SuperLU()
299 …lu->options, &lu->A, lu->perm_c, lu->perm_r, lu->etree, lu->equed, lu->R, lu->C, &lu->L, &lu->U, l… in MatLUFactorNumeric_SuperLU()
301 …lu->options, &lu->A, lu->perm_c, lu->perm_r, lu->etree, lu->equed, lu->R, lu->C, &lu->L, &lu->U, l… in MatLUFactorNumeric_SuperLU()
305 if (!sinfo || sinfo == lu->A.ncol + 1) { in MatLUFactorNumeric_SuperLU()
306 …if (lu->options.PivotGrowth) PetscCall(PetscPrintf(PETSC_COMM_SELF, " Recip. pivot growth = %e\n"… in MatLUFactorNumeric_SuperLU()
307 …if (lu->options.ConditionNumber) PetscCall(PetscPrintf(PETSC_COMM_SELF, " Recip. condition number… in MatLUFactorNumeric_SuperLU()
312 if (sinfo <= lu->A.ncol) { in MatLUFactorNumeric_SuperLU()
313 if (lu->options.ILU_FillTol == 0.0) F->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; in MatLUFactorNumeric_SuperLU()
314 …nfo(F, "Number of zero pivots %" PetscInt_FMT ", ILU_FillTol %g\n", sinfo, lu->options.ILU_FillTol… in MatLUFactorNumeric_SuperLU()
315 } else if (sinfo == lu->A.ncol + 1) { in MatLUFactorNumeric_SuperLU()
332 if (lu->options.PrintStat) { in MatLUFactorNumeric_SuperLU()
334 PetscStackCallExternalVoid("SuperLU:StatPrint", StatPrint(&lu->stat)); in MatLUFactorNumeric_SuperLU()
335 Lstore = (SCformat *)lu->L.Store; in MatLUFactorNumeric_SuperLU()
336 Ustore = (NCformat *)lu->U.Store; in MatLUFactorNumeric_SuperLU()
339 …MM_SELF, " No of nonzeros in L+U = %" PetscInt_FMT "\n", Lstore->nnz + Ustore->nnz - lu->A.ncol)); in MatLUFactorNumeric_SuperLU()
340 …f(PETSC_COMM_SELF, " L\\U MB %.3f\ttotal MB needed %.3f\n", lu->mem_usage.for_lu / 1e6, lu->mem_u… in MatLUFactorNumeric_SuperLU()
343 lu->flg = SAME_NONZERO_PATTERN; in MatLUFactorNumeric_SuperLU()
352 Mat_SuperLU *lu = (Mat_SuperLU *)A->data; in MatDestroy_SuperLU() local
355 if (lu->CleanUpSuperLU) { /* Free the SuperLU datastructures */ in MatDestroy_SuperLU()
356 …PetscStackCallExternalVoid("SuperLU:Destroy_SuperMatrix_Store", Destroy_SuperMatrix_Store(&lu->A)); in MatDestroy_SuperLU()
357 if (lu->lwork >= 0) { in MatDestroy_SuperLU()
358 … PetscStackCallExternalVoid("SuperLU:Destroy_SuperNode_Matrix", Destroy_SuperNode_Matrix(&lu->L)); in MatDestroy_SuperLU()
359 PetscStackCallExternalVoid("SuperLU:Destroy_CompCol_Matrix", Destroy_CompCol_Matrix(&lu->U)); in MatDestroy_SuperLU()
362 …PetscStackCallExternalVoid("SuperLU:Destroy_SuperMatrix_Store", Destroy_SuperMatrix_Store(&lu->B)); in MatDestroy_SuperLU()
363 …PetscStackCallExternalVoid("SuperLU:Destroy_SuperMatrix_Store", Destroy_SuperMatrix_Store(&lu->X)); in MatDestroy_SuperLU()
364 PetscStackCallExternalVoid("SuperLU:StatFree", StatFree(&lu->stat)); in MatDestroy_SuperLU()
365 PetscCall(PetscFree(lu->etree)); in MatDestroy_SuperLU()
366 PetscCall(PetscFree(lu->perm_r)); in MatDestroy_SuperLU()
367 PetscCall(PetscFree(lu->perm_c)); in MatDestroy_SuperLU()
368 PetscCall(PetscFree(lu->R)); in MatDestroy_SuperLU()
369 PetscCall(PetscFree(lu->C)); in MatDestroy_SuperLU()
370 PetscCall(PetscFree(lu->rhs_dup)); in MatDestroy_SuperLU()
371 PetscCall(MatDestroy(&lu->A_dup)); in MatDestroy_SuperLU()
396 Mat_SuperLU *lu = (Mat_SuperLU *)F->data; in MatLUFactorSymbolic_SuperLU() local
407 …ionsBool("-mat_superlu_equil", "Equil", "None", (PetscBool)lu->options.Equil, (PetscBool *)&lu->op… in MatLUFactorSymbolic_SuperLU()
409 if (flg) lu->options.ColPerm = (colperm_t)indx; in MatLUFactorSymbolic_SuperLU()
411 if (flg) lu->options.IterRefine = (IterRefine_t)indx; in MatLUFactorSymbolic_SuperLU()
412 …PetscCall(PetscOptionsBool("-mat_superlu_symmetricmode", "SymmetricMode", "None", (PetscBool)lu->o… in MatLUFactorSymbolic_SuperLU()
413 if (set && flg) lu->options.SymmetricMode = YES; in MatLUFactorSymbolic_SuperLU()
414 …PetscCall(PetscOptionsReal("-mat_superlu_diagpivotthresh", "DiagPivotThresh", "None", lu->options.… in MatLUFactorSymbolic_SuperLU()
415 if (flg) lu->options.DiagPivotThresh = (double)real_input; in MatLUFactorSymbolic_SuperLU()
416 …PetscCall(PetscOptionsBool("-mat_superlu_pivotgrowth", "PivotGrowth", "None", (PetscBool)lu->optio… in MatLUFactorSymbolic_SuperLU()
417 if (set && flg) lu->options.PivotGrowth = YES; in MatLUFactorSymbolic_SuperLU()
418 …Bool("-mat_superlu_conditionnumber", "ConditionNumber", "None", (PetscBool)lu->options.ConditionNu… in MatLUFactorSymbolic_SuperLU()
419 if (set && flg) lu->options.ConditionNumber = YES; in MatLUFactorSymbolic_SuperLU()
420 …PetscCall(PetscOptionsEList("-mat_superlu_rowperm", "rowperm", "None", rowperm, 2, rowperm[lu->opt… in MatLUFactorSymbolic_SuperLU()
421 if (flg) lu->options.RowPerm = (rowperm_t)indx; in MatLUFactorSymbolic_SuperLU()
422 …ol("-mat_superlu_replacetinypivot", "ReplaceTinyPivot", "None", (PetscBool)lu->options.ReplaceTiny… in MatLUFactorSymbolic_SuperLU()
423 if (set && flg) lu->options.ReplaceTinyPivot = YES; in MatLUFactorSymbolic_SuperLU()
424 …PetscCall(PetscOptionsBool("-mat_superlu_printstat", "PrintStat", "None", (PetscBool)lu->options.P… in MatLUFactorSymbolic_SuperLU()
425 if (set && flg) lu->options.PrintStat = YES; in MatLUFactorSymbolic_SuperLU()
426 …lwork", "size of work array in bytes used by factorization", "None", lu->lwork, &lu->lwork, NULL)); in MatLUFactorSymbolic_SuperLU()
427 if (lu->lwork > 0) { in MatLUFactorSymbolic_SuperLU()
429 PetscCall(PetscMalloc(lu->lwork, &lu->work)); in MatLUFactorSymbolic_SuperLU()
430 } else if (lu->lwork != 0 && lu->lwork != -1) { in MatLUFactorSymbolic_SuperLU()
431 … lwork %" PetscInt_FMT " is not supported by SUPERLU. The default lwork=0 is used.\n", lu->lwork)); in MatLUFactorSymbolic_SuperLU()
432 lu->lwork = 0; in MatLUFactorSymbolic_SuperLU()
435 …PetscCall(PetscOptionsReal("-mat_superlu_ilu_droptol", "ILU_DropTol", "None", lu->options.ILU_Drop… in MatLUFactorSymbolic_SuperLU()
436 if (flg) lu->options.ILU_DropTol = (double)real_input; in MatLUFactorSymbolic_SuperLU()
437 …PetscCall(PetscOptionsReal("-mat_superlu_ilu_filltol", "ILU_FillTol", "None", lu->options.ILU_Fill… in MatLUFactorSymbolic_SuperLU()
438 if (flg) lu->options.ILU_FillTol = (double)real_input; in MatLUFactorSymbolic_SuperLU()
439 …PetscCall(PetscOptionsReal("-mat_superlu_ilu_fillfactor", "ILU_FillFactor", "None", lu->options.IL… in MatLUFactorSymbolic_SuperLU()
440 if (flg) lu->options.ILU_FillFactor = (double)real_input; in MatLUFactorSymbolic_SuperLU()
441 …tionsInt("-mat_superlu_ilu_droprull", "ILU_DropRule", "None", lu->options.ILU_DropRule, &lu->optio… in MatLUFactorSymbolic_SuperLU()
442 …PetscCall(PetscOptionsInt("-mat_superlu_ilu_norm", "ILU_Norm", "None", lu->options.ILU_Norm, &indx… in MatLUFactorSymbolic_SuperLU()
443 if (flg) lu->options.ILU_Norm = (norm_t)indx; in MatLUFactorSymbolic_SuperLU()
444 …PetscCall(PetscOptionsInt("-mat_superlu_ilu_milu", "ILU_MILU", "None", lu->options.ILU_MILU, &indx… in MatLUFactorSymbolic_SuperLU()
445 if (flg) lu->options.ILU_MILU = (milu_t)indx; in MatLUFactorSymbolic_SuperLU()
448 lu->flg = DIFFERENT_NONZERO_PATTERN; in MatLUFactorSymbolic_SuperLU()
449 lu->CleanUpSuperLU = PETSC_TRUE; in MatLUFactorSymbolic_SuperLU()
453 PetscCall(MatDestroy(&lu->A_dup)); in MatLUFactorSymbolic_SuperLU()
454 if (lu->needconversion) PetscCall(MatConvert(A, MATSEQAIJ, MAT_INITIAL_MATRIX, &lu->A_dup)); in MatLUFactorSymbolic_SuperLU()
455 …if (lu->options.Equil == YES && !lu->A_dup) { /* superlu overwrites input matrix and rhs when Equi… in MatLUFactorSymbolic_SuperLU()
456 PetscCall(MatDuplicate_SeqAIJ(A, MAT_COPY_VALUES, &lu->A_dup)); in MatLUFactorSymbolic_SuperLU()
463 Mat_SuperLU *lu = (Mat_SuperLU *)F->data; in MatSuperluSetILUDropTol_SuperLU() local
466 lu->options.ILU_DropTol = dtol; in MatSuperluSetILUDropTol_SuperLU()
542 Mat_SuperLU *lu; in MatGetFactor_seqaij_superlu() local
565 PetscCall(PetscNew(&lu)); in MatGetFactor_seqaij_superlu()
568 set_default_options(&lu->options); in MatGetFactor_seqaij_superlu()
576 lu->options.Equil = NO; in MatGetFactor_seqaij_superlu()
579 …PetscStackCallExternalVoid("SuperLU:ilu_set_default_options", ilu_set_default_options(&lu->options… in MatGetFactor_seqaij_superlu()
581 lu->options.PrintStat = NO; in MatGetFactor_seqaij_superlu()
584 PetscStackCallExternalVoid("SuperLU:StatInit", StatInit(&lu->stat)); in MatGetFactor_seqaij_superlu()
585 lu->lwork = 0; /* allocate space internally by system malloc */ in MatGetFactor_seqaij_superlu()
588 PetscCall(PetscMalloc1(m, &lu->etree)); in MatGetFactor_seqaij_superlu()
589 PetscCall(PetscMalloc1(n, &lu->perm_r)); in MatGetFactor_seqaij_superlu()
590 PetscCall(PetscMalloc1(m, &lu->perm_c)); in MatGetFactor_seqaij_superlu()
591 PetscCall(PetscMalloc1(n, &lu->R)); in MatGetFactor_seqaij_superlu()
592 PetscCall(PetscMalloc1(m, &lu->C)); in MatGetFactor_seqaij_superlu()
597 …PetscStackCallExternalVoid("SuperLU:cCreate_Dense_Matrix(", cCreate_Dense_Matrix(&lu->B, m, 1, NUL… in MatGetFactor_seqaij_superlu()
598 …PetscStackCallExternalVoid("SuperLU:cCreate_Dense_Matrix(", cCreate_Dense_Matrix(&lu->X, m, 1, NUL… in MatGetFactor_seqaij_superlu()
600 …PetscStackCallExternalVoid("SuperLU:zCreate_Dense_Matrix", zCreate_Dense_Matrix(&lu->B, m, 1, NULL… in MatGetFactor_seqaij_superlu()
601 …PetscStackCallExternalVoid("SuperLU:zCreate_Dense_Matrix", zCreate_Dense_Matrix(&lu->X, m, 1, NULL… in MatGetFactor_seqaij_superlu()
605 …PetscStackCallExternalVoid("SuperLU:sCreate_Dense_Matrix", sCreate_Dense_Matrix(&lu->B, m, 1, NULL… in MatGetFactor_seqaij_superlu()
606 …PetscStackCallExternalVoid("SuperLU:sCreate_Dense_Matrix", sCreate_Dense_Matrix(&lu->X, m, 1, NULL… in MatGetFactor_seqaij_superlu()
608 …PetscStackCallExternalVoid("SuperLU:dCreate_Dense_Matrix", dCreate_Dense_Matrix(&lu->B, m, 1, NULL… in MatGetFactor_seqaij_superlu()
609 …PetscStackCallExternalVoid("SuperLU:dCreate_Dense_Matrix", dCreate_Dense_Matrix(&lu->X, m, 1, NULL… in MatGetFactor_seqaij_superlu()
615 B->data = lu; in MatGetFactor_seqaij_superlu()
623 Mat_SuperLU *lu; in MatGetFactor_seqsell_superlu() local
627 lu = (Mat_SuperLU *)((*F)->data); in MatGetFactor_seqsell_superlu()
628 lu->needconversion = PETSC_TRUE; in MatGetFactor_seqsell_superlu()