23 DbgLv(1) <<
"PC(WT): Thread created";
34 DbgLv(1) <<
"PC(WT): Thread destroy - (1)finished?" << isFinished() <<
thrn;
37 DbgLv(1) <<
"Thread destroy wait timeout(2secs) : Thread" <<
thrn;
39 DbgLv(1) <<
"PC(WT): Thread destroy - (2)finished?" << isFinished() <<
thrn;
40 DbgLv(1) <<
"PC(WT): Thread destroyed" <<
thrn;
61 QString phdr = QString(
"PC(WT)dw:%1:%2:" ).arg(
taskx).arg(
thrn);
75 DbgLv(1) << phdr <<
"DefWk: stype" <<
dsets[0]->solute_type;
89 DbgLv(1) <<
"PC(WT): get_result IN";
111 DbgLv(1) <<
"PC(WT): thr nn" <<
thrn << nn <<
"out sol0 solk soln"
116 DbgLv(1) <<
"PC(WT): thr nn" <<
thrn << nn
126 QString phdr = QString(
"WT:RUN:%1:%2:" ).arg(
taskx).arg(
thrn);
129 DbgLv(1) << phdr <<
" sig w_c";
132 DbgLv(1) << phdr <<
" c_r return";
146 QString phdr = QString(
"PC(WT):CR:%1:%2:" ).arg(
taskx).arg(
thrn);
152 DbgLv(1) << phdr <<
" A)dsets size" <<
dsets.size();
159 DbgLv(1) << phdr <<
" B)sols_i size" << ns <<
"stype" <<
dsets[0]->solute_type;
160 for(
int js=0; js<ns; js++) {
161 if (js<4 || (js+5)>ns)
162 DbgLv(1) << phdr <<
" soli: js" << js <<
" sol.x,y,z,c"
181 double variance = 0.0;
182 double xnormsq = 0.0;
185 DbgLv(1) << phdr <<
" call apply_alpha" << alpha;
187 nscans, npoints, nisols, variance, xnormsq );
188 DbgLv(1) << phdr <<
" get apply_alpha: vari xnsq" << variance << xnormsq;
205 QVector< double >* psv_nnls_a, QVector< double >* psv_nnls_b,
206 const int nscans,
const int npoints,
const int nisols,
207 double& variance,
double& xnormsq )
209 QString phdr = QString(
"wAA:%1:%2:" ).arg(
taskx).arg(
thrn);
211 int narows = ntotal + nisols;
212 int navals = narows * nisols;
216 QVector< double > nnls_a( navals );
217 QVector< double > nnls_b( narows );
218 QVector< double > nnls_x( nisols );
219 QVector< double > simdat;
224 for (
int jj = 0; jj < navals; jj++ )
225 nnls_a[ jj ] = psv_nnls_a->at( jj );
227 for (
int jj = 0; jj < narows; jj++ )
228 nnls_b[ jj ] = psv_nnls_b->at( jj );
230 nnls_x.fill( 0.0, nisols );
232 int kavl=psv_nnls_a->size();
234 DbgLv(1) << phdr <<
" ns np ni na" << nscans << npoints << nisols << narows;
239 double* a_ptr = nnls_a.data();
240 double* b_ptr = nnls_b.data();
241 double* x_ptr = nnls_x.data();
243 int dinc = narows + 1;
244 DbgLv(1) << phdr <<
" alpha" << alpha <<
"dx dinc" << dx << dinc;
246 for (
int cc = 0; cc < nisols; cc++, dx += dinc )
253 DbgLv(1) << phdr <<
"pre-nnls";
259 simdat.fill( 0.0, ntotal );
260 int ktot=simdat.size();
261 DbgLv(1) << phdr <<
" simdat fill ktot,kavl,naro" << ktot << kavl << narows
263 double* s_ptr = simdat.data();
264 a_ptr = psv_nnls_a->data();
265 b_ptr = psv_nnls_b->data();
268 for (
int cc = 0; cc < nisols; cc++ )
270 double soluval = x_ptr[ cc ];
274 xnormsq +=
sq( soluval );
275 int aa = cc * narows;
277 for (
int kk = 0; kk < ntotal; kk++ )
279 s_ptr[ kk ] += ( soluval * a_ptr[ aa++ ] );
287 for (
int kk = 0; kk < ntotal; kk++ )
289 variance +=
sq( ( b_ptr[ kk ] - s_ptr[ kk ] ) );
291 DbgLv(1) << phdr <<
" ntot ncsols" << ntotal << ncsols
292 <<
"varisum" << variance;
295 variance /= (double)ntotal;
296 DbgLv(1) << phdr <<
" alpha" << alpha <<
"vari xnsq" << variance << xnormsq;
297 int mm = npoints / 2;
298 DbgLv(1) << phdr <<
" mm=" << mm <<
"a[m] b[m] s[m]"
299 << (*psv_nnls_a)[mm] << (*psv_nnls_b)[mm] << simdat[mm]