A method for the production of gastroretentive compact matrices for the controlled release of active substances and compact matrices thus obtained