MoneHajlamot1* MoneHajlamot::mone_hajlamot_p (MorphInfoCR ha_poal) { StringTemp bw (ha_poal.baseword()); Index i = charindex ('-',bw.str); if (i<bw.len) bw[i]='\0'; return itemp(bw.str); }
void simpleQPSolve(Matrix G, Vector vd, Matrix Astar, Vector vBstar, // in Vector vXtmp, Vector vLambda) // out { Astar.setNLine(Astar.nLine()+1); Matrix thisG, At=Astar.transpose(); Astar.setNLine(Astar.nLine()-1); Vector minusvd=vd.clone(); minusvd.multiply(-1.0); vBstar.multiply(-1.0); int m=Astar.nLine(), me=0, mmax=Astar.nLine()+1, n=vd.sz(), nmax=n, mnn=m+n+n, iout=0, ifail, iprint=0, lwar=3*nmax*nmax/2 + 10*nmax+ 2*mmax+1, liwar=n; if (G==Matrix::emptyMatrix) { thisG.setSize(n,n); thisG.diagonal(1.0); } else thisG=G; double *c=*((double**)thisG), *d=minusvd, *a=*((double**)At), *b=vBstar; Vector vxl(n),vxu(n), temp(lwar); VectorInt itemp(liwar); vLambda.setSize(mnn); double *xl=vxl, *xu=vxu, *x=vXtmp, *u=vLambda, *war=temp, eps1=1e-20; int *iwar=itemp; int dim=n; while (dim--) { xl[dim]=-INF; xu[dim]=INF; } iwar[0]=0; ql0001_(&m,&me,&mmax,&n,&nmax,&mnn,c,d,a,b,xl,xu,x,u,&iout,&ifail, &iprint,war,&lwar,iwar,&liwar,&eps1); vLambda.setSize(m); }
status MoneHajlamot::add (MorphInfoCR x, MorphInfoCR y, Sikui hasikui) { MoneHajlamot1* ha_mone_p = itemp(x.baseword()); if (ha_mone_p==NULL) { MoneHajlamot1 mone_xadaj; mone_xadaj.add(y,hasikui); return insert(x.baseword(), mone_xadaj); } else { return ha_mone_p->add(y,hasikui); } }
void AstEnumItemRef::dump(ostream& str) { this->AstNode::dump(str); str<<" -> "; if (itemp()) { itemp()->dump(str); } else { str<<"UNLINKED"; } }
int LinePartitioner<GraphType,Scalar>::Compute_Blocks_AutoLine(Teuchos::ArrayView<local_ordinal_type> blockIndices) const { typedef local_ordinal_type LO; const LO invalid = Teuchos::OrdinalTraits<LO>::invalid(); const Scalar zero = Teuchos::ScalarTraits<Scalar>::zero(); const MT mzero = Teuchos::ScalarTraits<MT>::zero(); Teuchos::ArrayRCP<const Scalar> xvalsRCP, yvalsRCP, zvalsRCP; Teuchos::ArrayView<const Scalar> xvals, yvals, zvals; xvalsRCP = coord_->getData(0); xvals = xvalsRCP(); if(coord_->getNumVectors() > 1) { yvalsRCP = coord_->getData(1); yvals = yvalsRCP(); } if(coord_->getNumVectors() > 2) { zvalsRCP = coord_->getData(2); zvals = zvalsRCP(); } MT tol = threshold_; size_t N = this->Graph_->getNodeNumRows(); size_t allocated_space = this->Graph_->getNodeMaxNumRowEntries(); Teuchos::Array<LO> cols(allocated_space); Teuchos::Array<LO> indices(allocated_space); Teuchos::Array<MT> dist(allocated_space); Teuchos::Array<LO> itemp(2*allocated_space); Teuchos::Array<MT> dtemp(allocated_space); LO num_lines = 0; for(LO i=0; i<(LO)N; i+=NumEqns_) { size_t nz=0; // Short circuit if I've already been blocked if(blockIndices[i] != invalid) continue; // Get neighbors and sort by distance this->Graph_->getLocalRowCopy(i,cols(),nz); Scalar x0 = (!xvals.is_null()) ? xvals[i/NumEqns_] : zero; Scalar y0 = (!yvals.is_null()) ? yvals[i/NumEqns_] : zero; Scalar z0 = (!zvals.is_null()) ? zvals[i/NumEqns_] : zero; LO neighbor_len=0; for(size_t j=0; j<nz; j+=NumEqns_) { MT mydist = mzero; LO nn = cols[j] / NumEqns_; if(cols[j] >=(LO)N) continue; // Check for off-proc entries if(!xvals.is_null()) mydist += square<Scalar>(x0 - xvals[nn]); if(!yvals.is_null()) mydist += square<Scalar>(y0 - yvals[nn]); if(!zvals.is_null()) mydist += square<Scalar>(z0 - zvals[nn]); dist[neighbor_len] = Teuchos::ScalarTraits<MT>::squareroot(mydist); indices[neighbor_len]=cols[j]; neighbor_len++; } Teuchos::ArrayView<MT> dist_view = dist(0,neighbor_len); Tpetra::sort2(dist_view.begin(),dist_view.end(),indices.begin()); // Number myself for(LO k=0; k<NumEqns_; k++) blockIndices[i + k] = num_lines; // Fire off a neighbor line search (nearest neighbor) if(neighbor_len > 2 && dist[1]/dist[neighbor_len-1] < tol) { local_automatic_line_search(NumEqns_,blockIndices,i,indices[1],num_lines,tol,itemp,dtemp); } // Fire off a neighbor line search (second nearest neighbor) if(neighbor_len > 3 && dist[2]/dist[neighbor_len-1] < tol) { local_automatic_line_search(NumEqns_,blockIndices,i,indices[2],num_lines,tol,itemp,dtemp); } num_lines++; } return num_lines; }