/* -*- gp-script -*- */ \\% Round matrix entries if close to an integer. \\ Author: Joerg Arndt \\ License: GPL version 3 or later \\ online at http://www.jjj.de/pari/ \\ version: 2014-October-16 (18:31) matchop(m, eps=1e-15)= { /* matrix enries closer than eps to the next integer are round()-ed */ my(nr, nc, v); nr = matsize(m)[1]; nc = matsize(m)[2]; for (r=1, nr, for (c=1, nc, rnd = round(m[r,c]); if ( abs(m[r,c]-rnd)