cs_pinv.c
Go to the documentation of this file.
1 #include "cs.h"
2 /* pinv = p', or p = pinv' */
3 int *cs_pinv (int const *p, int n)
4 {
5  int k, *pinv ;
6  if (!p) return (NULL) ; /* p = NULL denotes identity */
7  pinv = (int*) cs_malloc (n, sizeof (int)) ; /* allocate result */
8  if (!pinv) return (NULL) ; /* out of memory */
9  for (k = 0 ; k < n ; k++) pinv [p [k]] = k ;/* invert the permutation */
10  return (pinv) ; /* return result */
11 }
int * cs_pinv(int const *p, int n)
Definition: cs_pinv.c:3
void * cs_malloc(int n, size_t size)
Definition: cs_malloc.c:10


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:34:31