EVSL  1.1.0
EigenValues Slicing Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
cs_pinv.c
Go to the documentation of this file.
1 #include "cs.h"
2 /* pinv = p', or p = pinv' */
3 CS_INT *cs_pinv (CS_INT const *p, CS_INT n)
4 {
5  CS_INT k, *pinv ;
6  if (!p) return (NULL) ; /* p = NULL denotes identity */
7  pinv = cs_malloc (n, sizeof (CS_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 }
CS_INT * cs_pinv(CS_INT const *p, CS_INT n)
Definition: cs_pinv.c:3
#define CS_INT
Definition: cs.h:627
void * cs_malloc(CS_INT n, size_t size)
Definition: cs_malloc.c:10