Exemple #1
0
    mat_ZZ getlllbasis(int n,int seed,vec_ZZ& phi,double bit=10) {

        initialize();
        std::ostringstream fname;
        fname << getfname(n,seed,bit,1);
        mat_ZZ L;
        
        L = getbasis(n,seed,phi,seed); // to recover phi
       if (FileExists(fname)==true) {
            LoadLattice(L,fname.str());
        } else {
            L = getbasis(n,seed,phi,seed);
            ::BigLLL(L,0,0.999,VL1);
#ifdef _allow_cachefiles
            SaveLattice(L,fname.str());
#endif
        }
        return L;
    }
Exemple #2
0
void Element::EdgeJbwd(double *d, int edg){
  Basis *b = getbasis();
  int   va = vnum(edg,0);
  int   vb = vnum(edg,1), i;
  dsmul(qa, vert[va].hj[0], b->vert[0].a, 1, d, 1);
  daxpy(qa, vert[vb].hj[0], b->vert[1].a, 1, d, 1);

  for(i = 0; i < edge[edg].l;++i)
    daxpy(qa, edge[edg].hj[i], b->edge[0][i].a, 1, d, 1);
}
Exemple #3
0
double Quad::get_1diag_massmat(int ID){
  double *wa, *wb;
  double *wvec = dvector(0, qtot-1), vmmat;
  Mode mw,*m;

#ifndef PCONTBASE
  double **ba, **bb;
  Mode m1;
  get_moda_GL (qa, &ba);
  get_moda_GL (qb, &bb);
  m1.a = ba[ID];
  m1.b = bb[ID];
  m = &m1;
#else
  Basis *b = getbasis();
  m = b->vert+ID;
#endif

  getzw(qa,&wa,&wa,'a');
  getzw(qb,&wb,&wb,'a');

  mw.a = wa;  mw.b = wb;

  fillvec(&mw, wvec);

  if(curvX)
    dvmul(qtot, wvec, 1, geom->jac.p, 1, wvec, 1);
  else
    dscal(qtot, geom->jac.d, wvec, 1);

  vmmat = Quad_mass_mprod(this, m, wvec);

  free(wvec);

  return vmmat;
}
Exemple #4
0
// ============================================================================
void Tri::BET_Mat(Element *P, LocMatDiv *bet, double *beta, double *sigma)
{
	register int i,j,n;
	const    int nbl = Nbmodes, N = Nmodes - Nbmodes;
	int      L;
	Basis   *b = getbasis();
	double **dxb = bet->Dxb,   // MSB: dx corresponds to bar(beta)
	               **dxi = bet->Dxi,
	                       **dyb = bet->Dyb,   // MSB: dy corresponds to sigma
	                               **dyi = bet->Dyi;
	char orig_state = state;

	/* fill boundary systems */
	for(i = 0,n=0; i < Nverts; ++i,++n)
	{
		fillElmt(b->vert+i);

		dvmul(qtot,beta,1,*h,1,*P->h,1);
#ifndef PCONTBASE

		P->Ofwd(*P->h,P->vert->hj,P->dgL);
#else

		P->Iprod(P);
#endif

		dcopy(P->Nmodes,P->vert->hj,1,*dxb + n,nbl);

		dvmul(qtot,sigma,1,*h,1,*P->h,1);
#ifndef PCONTBASE

		P->Ofwd(*P->h,P->vert->hj,P->dgL);
#else

		P->Iprod(P);
#endif

		dcopy(P->Nmodes,P->vert->hj,1,*dyb + n,nbl);
	}

	for(i = 0; i < Nedges; ++i)
		for(j = 0; j < edge[i].l; ++j, ++n)
		{
			fillElmt(b->edge[i]+j);

			dvmul(qtot,beta,1,*h,1,*P->h,1);
#ifndef PCONTBASE

			P->Ofwd(*P->h,P->vert->hj,P->dgL);
#else

			P->Iprod(P);
#endif

			dcopy(P->Nmodes,P->vert->hj,1,*dxb + n,nbl);

			dvmul(qtot,sigma,1,*h,1,*P->h,1);
#ifndef PCONTBASE

			P->Ofwd(*P->h,P->vert->hj,P->dgL);
#else

			P->Iprod(P);
#endif

			dcopy(P->Nmodes,P->vert->hj,1,*dyb + n,nbl);
		}

	L = face->l;
	for(i = 0,n=0; i < L;++i)
		for(j = 0; j < L-i; ++j,++n)
		{
			fillElmt(b->face[0][i]+j);

			dvmul(qtot,beta,1,*h,1,*P->h,1);
#ifndef PCONTBASE

			P->Ofwd(*P->h,P->vert->hj,P->dgL);
#else

			P->Iprod(P);
#endif

			dcopy(P->Nmodes,P->vert->hj,1,*dxi + n,N);

			dvmul(qtot,sigma,1,*h,1,*P->h,1);
#ifndef PCONTBASE

			P->Ofwd(*P->h,P->vert->hj,P->dgL);
#else

			P->Iprod(P);
#endif

			dcopy(P->Nmodes,P->vert->hj,1,*dyi + n,N);
		}

	state = orig_state;

	/* negate all systems to that the whole operator can be treated
	as positive when condensing */
	/*
	dneg(nbl*P->Nmodes,*dxb,1);
	dneg(nbl*P->Nmodes,*dyb,1);
	dneg(N  *P->Nmodes,*dxi,1);
	dneg(N  *P->Nmodes,*dyi,1);
	*/
}