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 = (int*) 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 }


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 11:58:04