I have not tested it but I have some if these magnets from before, and they are so strong I can barely remove them from a metal surface with my fingers. I fully expect they'll be perfect for keeping the carpet in place.
Here's one link, but you can search Amazon for "Neodymium magnets" and pick whatever you like. I personally like these rectangular ones.
https://www.amazon.com/DIYMAG-Neodym...ateway&sr=8-17