"Thomas Meinguet" <email@example.com> wrote in message <firstname.lastname@example.org>... > Thank you James. > > To prevent any cast issue at no operational cost I suggest to check, for sparse martices, whether nnz <= INT_MAX which in turn implies n < INT_MAX.
This will not work. nnz simply tells you how many non-zeros there are ... it doesn't tell you anything about their values, and it is their values that your are interested in. You could have nnz = 1 and at the same time that one index value could overflow an int.