Esempio n. 1
0
void fuz_prop(field_offset fprop, int r0)
{
register int i;
register site *s; 

int  dir, k;

msg_tag *tag0, *tag1;

    /* Save unfuzzed propagator in xxx */
    copy_latvec( fprop, F_OFFSET(xxx), EVENANDODD);
    /* Give central value weight two */
    scalar_mult_latvec( F_OFFSET(xxx), 2.0, fprop, EVENANDODD);

    if (r0 > 0){

	for(dir=XUP;dir<=ZUP;dir++){
	    /* Start gathering for 'backward' link-product */
	    tag0 = start_gather_site(F_OFFSET(xxx), sizeof(su3_vector),
		dir, EVENANDODD, gen_pt[0]);

	    /* Start 'forward' link-product */
	    FORALLSITES(i,s) {
		mult_adj_su3_mat_vec(&(s->link[dir]), &(s->xxx), &(s->ttt));
	    }
	    tag1 = start_gather_site(F_OFFSET(ttt), sizeof(su3_vector),
		OPP_DIR(dir), EVENANDODD, gen_pt[1]);

	    for(k=1;k<r0;k++) {
		wait_gather(tag0);
/*
		copy_latvec( (field_offset)gen_pt[0], F_OFFSET(resid),
		    EVENANDODD);
*/
		FORALLSITES(i,s) {
		    su3vec_copy((su3_vector *)gen_pt[0][i], &(s->resid));
		}
		FORALLSITES(i,s) {
		    mult_su3_mat_vec(&(s->link[dir]), &(s->resid), &(s->cg_p));
		}
		if(k==1) {
		    cleanup_gather(tag0);
		    tag0 = start_gather_site(F_OFFSET(cg_p), sizeof(su3_vector),
			dir, EVENANDODD, gen_pt[0]);
		}
		else {
		    restart_gather_site(F_OFFSET(cg_p), sizeof(su3_vector),
			dir, EVENANDODD, gen_pt[0], tag0);
		}

		wait_gather(tag1);
/*
		copy_latvec( (field_offset)gen_pt[1], F_OFFSET(resid),
		    EVENANDODD);
*/
		FORALLSITES(i,s) {
		    su3vec_copy((su3_vector *)gen_pt[1][i], &(s->resid));
		}
Esempio n. 2
0
	FORSOMEPARITY(i,s,l_parity) {
		scalar_mult_add_su3_vector( &temp[i],&init_guess[i],msq_xm4,&temp[i] );
		add_su3_vector((su3_vector *)F_PT(s,src1),&temp[i],&common_source[i] );
	        source_norm += (double)magsq_su3vec( &common_source[i] );	
		source_norm1 += (double)magsq_su3vec( (su3_vector *)F_PT(s,src1) );  
		/*pm_strange[i] = cg_p[i] = resid[i] = common_source[i];*/
		su3vec_copy( &common_source[i],&(resid[i]) );
		su3vec_copy(&(resid[i]),&(cg_p[i]) );
                su3vec_copy(&(resid[i]), &pm_strange[i]);
                su3vec_copy(&init_guess[i],&destvec1[i] );
                su3vec_copy(&init_guess[i],&destvec2[i] );
	} END_LOOP
Esempio n. 3
0
void accum_delta_prop(int i,int c[3])
     /* Load a determinant for the calculation of the delta propagator */
     /* Each column of the determinant is the symmetrically shifted   */
     /* "q" propagator.  Each column has a differenct shift direction */
     /* Each column also corresponds to a different source wall color */
     /* as specified by the color vector c                            */
     /* Result is put in tempmat1 */
{
  int j,dir;
  su3_matrix *af, *ab;
  
  
  FORALLUPDIRBUT(TUP,dir)
    {
      /* For timeward propagation, this step is pedantic */
      /* since we could simply take j = dir */
      /* but for spacelike propagation, it is necessary */
      switch (dir)
	{
	case XUP: j = 0; break;
	case YUP: j = 1; break;
	case ZUP: j = 2;
	}

      /* gen_pt points to the "q" propagator on the next neighbor    */
      af = (su3_matrix *)gen_pt[dir][i];
      ab = (su3_matrix *)gen_pt[dir+4][i];
      su3vec_copy( (su3_vector *)(af->e[c[j]]),
		   (su3_vector *)(lattice[i].tempmat1.e[j]) );
      add_su3_vector( (su3_vector *)(ab->e[c[j]]),
		     (su3_vector *)(lattice[i].tempmat1.e[j]),
		     (su3_vector *)(lattice[i].tempmat1.e[j]) );

    }
}
Esempio n. 4
0
void fermion_forwardstep(field_offset flow_vec){
  Real eps = epsilon;
  register int i;
  register site *s;
  int j, off[4];
  for (j = 0; j < 4; j++) off[j] = flow_vec + j*sizeof(su3_vector);

  // Step ODD sites

  // Obtain lambda1
  fdslash(off[0], F_OFFSET(W0), off[1], EVEN);
  fdslash(off[1], F_OFFSET(W0), off[1], ODD);
  scalar_mult_add_latvec(off[0], off[1], eps/4,
      off[1], ODD);
  
  // Obtain lambda2
  fdslash(off[1], F_OFFSET(W1), off[2], EVEN);
  fdslash(off[2], F_OFFSET(W1), off[2], ODD);
  scalar_mult_latvec(off[2], 8*eps/9, off[2], ODD);
  scalar_mult_add_latvec(off[2], off[1], -8/9, 
      off[2], ODD);
  scalar_mult_add_latvec(off[2], off[0], 17/9, 
      off[2], ODD);

  // Obtain lambda3
  fdslash(off[2], F_OFFSET(W2), off[3], EVEN);
  fdslash(off[3], F_OFFSET(W2), off[3], ODD);
  scalar_mult_add_latvec(off[1], off[3], 3*eps/4, 
      off[3], ODD);

  // copy odd sites of lambda3
  FORODDSITES(i,s){
    su3vec_copy((su3_vector *)F_PT(s,off[3]), &(s->tempvec0));
  }
Esempio n. 5
0
void save_ks_vector_scidac_from_site(char *filename, char *fileinfo,
				     char *recinfo, 
				     int volfmt, int serpar, 
				     field_offset src, int count, int prec)
{

  su3_vector *tmp;
  int i,j; site *s;

  tmp = (su3_vector *)malloc(sites_on_node * count * sizeof(su3_vector));
  if(tmp == NULL){
    printf("save_ks_vector_scidac_from_site(%d): No room for tmp\n",
	   this_node);
    terminate(1);
  }

  FORALLSITES(i,s){
    for(j = 0; j < count; j++)
      su3vec_copy((su3_vector *)F_PT(s,src+j*sizeof(su3_vector)),tmp+count*i+j);
  }

  save_ks_vector_scidac_from_field(filename, fileinfo, recinfo, 
				   volfmt, serpar, tmp, count, prec);
  free(tmp);
}
Esempio n. 6
0
void restore_ks_vector_scidac_to_site(char *filename, int serpar,
				      field_offset dest, int count){
  su3_vector *tmp;
  int i,j;
  site *s;

  tmp = (su3_vector *)malloc(sites_on_node * count * sizeof(su3_vector));
  if(tmp == NULL){
    printf("restore_ks_vector_scidac_to_site(%d): No room for tmp\n",
	   this_node);
    terminate(1);
  }
			     
  restore_ks_vector_scidac_to_field(filename, serpar, tmp, count);

  FORALLSITES(i,s){
    for(j = 0; j < count; j++)
      su3vec_copy(tmp+count*i+j,(su3_vector *)F_PT(s,dest+j*sizeof(su3_vector)));
  }

  free(tmp);
}
Esempio n. 7
0
static void m_by_omega_swv(spin_wilson_vector *swv, su3_vector *ksp, site *s, int r0[]){

  int s0;
  spin_wilson_vector swvtmp;
  gamma_matrix_t omega;

  /* Initialize the propagator */
  
  memset(swv, 0, sizeof(spin_wilson_vector));

  /* Start with WP = I_spin x KS_color where I_spin is a unit matrix
     in spin */

  for(s0 = 0; s0 < 4; s0++)
    su3vec_copy(ksp, &swv->d[s0].d[s0]);


  /* Construct (omega(sink) omega0^+(source))^* */
  omega = gamma0_dag;
  mult_omega_l(&omega, s->x-r0[0], s->y-r0[1], s->z-r0[2], s->t-r0[3]);
  
  mult_sw_by_gamma_mat_l( swv, &swvtmp, &omega); 
  *swv = swvtmp;
}
Esempio n. 8
0
int nl_spectrum( Real vmass, field_offset temp1, field_offset temp2 ) { 
  /* return the C.G. iteration number */
  double *piprop,*pi2prop,*rhoprop,*rho2prop,*barprop;
  double *nlpiprop,*nlpi2prop,*ckpiprop,*ckpi2prop;
  double *delprop,*ckbarprop;
  Real vmass_x2;
  site* s;
  register complex cc;
  Real finalrsq;
  register int i,x,y,z,t,icol,cgn;
  register int t_source,t_off;
  int dir,isrc;

  msg_tag *mtag[16];

  piprop = (double *)malloc( nt*sizeof(double) );
  pi2prop = (double *)malloc( nt*sizeof(double) );
  rhoprop = (double *)malloc( nt*sizeof(double) );
  rho2prop = (double *)malloc( nt*sizeof(double) );
  barprop = (double *)malloc( nt*sizeof(double) );
  nlpiprop = (double *)malloc( nt*sizeof(double) );
  nlpi2prop = (double *)malloc( nt*sizeof(double) );
  ckpiprop = (double *)malloc( nt*sizeof(double) );
  ckpi2prop = (double *)malloc( nt*sizeof(double) );
  delprop = (double *)malloc( nt*sizeof(double) );
  ckbarprop = (double *)malloc( nt*sizeof(double) );

  for( t=0; t<nt; t++ ){
    piprop[t]=0.0; pi2prop[t]=0.0; rhoprop[t]=0.0; rho2prop[t]=0.0;
    nlpiprop[t]=0.0; nlpi2prop[t]=0.0;
    ckpiprop[t]=0.0; ckpi2prop[t]=0.0;
    barprop[t]=0.0; delprop[t]=0.0; ckbarprop[t]=0.0;
  }

  vmass_x2 = 2.*vmass;
  cgn=0;

  /* Fix TUP Coulomb gauge - gauge links only*/
  rephase( OFF );
  gaugefix(TUP,(Real)1.8,500,(Real)GAUGE_FIX_TOL);
  rephase( ON );
#ifdef FN
  invalidate_all_ferm_links(&fn_links);
#endif

  /* Unlike spectrum.c, here we calculate only with wall sources */
  for(t_source=source_start, isrc=0; t_source<2*nt && isrc < n_sources;
        ++isrc, t_source += source_inc ) {
      
      /* Only work for even source slices */
      if( t_source%2 != 0 ){
	printf("DUMMY:  Use even time slices for nl_spectrum()\n");
	terminate(0);
      }

      /* Compute propagator from even wall sites */
      /* Sources are normalized to 1/8 to make them comparable to */
      /* propagators from a wall with ones on the cube origin. */
      /* Put result in propmat */
      
      for(icol=0; icol<3; icol++) {
	  
	  /* initialize temp1 and temp2 */
	  clear_latvec( temp1, EVEN);
	  clear_latvec( temp2, EVEN);
	  
	  for(x=0;x<nx;x++)for(y=0;y<ny;y++)for(z=0;z<nz;z++) {
	      if((x+y+z) % 2 == 0) {
		  if( node_number(x,y,z,t_source) != mynode() )continue;
		  i=node_index(x,y,z,t_source);
		  ((su3_vector *)(F_PT(&lattice[i],temp1)))->c[icol].real = 
		    -0.25;
		}
	    }
	  
	  /* do a C.G. */
	  load_ferm_links(&fn_links);
	  cgn += congrad(niter,rsqprop,EVEN,&finalrsq, &fn_links);
	  /* Multiply by -Madjoint */
	  dslash_site( temp2, temp2, ODD, &fn_links);
	  scalar_mult_latvec( temp2, -vmass_x2, temp2, EVEN);
	  
	  /* fill the hadron matrix */
	  copy_latvec( temp2, F_OFFSET(propmat[icol]), EVENANDODD);
	} /* end loop on icol */
      
      
      /* Compute propagator from odd wall sites */
      /* Put result in propmat2 */
      
      for(icol=0; icol<3; icol++) {
	  
	  /* initialize temp1 and temp2 */
	  clear_latvec( temp1, ODD);
	  clear_latvec( temp2, ODD);
	  for(x=0;x<nx;x++)for(y=0;y<ny;y++)for(z=0;z<nz;z++) {
	      if((x+y+z) % 2 == 1) {
		  if( node_number(x,y,z,t_source) != mynode() )continue;
		  i=node_index(x,y,z,t_source);
		  ((su3_vector *)(F_PT(&lattice[i],temp1)))->c[icol].real = 
		    -0.25;
		}
	    }
	  
	  /* do a C.G. */
	  load_ferm_links(&fn_links);
	  cgn += congrad(niter,rsqprop,ODD,&finalrsq,&fn_links);
	  /* Multiply by -Madjoint */
	  dslash_site( temp2, temp2, EVEN, &fn_links);
	  scalar_mult_latvec( temp2, -vmass_x2, temp2, ODD);
	  
	  /* fill the hadron matrix */
	  copy_latvec( temp2, F_OFFSET(propmat2[icol]), EVENANDODD);
	} /* end loop on icol */
      
      /* cgn now gives the sum for both inversions */
      
      
      /* measure the meson propagator for the E wall source */
      for(t=0; t<nt; t++) {
	  /* define the time value offset t from t_source */
	  t_off = (t+t_source)%nt;
	  
	  for(x=0;x<nx;x++)for(y=0;y<ny;y++)for(z=0;z<nz;z++)
	    for(icol=0;icol<3;icol++) {
		if( node_number(x,y,z,t_off) != mynode() )continue;
		i=node_index(x,y,z,t_off);
		cc = su3_dot( &lattice[i].propmat[icol],
			     &lattice[i].propmat[icol] );
		
		piprop[t] += cc.real;
		/* (rhoprop and rho2prop are not generated by this source) */
		
		if( (x+y+z)%2==0)pi2prop[t] += cc.real;
		else	     pi2prop[t] -= cc.real;
		
	      }
	  
	} /* nt-loop */
      
      /* measure the baryon propagator for the E wall source */
      for(t=0; t<nt; t++) {
	  /* define the time value offset t from t_source */
	  t_off = (t+t_source)%nt;
	  
	  for(x=0;x<nx;x+=2)for(y=0;y<ny;y+=2)for(z=0;z<nz;z+=2) {
	      if( node_number(x,y,z,t_off) != mynode() )continue;
	      i=node_index(x,y,z,t_off);
	      cc = det_su3( (su3_matrix *)(lattice[i].propmat) );
	      barprop[t] += cc.real;
	  }
	  
	  /* must get sign right.  This looks to see if we have
	     wrapped around the lattice.  "t" is the distance
	     from the source to the measurement, so we are
	     trying to find out if t_source+t is greater than
	     or equal to nt. */
	  if( (((t+t_source)/nt-t_source/nt)%2) == 1 )barprop[t] *= -1.0;
	  /* change sign because antiperiodic b.c.  sink point
	     should really be in a copy of the lattice */
	} /* nt-loop */
      
      
      /* Measure nonlocal (and some local for checking) propagators    */
      /* These propagators include the delta and some nonlocal mesons  */
      /* The method for the delta is described in M.F.L. Golterman and */
      /* J. Smit, Nucl. Phys. B 255, 328 (1985)                        */
      /* Equation (6.3) defines the sink operator for the delta        */
      /* The method for the mesons is described in M.F.L. Golterman    */
      /* Nucl. Phys. B 273, 663 (1986)                                 */
      /* The treatment of the source wall is described in Gupta,       */
      /* Guralnik, Kilcup, and Sharpe, (GGKS) NSF-ITP-90-172 (1990)    */
      /* To get the delta propagator, we take the "q" propagator       */
      /* matrices for each of the wall colors and antisymmetrize over  */
      /* wall color as well as s                    */
      
      /* First construct the "q" and "o" propagators                   */
      /* Put q = E + O in propmat and o = E - O in propmat2 */
      
      FORALLSITES(i,s) {
	  for(icol=0; icol<3; icol++) {
	      add_su3_vector (&(s->propmat[icol]), &(s->propmat2[icol]), 
			      (su3_vector *)(s->tempmat1.e[icol]) );
	      sub_su3_vector (&(s->propmat[icol]), &(s->propmat2[icol]), 
			      &(s->propmat2[icol]) );
	      su3vec_copy( (su3_vector *)(s->tempmat1.e[icol]),
		&(s->propmat[icol]) );
	    }
	}
      
      
      
      /* Next gather the propagators in preparation for calculating   */
      /* shifted propagators Dq and Do                                */
      
      FORALLUPDIRBUT(TUP,dir) {
	  /* Start bringing "q" = propmat from forward sites    */
	  
	  mtag[dir] = start_gather_site(F_OFFSET(propmat[0]), 
		   sizeof(su3_matrix), dir, EVENANDODD, gen_pt[dir]);
	  
	  /* Start bringing "q" from backward neighbors       */
	  
	  mtag[dir+4] = start_gather_site(F_OFFSET(propmat[0]), 
		   sizeof(su3_matrix), OPP_DIR(dir), EVENANDODD,
		   gen_pt[dir+4]);
	  wait_gather(mtag[dir]);
	  wait_gather(mtag[dir+4]);
	  
	  /* Start bringing "o" = propmat2 from forward sites   */
	  
	  mtag[8+dir] = start_gather_site(F_OFFSET(propmat2[0]), 
		   sizeof(su3_matrix), dir, EVENANDODD, gen_pt[8+dir]);
	  
	      /* Start bringing "o" from backward neighbors       */
	  
	  mtag[8+dir+4] = start_gather_site(F_OFFSET(propmat2[0]), 
		    sizeof(su3_matrix), OPP_DIR(dir), EVENANDODD,
		    gen_pt[8+dir+4]);
	  wait_gather(mtag[8+dir]);
	  wait_gather(mtag[8+dir+4]);
	  
	}
      
      
      /* Calculate and dump delta propagator */
      for(t=0; t<nt; t++) {
	  /* define the time value offset t from t_source */
	  t_off = (t+t_source)%nt;
	  
	  /* Calculate contribution for each permutation of source color */
	  delta_prop (0,1,2, 1, t_off, &delprop[t]);
	  delta_prop (1,2,0, 1, t_off, &delprop[t]);
	  delta_prop (2,0,1, 1, t_off, &delprop[t]);
	  delta_prop (1,0,2,-1, t_off, &delprop[t]);
	  delta_prop (0,2,1,-1, t_off, &delprop[t]);
	  delta_prop (2,1,0,-1, t_off, &delprop[t]);
	  
	  if( (((t+t_source)/nt-t_source/nt)%2) == 1 ) delprop[t] *= -1;
	} /* nt-loop */
      
      /* Calculate the "q" source nucleon as a check */
      
      /* Calculate and dump nucleon check propagator */
      for(t=0; t<nt; t++) {
	  /* define the time value offset t from t_source */
	  t_off = (t+t_source)%nt;
	  
	  for(x=0;x<nx;x+=2)for(y=0;y<ny;y+=2)for(z=0;z<nz;z+=2) {
	      if( node_number(x,y,z,t_off) != mynode() )continue;
	      i=node_index(x,y,z,t_off);
	      /* The q propagator is in propmat */
	      cc = det_su3( (su3_matrix *)(lattice[i].propmat) );
	      ckbarprop[t] += cc.real;
	    }
	  
	  if( (((t+t_source)/nt-t_source/nt)%2) == 1 )ckbarprop[t]*= -1.0;
	  /* change sign because antiperiodic b.c.  sink point
	     should really be in a copy of the lattice */
	} /* nt-loop */
      
      /* Calculate nonlocal meson propagators and local check */
      for(t=0; t<nt; t++) {
	  /* Calculate two nonlocal pion propagators */
	  /* These are pi_1 and pi_1 tilde of Gupta et al */
	  /* Also calculate two local propagators as a check */
	  
	  /* define the time value offset t from t_source */
	  t_off = (t+t_source)%nt;
	  
	  nl_meson_prop(t_off,&nlpiprop[t],&nlpi2prop[t],&ckpiprop[t],
	     &ckpi2prop[t]);
	  
	} /* nt-loop */
      
      /* Clean up gathers */
      FORALLUPDIRBUT(TUP,dir) {
	  cleanup_gather(mtag[dir]);
	  cleanup_gather(mtag[dir+4]);
	  cleanup_gather(mtag[8+dir]);
	  cleanup_gather(mtag[8+dir+4]);
	}
Esempio n. 9
0
static void ks_multicg_reverse_field(	/* Return value is number of iterations taken */
    su3_vector *src,	/* source vector (type su3_vector) */
    su3_vector **psim,	/* solution vectors */
    ks_param *ksp,	/* KS parametes, including the offsets */
    int num_offsets,	/* number of offsets */
    quark_invert_control *qic,
    imp_ferm_links_t *fn      /* Storage for fermion links */
    )
{
    char myname[] = "ks_multicg_reverse_field";
    /* Site su3_vector's resid, cg_p and ttt are used as temporaies */
    register int i;
    register site *s;
    int iteration;	/* counter for iterations */
    int num_offsets_now; /* number of offsets still being worked on */
    double c1, c2, rsq, oldrsq, pkp;		/* pkp = cg_p.K.cg_p */
    double source_norm;	/* squared magnitude of source vector */
    double rsqstop;	/* stopping residual normalized by source norm */
    int l_parity=0;	/* parity we are currently doing */
    int l_otherparity=0; /* the other parity */
#ifdef FN
    msg_tag *tags1[16], *tags2[16];	/* tags for gathers to parity and opposite */
#endif
    int special_started;	/* 1 if dslash_special has been called */
    int j, j_low;
    Real *shifts, mass_low, msq_xm4;
    double *zeta_i, *zeta_im1, *zeta_ip1;
    double *beta_i, *beta_im1, *alpha;
    // su3_vector **pm;	/* vectors not involved in gathers */

    // Switch indices
    su3_vector **psim_rev; su3_vector *psim_space;
    su3_vector **pm_rev; su3_vector *pm_space;

    /* Unpack structure */
    /* We don't restart this algorithm, so we adopt the convention of
       taking the product here */
    int niter        = qic->max*qic->nrestart;
    Real rsqmin      = qic->resid * qic->resid;    /* desired squared residual - 
					 normalized as sqrt(r*r)/sqrt(src_e*src_e) */
    int parity       = qic->parity;   /* EVEN, ODD */
    
/* Timing */
#ifdef CGTIME
    double dtimec;
#endif
    double nflop;

    qic->final_iters = 0;
    qic->final_restart = 0;

    //#if FERM_ACTION == HISQ
    //    fn->hl.current_X_set = 0;
    //    restore_fn_links(fn);
    //#endif
    if( num_offsets==0 )return;

    if(fn == NULL){
      printf("%s(%d): Called with NULL fn\n", myname, this_node);
      terminate(1);
    }

    // Switch indices
    psim_rev = (su3_vector **)malloc( sizeof(su3_vector *)*sites_on_node );
    psim_space = (su3_vector *)malloc( sizeof(su3_vector)*sites_on_node*num_offsets );
    pm_rev = (su3_vector **)malloc( sizeof(su3_vector *)*sites_on_node );
    pm_space = (su3_vector *)malloc( sizeof(su3_vector)*sites_on_node*num_offsets );
    if( psim_space == NULL || pm_space == NULL){printf("%s: NO ROOM!\n",myname); exit(0); }
    for( i=0; i<sites_on_node; i++ ){
	psim_rev[i] = &(psim_space[num_offsets*i]);
	pm_rev[i] = &(pm_space[num_offsets*i]);
	for( j=0; j<num_offsets; j++){
	    psim_rev[i][j] = psim[j][i];
	}
    }

/* debug */
#ifdef CGTIME
    dtimec = -dclock(); 
#endif

    nflop = 1205 + 15*num_offsets;
    if(parity==EVENANDODD)nflop *=2;
	
    special_started = 0;
    /* if we want both parities, we will do even first. */
    switch(parity){
	case(EVEN): l_parity=EVEN; l_otherparity=ODD; break;
	case(ODD):  l_parity=ODD; l_otherparity=EVEN; break;
	case(EVENANDODD):  l_parity=EVEN; l_otherparity=ODD; break;
    }

    shifts = (Real *)malloc(num_offsets*sizeof(Real));
    zeta_i = (double *)malloc(num_offsets*sizeof(double));
    zeta_im1 = (double *)malloc(num_offsets*sizeof(double));
    zeta_ip1 = (double *)malloc(num_offsets*sizeof(double));
    beta_i = (double *)malloc(num_offsets*sizeof(double));
    beta_im1 = (double *)malloc(num_offsets*sizeof(double));
    alpha = (double *)malloc(num_offsets*sizeof(double));

    //pm = (su3_vector **)malloc(num_offsets*sizeof(su3_vector *));
    mass_low = 1.0e+20;
    j_low = -1;
    for(j=0;j<num_offsets;j++){
	shifts[j] = ksp[j].offset;
	if (ksp[j].offset < mass_low){
	    mass_low = ksp[j].offset;
	    j_low = j;
	}
    }
    for(j=0;j<num_offsets;j++) if(j!=j_low){
	//pm[j] = (su3_vector *)malloc(sites_on_node*sizeof(su3_vector));
	shifts[j] -= shifts[j_low];
    }
    msq_xm4 = -shifts[j_low];


    iteration = 0;

#define PAD 0
    /* now we can allocate temporary variables and copy then */
    /* PAD may be used to avoid cache thrashing */
    if(first_multicongrad) {
      ttt = (su3_vector *) malloc((sites_on_node+PAD)*sizeof(su3_vector));
      cg_p = (su3_vector *) malloc((sites_on_node+PAD)*sizeof(su3_vector));
      resid = (su3_vector *) malloc((sites_on_node+PAD)*sizeof(su3_vector));
      first_multicongrad = 0;
    }

#ifdef CGTIME
    dtimec = -dclock(); 
#endif



    /* initialization process */
    start:
#ifdef FN
	if(special_started==1) {        /* clean up gathers */
	    cleanup_gathers(tags1, tags2);
	    special_started = 0;
	}
#endif
	num_offsets_now = num_offsets;
	source_norm = 0.0;
	FORSOMEPARITY(i,s,l_parity){
	    source_norm += (double) magsq_su3vec( src+i );
	    su3vec_copy( src+i, &(resid[i]));
	    su3vec_copy(&(resid[i]), &(cg_p[i]));
	    clearvec(&(psim_rev[i][j_low]));
	    for(j=0;j<num_offsets;j++) if(j!=j_low){
		clearvec(&(psim_rev[i][j]));
		su3vec_copy(&(resid[i]), &(pm_rev[i][j]));
	    }
	} END_LOOP;
Esempio n. 10
0
 // copy odd sites into lambda3
 FORODDSITES(i,s){
   su3vec_copy(&(s->tempvec0), (su3_vector *)F_PT(s,off[3]));
 }