cs_pinv.c
Go to the documentation of this file.
00001 #include "cs.h"
00002 /* pinv = p', or p = pinv' */
00003 int *cs_pinv (int const *p, int n)
00004 {
00005     int k, *pinv ;
00006     if (!p) return (NULL) ;                     /* p = NULL denotes identity */
00007     pinv = cs_malloc (n, sizeof (int)) ;        /* allocate result */
00008     if (!pinv) return (NULL) ;                  /* out of memory */
00009     for (k = 0 ; k < n ; k++) pinv [p [k]] = k ;/* invert the permutation */
00010     return (pinv) ;                             /* return result */
00011 }


hogman_minimal
Author(s): Maintained by Juergen Sturm
autogenerated on Mon Oct 6 2014 00:06:58