transp.c

来自「NIST Handwriting OCR Testbed」· C语言 代码 · 共 31 行

C
31
字号
/*# proc: transpose_rect_matrix_s - transpose a rectangular matrix, float slower# proc:*/#include <stddef.h>transpose_rect_matrix_s(inp, ix, iy)float  *inp;int    ix, iy;{int  x, y;float *out, *ipt, *opt;/*      converts  ABCD    to    AEI in place with copy		*//*                EFGH          BFJ but not with pointer assign	*//*                IJKL          CGK				*//*                              DHL				*/   if ((out = (float *)malloc(ix * iy * sizeof(float))) == NULL)     fatalerr("transpose_rect_matrix_s", "space for duplicate", "malloc");   /* do the transpose into some local memory block */   for (x = 0, opt = out ; x < ix ; x++)      for (y = 0, ipt = inp + x ; y < iy ; y++)         *opt++ = *ipt, ipt += ix;   /* and copy the result back in to its original place */   memcpy(inp, out, ix*iy*sizeof(float));   free(out);}

⌨️ 快捷键说明

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