示例#1
0
// InitR initialises a LinSolUmfpack data structure for Real systems. It also performs some initial analyses.
func (o *LinSolUmfpack) InitR(tR *Triplet, symmetric, verbose, timing bool) (err error) {

	// check
	o.tR = tR
	if tR.pos == 0 {
		return chk.Err(_linsol_umfpack_err01)
	}

	// flags
	o.name = "umfpack"
	o.sym = symmetric
	o.cmplx = false
	o.verb = verbose
	o.ton = timing

	// start time
	if o.ton {
		o.tini = time.Now()
	}

	// pointers
	o.ti = (*C.LONG)(unsafe.Pointer(&o.tR.i[0]))
	o.tj = (*C.LONG)(unsafe.Pointer(&o.tR.j[0]))
	o.tx = (*C.double)(unsafe.Pointer(&o.tR.x[0]))
	o.ap = (*C.LONG)(unsafe.Pointer(&make([]int, o.tR.n+1)[0]))
	o.ai = (*C.LONG)(unsafe.Pointer(&make([]int, o.tR.pos)[0]))
	o.ax = (*C.double)(unsafe.Pointer(&make([]float64, o.tR.pos)[0]))

	// control and info
	o.ctrl = make([]float64, C.UMFPACK_CONTROL)
	o.uctrl = (*C.double)(unsafe.Pointer(&o.ctrl[0]))
	C.umfpack_dl_defaults(o.uctrl)
	if o.verb {
		o.info = make([]float64, C.UMFPACK_INFO)
		o.uinfo = (*C.double)(unsafe.Pointer(&o.info[0]))
		o.ctrl[C.UMFPACK_PRL] = 6 // change the default print level; otherwise, nothing will print
	}

	// duration
	if o.ton {
		io.Pfcyan("%s: Time spent in LinSolUmfpack.InitR = %v\n", o.name, time.Now().Sub(o.tini))
	}

	// success
	o.is_initialised = true
	return
}
示例#2
0
// InitR initialises a LinSolUmfpack data structure for Real systems. It also performs some initial analyses.
func (o *LinSolUmfpack) InitR(tR *Triplet, symmetric, verbose, timing bool) (err error) {

	// check
	o.tR = tR
	if tR.pos == 0 {
		return chk.Err(_linsol_umfpack_err01)
	}

	// flags
	o.name = "umfpack"
	o.sym = symmetric
	o.cmplx = false
	o.verb = verbose
	o.ton = timing

	// start time
	if o.ton {
		o.tini = time.Now()
	}

	// pointers
	o.ti = (*C.LONG)(unsafe.Pointer(&o.tR.i[0]))
	o.tj = (*C.LONG)(unsafe.Pointer(&o.tR.j[0]))
	o.tx = (*C.double)(unsafe.Pointer(&o.tR.x[0]))
	o.ap = (*C.LONG)(unsafe.Pointer(&make([]int, o.tR.n+1)[0]))
	o.ai = (*C.LONG)(unsafe.Pointer(&make([]int, o.tR.pos)[0]))
	o.ax = (*C.double)(unsafe.Pointer(&make([]float64, o.tR.pos)[0]))

	// control
	o.uctrl = (*C.double)(unsafe.Pointer(&make([]float64, C.UMFPACK_CONTROL)[0]))
	C.umfpack_dl_defaults(o.uctrl)

	// duration
	if o.ton {
		io.Pfcyan("%s: Time spent in LinSolUmfpack.InitR = %v\n", o.name, time.Now().Sub(o.tini))
	}
	return
}
示例#3
0
// initialise Umfpack control arrays
func init() {
	_uctrl = (*C.double)(unsafe.Pointer(&_umfpctrl[0]))
	_uctrlz = (*C.double)(unsafe.Pointer(&_umfpctrlz[0]))
	C.umfpack_dl_defaults(_uctrl)
	C.umfpack_zl_defaults(_uctrlz)
}