For the attached code, it computed withthe request=1:
According to the manual:
If request=1, the routine computes only values of the array ic of length m + 1, the memory for this array must be allocated beforehand.
In thecode, resmat, jresmat do not allocate the memory. Also, the sort is undefined, it should be a integer value.