text: #include "cs.h"
  /* pinv = p', or p = pinv' */
  int *cs_pinv (int const *p, int n)
  {
      int k, *pinv ;
      if (!p) return (NULL) ;                     /* p = NULL denotes identity */
      pinv = (int*) cs_malloc (n, sizeof (int)) ;        /* allocate result */
      if (!pinv) return (NULL) ;                  /* out of memory */
      for (k = 0 ; k < n ; k++) pinv [p [k]] = k ;/* invert the permutation */
      return (pinv) ;                             /* return result */
  }
  