The coarse grid matrix is calculated via RAP where R,P are the restriction and interpolation matrix,respectively.By checking a typical MG algorithm
I want to ask how to calculate efficiently coarse grid matrix in each MG iteration?Isn't it a computational cost to calulate RAP every time until you reach the coarsest level?And why in the above code A is not passed as a parameter in the MG function since we need coarse grid matrix in each level?Somewhere I saw that for 1D Poisson model the coefficients of coarse grid matrix is the same with one on the finer multiplied by 1/4h^2,is this holds for every case?