// SolveR solves the linear Real system A.x = b func (o *LinSolUmfpack) SolveR(xR, bR []float64, dummy bool) (err error) { // check if !o.is_initialised { return chk.Err("linear solver must be initialised first\n") } if o.cmplx { return chk.Err(_linsol_umfpack_err10) } // start time if o.ton { o.tini = time.Now() } // message if o.verb { io.Pfgreen("\n . . . . . . . . . . . . . . LinSolUmfpack.SolveR . . . . . . . . . . . . . . . \n\n") } // UMFPACK: pointers pxR := (*C.double)(unsafe.Pointer(&xR[0])) pbR := (*C.double)(unsafe.Pointer(&bR[0])) // UMFPACK: solve st := C.umfpack_dl_solve(C.UMFPACK_A, o.ap, o.ai, o.ax, pxR, pbR, o.unum, o.uctrl, o.uinfo) if st != C.UMFPACK_OK { return chk.Err(_linsol_umfpack_err11, Uerr2Text[int(st)]) } if o.verb { C.umfpack_dl_report_info(o.uctrl, o.uinfo) } // duration if o.ton { io.Pfcyan("%s: Time spent in LinSolUmfpack.Solve = %v\n", o.name, time.Now().Sub(o.tini)) } return }
// Fact performs symbolic/numeric factorisation. This method also converts the triplet form // to the column-compressed form, including the summation of duplicated entries func (o *LinSolUmfpack) Fact() (err error) { // check if !o.is_initialised { return chk.Err("linear solver must be initialised first\n") } // start time if o.ton { o.tini = time.Now() } // message if o.verb { io.Pfgreen("\n . . . . . . . . . . . . . . LinSolUmfpack.Fact . . . . . . . . . . . . . . . \n\n") } // clean up if o.factorised { o.Clean() } // factorisation if o.cmplx { // UMFPACK: convert triplet to column-compressed format st := C.umfpack_zl_triplet_to_col(C.LONG(o.tC.m), C.LONG(o.tC.n), C.LONG(o.tC.pos), o.ti, o.tj, o.tx, o.tz, o.ap, o.ai, o.ax, o.az, nil) if st != C.UMFPACK_OK { return chk.Err(_linsol_umfpack_err04, Uerr2Text[int(st)]) } // UMFPACK: symbolic factorisation st = C.umfpack_zl_symbolic(C.LONG(o.tC.m), C.LONG(o.tC.n), o.ap, o.ai, o.ax, o.az, &o.usymb, o.uctrl, nil) if st != C.UMFPACK_OK { return chk.Err(_linsol_umfpack_err05, Uerr2Text[int(st)]) } // UMFPACK: numeric factorisation st = C.umfpack_zl_numeric(o.ap, o.ai, o.ax, o.az, o.usymb, &o.unum, o.uctrl, nil) if st != C.UMFPACK_OK { return chk.Err(_linsol_umfpack_err06, Uerr2Text[int(st)]) } } else { // UMFPACK: convert triplet to column-compressed format st := C.umfpack_dl_triplet_to_col(C.LONG(o.tR.m), C.LONG(o.tR.n), C.LONG(o.tR.pos), o.ti, o.tj, o.tx, o.ap, o.ai, o.ax, nil) if st != C.UMFPACK_OK { return chk.Err(_linsol_umfpack_err07, Uerr2Text[int(st)]) } // UMFPACK: symbolic factorisation st = C.umfpack_dl_symbolic(C.LONG(o.tR.m), C.LONG(o.tR.n), o.ap, o.ai, o.ax, &o.usymb, o.uctrl, o.uinfo) if st != C.UMFPACK_OK { return chk.Err(_linsol_umfpack_err08, Uerr2Text[int(st)]) } if o.verb { C.umfpack_dl_report_info(o.uctrl, o.uinfo) } // UMFPACK: numeric factorisation st = C.umfpack_dl_numeric(o.ap, o.ai, o.ax, o.usymb, &o.unum, o.uctrl, o.uinfo) if st != C.UMFPACK_OK { return chk.Err(_linsol_umfpack_err09, Uerr2Text[int(st)]) } if o.verb { C.umfpack_dl_report_info(o.uctrl, o.uinfo) } } // set flag o.factorised = true // duration if o.ton { io.Pfcyan("%s: Time spent in LinSolUmfpack.Fact = %v\n", o.name, time.Now().Sub(o.tini)) } return }