I am performing a finite-precision operation on a matrix A which I know precisely; call the result B. The operation is taking the square root by B = MatrixPower[A,1/2], but it's not quite relevant. The point is that the form of A is such that the output will contain a lot of entries equal to 0, simply because A has a lot of invariant subspaces spanned by the standard base vectors.

I would like to see resulting matrix is like: in the first approximation it interests me how many non-zero entries it has and where. The problem is, the entries of B which are supposed to be 0 come out as small reals of the type $1.234...\times 10^{-10}$. I've tried applying N to B with some modest requirement on precision, but this does not seem to help. Ideally, I would like to set all entries of B which are approximately 0 to precisely 0. Any help would be appreciated.

P.S. It just occurred to me that I can take a function f that maps small numbers to 0, and is identity otherwise, and apply it to B element-wise. But there should be a more elegant solution, it seems to me.

Mathematica is a registered trademark of Wolfram Research, Inc. While the mark is used herein with the limited permission of Wolfram Research, Stack Exchange and this site disclaim all affiliation therewith.