/************************************************************************************* Grid physics library, www.github.com/paboyle/Grid Source file: ./tests/debug/Test_mrhs_deflation.cc Copyright (C) 2026 Author: Peter Boyle This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See the full license in the file "LICENSE" in the top level distribution directory *************************************************************************************/ /* END LEGAL */ #include // MultiRHSDeflation: the D+1 multiRHS interface (one permutation pass each // way) must reproduce the vector-of-D-fields interface bit for bit up to // the summation order of the GEMMs. Random "eigenvectors" and values: the // deflation formula G = E (E^dag R)/lambda does not care that they are not // eigenpairs of anything. using namespace Grid; int main (int argc, char ** argv) { Grid_init(&argc,&argv); const int nbasis = 8; const int nev = 12; const int nrhs = 5; typedef iVector siteVector; typedef Lattice CoarseVector; // Unvectorised D and D+1 coarse grids, as MGCoarseGrids builds them Coordinate latt({1,4,4,4,4}); Coordinate simd({1,1,1,1,1}); Coordinate mpi = GridDefaultMpi(); Coordinate mpi5({1,mpi[0],mpi[1],mpi[2],mpi[3]}); GridCartesian Coarse5d(latt,simd,mpi5); Coordinate latt6({nrhs,1,4,4,4,4}); Coordinate simd6({1,1,1,1,1,1}); Coordinate mpi6({1,1,mpi[0],mpi[1],mpi[2],mpi[3]}); GridCartesian CoarseMrhs(latt6,simd6,mpi6); GridParallelRNG RNG(&Coarse5d); RNG.SeedFixedIntegers(std::vector({1,2,3,4})); std::vector evec(nev,&Coarse5d); std::vector eval(nev); for(int e=0;e src(nrhs,&Coarse5d), guess(nrhs,&Coarse5d); for(int r=0;r Deflator; Deflator.ImportEigenBasis(evec,eval); // Reference: the vector interface Deflator.DeflateSources(src,guess); // The D+1 interface on the same sources CoarseVector src_mrhs(&CoarseMrhs), guess_mrhs(&CoarseMrhs); for(int r=0;r