@@ -425,17 +425,17 @@ vec GWRMultiscale::fitVarSerial(const vec &x, const vec &y, const uword var, mat
425425 if (mHasHatMatrix )
426426 {
427427 mat ci, si;
428- S = mat (mHasHatMatrix ? nDp : 1 , nDp, fill::zeros);
428+ S = mat (nDp, nDp, fill::zeros);
429429 for (uword i = 0 ; i < nDp ; i++)
430430 {
431431 GWM_LOG_STOP_BREAK (mStatus );
432432 vec w = mSpatialWeights [var].weightVector (i);
433433 mat xtw = trans (x % w);
434- mat xtwx = xtw * x;
435- mat xtwy = xtw * y;
434+ double xtwx = as_scalar ( xtw * x) ;
435+ double xtwy = as_scalar ( xtw * y) ;
436436 try
437437 {
438- mat xtwx_inv = inv_sympd ( xtwx) ;
438+ double xtwx_inv = 1.0 / xtwx;
439439 betas.col (i) = xtwx_inv * xtwy;
440440 ci = xtwx_inv * xtw;
441441 si = x (i) * ci;
@@ -569,12 +569,12 @@ double GWRMultiscale::bandwidthSizeCriterionVarCVSerial(BandwidthWeight *bandwid
569569 vec w = bandwidthWeight->weight (d);
570570 w (i) = 0.0 ;
571571 mat xtw = trans (mXi % w);
572- mat xtwx = xtw * mXi ;
573- mat xtwy = xtw * mYi ;
572+ double xtwx = as_scalar ( xtw * mXi ) ;
573+ double xtwy = as_scalar ( xtw * mYi ) ;
574574 try
575575 {
576- mat xtwx_inv = inv_sympd ( xtwx) ;
577- vec beta = xtwx_inv * xtwy;
576+ double xtwx_inv = 1.0 / xtwx;
577+ double beta = xtwx_inv * xtwy;
578578 double res = mYi (i) - det (mXi (i) * beta);
579579 cv += res * res;
580580 }
@@ -606,11 +606,11 @@ double GWRMultiscale::bandwidthSizeCriterionVarAICSerial(BandwidthWeight *bandwi
606606 vec d = mSpatialWeights [var].distance ()->distance (i);
607607 vec w = bandwidthWeight->weight (d);
608608 mat xtw = trans (mXi % w);
609- mat xtwx = xtw * mXi ;
610- mat xtwy = xtw * mYi ;
609+ double xtwx = as_scalar ( xtw * mXi ) ;
610+ double xtwy = as_scalar ( xtw * mYi ) ;
611611 try
612612 {
613- mat xtwx_inv = inv_sympd ( xtwx) ;
613+ double xtwx_inv = 1.0 / xtwx;
614614 betas.col (i) = xtwx_inv * xtwy;
615615 mat ci = xtwx_inv * xtw;
616616 mat si = mXi (i) * ci;
0 commit comments