invrse.c

来自「http://www.math.tu-berlin.de/~bolle/SPAR」· C语言 代码 · 共 18 行

C
18 行
字号
#include <sparspak.h>/*****************************************************************************//* 'invrse' computes the inverse permutation of the permuation vector 'perm',*//* i.e. if 1,2,...,n are mapped onto perm[1],perm[2],...,perm[n], then       *//* invp[perm[1]],invp[perm[2],...,invp[perm[n]] are mapped back to 1,2,...,n *//* In C, 'perm, invp' have SUBSCRIPTS 0,1,2,...,*n-1, while the components of*//* 'perm','invp' have CONTENTS between 1 and *n.                             *//*****************************************************************************/void invrse(int *n, int *perm, int *invp){   int   i;   for (i=0; i<*n; i++)       invp[perm[i]-1]=i+1;} /* end invrse */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?