📄 transp.c
字号:
/*# 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -