Functions

ctoms380.c File Reference

#include "problem.h"
Include dependency graph for ctoms380.c:

Go to the source code of this file.

Functions

void ctrans_ (char *A0, int M, int N, int MN, int *MOVE0, int IWRK, int IOK)
void dtrans_ (double *A0, int M, int N, int MN, int *MOVE0, int IWRK, int IOK)
void strans_ (float *A0, int M, int N, int MN, int *MOVE0, int IWRK, int IOK)
void itrans_ (int *A0, int M, int N, int MN, int *MOVE0, int IWRK, int IOK)
void dctrans_ (gs_dcomplex *A0, int M, int N, int MN, int *MOVE0, int IWRK, int IOK)
void sctrans_ (gs_scomplex *A0, int M, int N, int MN, int *MOVE0, int IWRK, int IOK)

Function Documentation

void ctrans_ ( char *  A0,
int  M,
int  N,
int  MN,
int*  MOVE0,
int  IWRK,
int  IOK 
)

Definition at line 6 of file ctoms380.c.

{
  char B;
  char *A = A0--;       /* Makes this 1 indexed */
  int *MOVE = MOVE0--;
  int NCOUNT,M2,I,IA,IB,KMI,K,MAX,I1,I2,N1,J1,J;
  
/* C A IS A ONE-DIMENSIONAL ARRAY OF LENGTH MN=M*N, WHICH */
/* C CONTAINS THE M BY N MATRIX TO BE TRANSPOSED (STORED */
/* C COLUMNWISE).MOVE IS A ONE-DIMENSIONAL ARRAY OF LENGTH IWRK */
/* C USED TO STORE INFORMATION TO SPEED UP THE PROCESS. THE */
/* C VALUE IWRK=(M+N)/2 IS RECOMMENDED. IOK INDICATES THE */
/* C SUCCESS OR FAILURE OF THE ROUTINE. */
/* C NORMAL RETURN IOK=0 */
/* C ERRORS           IOK=-1, MN NOT EQUAL TO M*N. */
/* C                  IOK=-2, IWRK NEGATIVE OR ZERO. */
/* C                  IOK.GT.0, (SHOULD NEVER OCCUR). IN THIS CASE */
/* C WE SET IOK EQUAL TO THE FINAL VALUE OF I WHEN THE SEARCH */
/* C IS COMPLETED BUT SOME LOOPS HAVE NOT BEEN MOVED. */
/*       DIMENSION A(MN),MOVE(IWRK) */
/* C CHECK ARGUMENTS AND INITIALISE */
  if (M < 2 || N < 2) goto label60;
  if (MN != M*N) goto label92;
  if (IWRK < 1) goto label93;
  if (M == N) goto label70;
  NCOUNT=2;
  M2=M-2;
  for(I=1; I<=IWRK; I++) 
    MOVE[I] = 0;
  if (M2 < 1) goto label12;
/* C COUNT NUMBER,NCOUNT, OF SINGLE POINTS. */
  for (IA=1; IA<=M2; IA++) {
    IB = IA*(N-1)/(M-1);
    if (IA*(N-1) != IB*(M-1)) goto label11;
    NCOUNT=NCOUNT+1;
    I=IA*N+IB;
    if (I > IWRK) goto label11;
    MOVE[I]=1;
  label11: 
    continue;
  }
 label12:
/* C SET INITIAL VALUES FOR SEARCH. */
    K=MN-1;
    KMI=K-1;
    MAX=MN;
    I=1;
/* C AT LEAST ONE LOOP MUST BE RE-ARRANGED. */
    goto label30;
/* C SEARCH FOR LOOPS TO BE REARRANGED. */
 label20:
    MAX=K-I;
    I=I+1;
    KMI=K-I;
    if (I > MAX) goto label90;
    if (I > IWRK) goto label21;
    if (MOVE[I] < 1) goto label30;
    goto label20;
 label21:
    if (I == M*I-K*(I/N)) goto label20;
    I1=I;
 label22:
    I2=M*I1-K*(I1/N);
    if (I2 <= I || I2 >= MAX) goto label23;
    I1=I2;
    goto label22;
 label23:
    if (I2 != I) goto label20;
/* C REARRANGE ELEMENTS OF A LOOP. */
 label30:
    I1=I;
 label31:
    B=A[I1+1];
 label32:
    I2=M*I1-K*(I1/N);
    if (I1 <= IWRK) MOVE[I1]=2;
 /*label33:*/
    NCOUNT=NCOUNT+1;
    if (I2 == I || I2 >= KMI) goto label35;
 label34:
    A[I1+1]=A[I2+1];
    I1=I2;
    goto label32;
 label35:
    if (MAX == KMI || I2 == I) goto label41;
    MAX=KMI;
    goto label34;
/* C TEST FOR SYMMETRIC PAIR OF LOOPS. */
 label41:
    A[I1+1]=B;
    if (NCOUNT >= MN) goto label60;
    if (I2 == MAX || MAX == KMI) goto label20;
    MAX=KMI;
    I1=MAX;
    goto label31;
/* C NORMAL RETURN. */
 label60:
    IOK=0;
    return;
/* C IF MATRIX IS SQUARE, EXCHANGE ELEMENTS A(I,J) AND A(J,I). */
 label70:
    N1=N-1;
    for (I=1; I<=N1; I++) {
      J1=I+1;
      for (J=J1; J<=N; J++) {
    I1=I+(J-1)*N;
    I2=J+(I-1)*M;
    B=A[I1];
    A[I1]=A[I2];
    A[I2]=B;
      }
    }
    goto label60;
/* C ERROR RETURNS. */
 label90:
    IOK=I;
 label91:
    return;
 label92:
    IOK=-1;
    goto label91;
 label93:
    IOK=-2;
    goto label91;
}

Here is the caller graph for this function:

void dctrans_ ( gs_dcomplex *  A0,
int  M,
int  N,
int  MN,
int*  MOVE0,
int  IWRK,
int  IOK 
)

Definition at line 543 of file ctoms380.c.

{
  gs_dcomplex B;
  gs_dcomplex *A = A0--;        /* Makes this 1 indexed */
  int *MOVE = MOVE0--;
  int NCOUNT,M2,I,IA,IB,KMI,K,MAX,I1,I2,N1,J1,J;
  
/* C A IS A ONE-DIMENSIONAL ARRAY OF LENGTH MN=M*N, WHICH */
/* C CONTAINS THE M BY N MATRIX TO BE TRANSPOSED (STORED */
/* C COLUMNWISE).MOVE IS A ONE-DIMENSIONAL ARRAY OF LENGTH IWRK */
/* C USED TO STORE INFORMATION TO SPEED UP THE PROCESS. THE */
/* C VALUE IWRK=(M+N)/2 IS RECOMMENDED. IOK INDICATES THE */
/* C SUCCESS OR FAILURE OF THE ROUTINE. */
/* C NORMAL RETURN IOK=0 */
/* C ERRORS           IOK=-1, MN NOT EQUAL TO M*N. */
/* C                  IOK=-2, IWRK NEGATIVE OR ZERO. */
/* C                  IOK.GT.0, (SHOULD NEVER OCCUR). IN THIS CASE */
/* C WE SET IOK EQUAL TO THE FINAL VALUE OF I WHEN THE SEARCH */
/* C IS COMPLETED BUT SOME LOOPS HAVE NOT BEEN MOVED. */
/*       DIMENSION A(MN),MOVE(IWRK) */
/* C CHECK ARGUMENTS AND INITIALISE */
  if (M < 2 || N < 2) goto label60;
  if (MN != M*N) goto label92;
  if (IWRK < 1) goto label93;
  if (M == N) goto label70;
  NCOUNT=2;
  M2=M-2;
  for(I=1; I<=IWRK; I++) 
    MOVE[I] = 0;
  if (M2 < 1) goto label12;
/* C COUNT NUMBER,NCOUNT, OF SINGLE POINTS. */
  for (IA=1; IA<=M2; IA++) {
    IB = IA*(N-1)/(M-1);
    if (IA*(N-1) != IB*(M-1)) goto label11;
    NCOUNT=NCOUNT+1;
    I=IA*N+IB;
    if (I > IWRK) goto label11;
    MOVE[I]=1;
  label11: 
    continue;
  }
 label12:
/* C SET INITIAL VALUES FOR SEARCH. */
    K=MN-1;
    KMI=K-1;
    MAX=MN;
    I=1;
/* C AT LEAST ONE LOOP MUST BE RE-ARRANGED. */
    goto label30;
/* C SEARCH FOR LOOPS TO BE REARRANGED. */
 label20:
    MAX=K-I;
    I=I+1;
    KMI=K-I;
    if (I > MAX) goto label90;
    if (I > IWRK) goto label21;
    if (MOVE[I] < 1) goto label30;
    goto label20;
 label21:
    if (I == M*I-K*(I/N)) goto label20;
    I1=I;
 label22:
    I2=M*I1-K*(I1/N);
    if (I2 <= I || I2 >= MAX) goto label23;
    I1=I2;
    goto label22;
 label23:
    if (I2 != I) goto label20;
/* C REARRANGE ELEMENTS OF A LOOP. */
 label30:
    I1=I;
 label31:
    B.r=A[I1+1].r;
    B.i=A[I1+1].i;
 label32:
    I2=M*I1-K*(I1/N);
    if (I1 <= IWRK) MOVE[I1]=2;
 /*label33:*/
    NCOUNT=NCOUNT+1;
    if (I2 == I || I2 >= KMI) goto label35;
 label34:
    A[I1+1].r=A[I2+1].r;
    A[I1+1].i=A[I2+1].i;
    I1=I2;
    goto label32;
 label35:
    if (MAX == KMI || I2 == I) goto label41;
    MAX=KMI;
    goto label34;
/* C TEST FOR SYMMETRIC PAIR OF LOOPS. */
 label41:
    A[I1+1].r=B.r;
    A[I1+1].i=B.i;
    if (NCOUNT >= MN) goto label60;
    if (I2 == MAX || MAX == KMI) goto label20;
    MAX=KMI;
    I1=MAX;
    goto label31;
/* C NORMAL RETURN. */
 label60:
    IOK=0;
    return;
/* C IF MATRIX IS SQUARE, EXCHANGE ELEMENTS A(I,J) AND A(J,I). */
 label70:
    N1=N-1;
    for (I=1; I<=N1; I++) {
      J1=I+1;
      for (J=J1; J<=N; J++) {
    I1=I+(J-1)*N;
    I2=J+(I-1)*M;
    B.r=A[I1].r;
    B.i=A[I1].i;
    A[I1].r=A[I2].r;
    A[I1].i=A[I2].i;
    A[I2].r=B.r;
    A[I2].i=B.i;
      }
    }
    goto label60;
/* C ERROR RETURNS. */
 label90:
    IOK=I;
 label91:
    return;
 label92:
    IOK=-1;
    goto label91;
 label93:
    IOK=-2;
    goto label91;
}

Here is the caller graph for this function:

void dtrans_ ( double *  A0,
int  M,
int  N,
int  MN,
int*  MOVE0,
int  IWRK,
int  IOK 
)

Definition at line 140 of file ctoms380.c.

{
  double B;
  double *A = A0--;     /* Makes this 1 indexed */
  int *MOVE = MOVE0--;
  int NCOUNT,M2,I,IA,IB,KMI,K,MAX,I1,I2,N1,J1,J;
  
/* C A IS A ONE-DIMENSIONAL ARRAY OF LENGTH MN=M*N, WHICH */
/* C CONTAINS THE M BY N MATRIX TO BE TRANSPOSED (STORED */
/* C COLUMNWISE).MOVE IS A ONE-DIMENSIONAL ARRAY OF LENGTH IWRK */
/* C USED TO STORE INFORMATION TO SPEED UP THE PROCESS. THE */
/* C VALUE IWRK=(M+N)/2 IS RECOMMENDED. IOK INDICATES THE */
/* C SUCCESS OR FAILURE OF THE ROUTINE. */
/* C NORMAL RETURN IOK=0 */
/* C ERRORS           IOK=-1, MN NOT EQUAL TO M*N. */
/* C                  IOK=-2, IWRK NEGATIVE OR ZERO. */
/* C                  IOK.GT.0, (SHOULD NEVER OCCUR). IN THIS CASE */
/* C WE SET IOK EQUAL TO THE FINAL VALUE OF I WHEN THE SEARCH */
/* C IS COMPLETED BUT SOME LOOPS HAVE NOT BEEN MOVED. */
/*       DIMENSION A(MN),MOVE(IWRK) */
/* C CHECK ARGUMENTS AND INITIALISE */
  if (M < 2 || N < 2) goto label60;
  if (MN != M*N) goto label92;
  if (IWRK < 1) goto label93;
  if (M == N) goto label70;
  NCOUNT=2;
  M2=M-2;
  for(I=1; I<=IWRK; I++) 
    MOVE[I] = 0;
  if (M2 < 1) goto label12;
/* C COUNT NUMBER,NCOUNT, OF SINGLE POINTS. */
  for (IA=1; IA<=M2; IA++) {
    IB = IA*(N-1)/(M-1);
    if (IA*(N-1) != IB*(M-1)) goto label11;
    NCOUNT=NCOUNT+1;
    I=IA*N+IB;
    if (I > IWRK) goto label11;
    MOVE[I]=1;
  label11: 
    continue;
  }
 label12:
/* C SET INITIAL VALUES FOR SEARCH. */
    K=MN-1;
    KMI=K-1;
    MAX=MN;
    I=1;
/* C AT LEAST ONE LOOP MUST BE RE-ARRANGED. */
    goto label30;
/* C SEARCH FOR LOOPS TO BE REARRANGED. */
 label20:
    MAX=K-I;
    I=I+1;
    KMI=K-I;
    if (I > MAX) goto label90;
    if (I > IWRK) goto label21;
    if (MOVE[I] < 1) goto label30;
    goto label20;
 label21:
    if (I == M*I-K*(I/N)) goto label20;
    I1=I;
 label22:
    I2=M*I1-K*(I1/N);
    if (I2 <= I || I2 >= MAX) goto label23;
    I1=I2;
    goto label22;
 label23:
    if (I2 != I) goto label20;
/* C REARRANGE ELEMENTS OF A LOOP. */
 label30:
    I1=I;
 label31:
    B=A[I1+1];
 label32:
    I2=M*I1-K*(I1/N);
    if (I1 <= IWRK) MOVE[I1]=2;
 /*label33:*/
    NCOUNT=NCOUNT+1;
    if (I2 == I || I2 >= KMI) goto label35;
 label34:
    A[I1+1]=A[I2+1];
    I1=I2;
    goto label32;
 label35:
    if (MAX == KMI || I2 == I) goto label41;
    MAX=KMI;
    goto label34;
/* C TEST FOR SYMMETRIC PAIR OF LOOPS. */
 label41:
    A[I1+1]=B;
    if (NCOUNT >= MN) goto label60;
    if (I2 == MAX || MAX == KMI) goto label20;
    MAX=KMI;
    I1=MAX;
    goto label31;
/* C NORMAL RETURN. */
 label60:
    IOK=0;
    return;
/* C IF MATRIX IS SQUARE, EXCHANGE ELEMENTS A(I,J) AND A(J,I). */
 label70:
    N1=N-1;
    for (I=1; I<=N1; I++) {
      J1=I+1;
      for (J=J1; J<=N; J++) {
    I1=I+(J-1)*N;
    I2=J+(I-1)*M;
    B=A[I1];
    A[I1]=A[I2];
    A[I2]=B;
      }
    }
    goto label60;
/* C ERROR RETURNS. */
 label90:
    IOK=I;
 label91:
    return;
 label92:
    IOK=-1;
    goto label91;
 label93:
    IOK=-2;
    goto label91;
}

Here is the caller graph for this function:

void itrans_ ( int *  A0,
int  M,
int  N,
int  MN,
int*  MOVE0,
int  IWRK,
int  IOK 
)

Definition at line 409 of file ctoms380.c.

{
  int B;
  int *A = A0--;        /* Makes this 1 indexed */
  int *MOVE = MOVE0--;
  int NCOUNT,M2,I,IA,IB,KMI,K,MAX,I1,I2,N1,J1,J;
  
/* C A IS A ONE-DIMENSIONAL ARRAY OF LENGTH MN=M*N, WHICH */
/* C CONTAINS THE M BY N MATRIX TO BE TRANSPOSED (STORED */
/* C COLUMNWISE).MOVE IS A ONE-DIMENSIONAL ARRAY OF LENGTH IWRK */
/* C USED TO STORE INFORMATION TO SPEED UP THE PROCESS. THE */
/* C VALUE IWRK=(M+N)/2 IS RECOMMENDED. IOK INDICATES THE */
/* C SUCCESS OR FAILURE OF THE ROUTINE. */
/* C NORMAL RETURN IOK=0 */
/* C ERRORS           IOK=-1, MN NOT EQUAL TO M*N. */
/* C                  IOK=-2, IWRK NEGATIVE OR ZERO. */
/* C                  IOK.GT.0, (SHOULD NEVER OCCUR). IN THIS CASE */
/* C WE SET IOK EQUAL TO THE FINAL VALUE OF I WHEN THE SEARCH */
/* C IS COMPLETED BUT SOME LOOPS HAVE NOT BEEN MOVED. */
/*       DIMENSION A(MN),MOVE(IWRK) */
/* C CHECK ARGUMENTS AND INITIALISE */
  if (M < 2 || N < 2) goto label60;
  if (MN != M*N) goto label92;
  if (IWRK < 1) goto label93;
  if (M == N) goto label70;
  NCOUNT=2;
  M2=M-2;
  for(I=1; I<=IWRK; I++) 
    MOVE[I] = 0;
  if (M2 < 1) goto label12;
/* C COUNT NUMBER,NCOUNT, OF SINGLE POINTS. */
  for (IA=1; IA<=M2; IA++) {
    IB = IA*(N-1)/(M-1);
    if (IA*(N-1) != IB*(M-1)) goto label11;
    NCOUNT=NCOUNT+1;
    I=IA*N+IB;
    if (I > IWRK) goto label11;
    MOVE[I]=1;
  label11: 
    continue;
  }
 label12:
/* C SET INITIAL VALUES FOR SEARCH. */
    K=MN-1;
    KMI=K-1;
    MAX=MN;
    I=1;
/* C AT LEAST ONE LOOP MUST BE RE-ARRANGED. */
    goto label30;
/* C SEARCH FOR LOOPS TO BE REARRANGED. */
 label20:
    MAX=K-I;
    I=I+1;
    KMI=K-I;
    if (I > MAX) goto label90;
    if (I > IWRK) goto label21;
    if (MOVE[I] < 1) goto label30;
    goto label20;
 label21:
    if (I == M*I-K*(I/N)) goto label20;
    I1=I;
 label22:
    I2=M*I1-K*(I1/N);
    if (I2 <= I || I2 >= MAX) goto label23;
    I1=I2;
    goto label22;
 label23:
    if (I2 != I) goto label20;
/* C REARRANGE ELEMENTS OF A LOOP. */
 label30:
    I1=I;
 label31:
    B=A[I1+1];
 label32:
    I2=M*I1-K*(I1/N);
    if (I1 <= IWRK) MOVE[I1]=2;
 /*label33:*/
    NCOUNT=NCOUNT+1;
    if (I2 == I || I2 >= KMI) goto label35;
 label34:
    A[I1+1]=A[I2+1];
    I1=I2;
    goto label32;
 label35:
    if (MAX == KMI || I2 == I) goto label41;
    MAX=KMI;
    goto label34;
/* C TEST FOR SYMMETRIC PAIR OF LOOPS. */
 label41:
    A[I1+1]=B;
    if (NCOUNT >= MN) goto label60;
    if (I2 == MAX || MAX == KMI) goto label20;
    MAX=KMI;
    I1=MAX;
    goto label31;
/* C NORMAL RETURN. */
 label60:
    IOK=0;
    return;
/* C IF MATRIX IS SQUARE, EXCHANGE ELEMENTS A(I,J) AND A(J,I). */
 label70:
    N1=N-1;
    for (I=1; I<=N1; I++) {
      J1=I+1;
      for (J=J1; J<=N; J++) {
    I1=I+(J-1)*N;
    I2=J+(I-1)*M;
    B=A[I1];
    A[I1]=A[I2];
    A[I2]=B;
      }
    }
    goto label60;
/* C ERROR RETURNS. */
 label90:
    IOK=I;
 label91:
    return;
 label92:
    IOK=-1;
    goto label91;
 label93:
    IOK=-2;
    goto label91;
}

Here is the caller graph for this function:

void sctrans_ ( gs_scomplex *  A0,
int  M,
int  N,
int  MN,
int*  MOVE0,
int  IWRK,
int  IOK 
)

Definition at line 682 of file ctoms380.c.

{
  gs_scomplex B;
  gs_scomplex *A = A0--;        /* Makes this 1 indexed */
  int *MOVE = MOVE0--;
  int NCOUNT,M2,I,IA,IB,KMI,K,MAX,I1,I2,N1,J1,J;
  
/* C A IS A ONE-DIMENSIONAL ARRAY OF LENGTH MN=M*N, WHICH */
/* C CONTAINS THE M BY N MATRIX TO BE TRANSPOSED (STORED */
/* C COLUMNWISE).MOVE IS A ONE-DIMENSIONAL ARRAY OF LENGTH IWRK */
/* C USED TO STORE INFORMATION TO SPEED UP THE PROCESS. THE */
/* C VALUE IWRK=(M+N)/2 IS RECOMMENDED. IOK INDICATES THE */
/* C SUCCESS OR FAILURE OF THE ROUTINE. */
/* C NORMAL RETURN IOK=0 */
/* C ERRORS           IOK=-1, MN NOT EQUAL TO M*N. */
/* C                  IOK=-2, IWRK NEGATIVE OR ZERO. */
/* C                  IOK.GT.0, (SHOULD NEVER OCCUR). IN THIS CASE */
/* C WE SET IOK EQUAL TO THE FINAL VALUE OF I WHEN THE SEARCH */
/* C IS COMPLETED BUT SOME LOOPS HAVE NOT BEEN MOVED. */
/*       DIMENSION A(MN),MOVE(IWRK) */
/* C CHECK ARGUMENTS AND INITIALISE */
  if (M < 2 || N < 2) goto label60;
  if (MN != M*N) goto label92;
  if (IWRK < 1) goto label93;
  if (M == N) goto label70;
  NCOUNT=2;
  M2=M-2;
  for(I=1; I<=IWRK; I++) 
    MOVE[I] = 0;
  if (M2 < 1) goto label12;
/* C COUNT NUMBER,NCOUNT, OF SINGLE POINTS. */
  for (IA=1; IA<=M2; IA++) {
    IB = IA*(N-1)/(M-1);
    if (IA*(N-1) != IB*(M-1)) goto label11;
    NCOUNT=NCOUNT+1;
    I=IA*N+IB;
    if (I > IWRK) goto label11;
    MOVE[I]=1;
  label11: 
    continue;
  }
 label12:
/* C SET INITIAL VALUES FOR SEARCH. */
    K=MN-1;
    KMI=K-1;
    MAX=MN;
    I=1;
/* C AT LEAST ONE LOOP MUST BE RE-ARRANGED. */
    goto label30;
/* C SEARCH FOR LOOPS TO BE REARRANGED. */
 label20:
    MAX=K-I;
    I=I+1;
    KMI=K-I;
    if (I > MAX) goto label90;
    if (I > IWRK) goto label21;
    if (MOVE[I] < 1) goto label30;
    goto label20;
 label21:
    if (I == M*I-K*(I/N)) goto label20;
    I1=I;
 label22:
    I2=M*I1-K*(I1/N);
    if (I2 <= I || I2 >= MAX) goto label23;
    I1=I2;
    goto label22;
 label23:
    if (I2 != I) goto label20;
/* C REARRANGE ELEMENTS OF A LOOP. */
 label30:
    I1=I;
 label31:
    B.r=A[I1+1].r;
    B.i=A[I1+1].i;
 label32:
    I2=M*I1-K*(I1/N);
    if (I1 <= IWRK) MOVE[I1]=2;
 /*label33:*/
    NCOUNT=NCOUNT+1;
    if (I2 == I || I2 >= KMI) goto label35;
 label34:
    A[I1+1].r=A[I2+1].r;
    A[I1+1].i=A[I2+1].i;
    I1=I2;
    goto label32;
 label35:
    if (MAX == KMI || I2 == I) goto label41;
    MAX=KMI;
    goto label34;
/* C TEST FOR SYMMETRIC PAIR OF LOOPS. */
 label41:
    A[I1+1].r=B.r;
    A[I1+1].i=B.i;
    if (NCOUNT >= MN) goto label60;
    if (I2 == MAX || MAX == KMI) goto label20;
    MAX=KMI;
    I1=MAX;
    goto label31;
/* C NORMAL RETURN. */
 label60:
    IOK=0;
    return;
/* C IF MATRIX IS SQUARE, EXCHANGE ELEMENTS A(I,J) AND A(J,I). */
 label70:
    N1=N-1;
    for (I=1; I<=N1; I++) {
      J1=I+1;
      for (J=J1; J<=N; J++) {
    I1=I+(J-1)*N;
    I2=J+(I-1)*M;
    B.r=A[I1].r;
    B.i=A[I1].i;
    A[I1].r=A[I2].r;
    A[I1].i=A[I2].i;
    A[I2].r=B.r;
    A[I2].i=B.i;
      }
    }
    goto label60;
/* C ERROR RETURNS. */
 label90:
    IOK=I;
 label91:
    return;
 label92:
    IOK=-1;
    goto label91;
 label93:
    IOK=-2;
    goto label91;
}

Here is the caller graph for this function:

void strans_ ( float *  A0,
int  M,
int  N,
int  MN,
int*  MOVE0,
int  IWRK,
int  IOK 
)

Definition at line 274 of file ctoms380.c.

{
  float B;
  float *A = A0--;      /* Makes this 1 indexed */
  int *MOVE = MOVE0--;
  int NCOUNT,M2,I,IA,IB,KMI,K,MAX,I1,I2,N1,J1,J;
  
/* C A IS A ONE-DIMENSIONAL ARRAY OF LENGTH MN=M*N, WHICH */
/* C CONTAINS THE M BY N MATRIX TO BE TRANSPOSED (STORED */
/* C COLUMNWISE).MOVE IS A ONE-DIMENSIONAL ARRAY OF LENGTH IWRK */
/* C USED TO STORE INFORMATION TO SPEED UP THE PROCESS. THE */
/* C VALUE IWRK=(M+N)/2 IS RECOMMENDED. IOK INDICATES THE */
/* C SUCCESS OR FAILURE OF THE ROUTINE. */
/* C NORMAL RETURN IOK=0 */
/* C ERRORS           IOK=-1, MN NOT EQUAL TO M*N. */
/* C                  IOK=-2, IWRK NEGATIVE OR ZERO. */
/* C                  IOK.GT.0, (SHOULD NEVER OCCUR). IN THIS CASE */
/* C WE SET IOK EQUAL TO THE FINAL VALUE OF I WHEN THE SEARCH */
/* C IS COMPLETED BUT SOME LOOPS HAVE NOT BEEN MOVED. */
/*       DIMENSION A(MN),MOVE(IWRK) */
/* C CHECK ARGUMENTS AND INITIALISE */
  if (M < 2 || N < 2) goto label60;
  if (MN != M*N) goto label92;
  if (IWRK < 1) goto label93;
  if (M == N) goto label70;
  NCOUNT=2;
  M2=M-2;
  for(I=1; I<=IWRK; I++) 
    MOVE[I] = 0;
  if (M2 < 1) goto label12;
/* C COUNT NUMBER,NCOUNT, OF SINGLE POINTS. */
  for (IA=1; IA<=M2; IA++) {
    IB = IA*(N-1)/(M-1);
    if (IA*(N-1) != IB*(M-1)) goto label11;
    NCOUNT=NCOUNT+1;
    I=IA*N+IB;
    if (I > IWRK) goto label11;
    MOVE[I]=1;
  label11: 
    continue;
  }
 label12:
/* C SET INITIAL VALUES FOR SEARCH. */
    K=MN-1;
    KMI=K-1;
    MAX=MN;
    I=1;
/* C AT LEAST ONE LOOP MUST BE RE-ARRANGED. */
    goto label30;
/* C SEARCH FOR LOOPS TO BE REARRANGED. */
 label20:
    MAX=K-I;
    I=I+1;
    KMI=K-I;
    if (I > MAX) goto label90;
    if (I > IWRK) goto label21;
    if (MOVE[I] < 1) goto label30;
    goto label20;
 label21:
    if (I == M*I-K*(I/N)) goto label20;
    I1=I;
 label22:
    I2=M*I1-K*(I1/N);
    if (I2 <= I || I2 >= MAX) goto label23;
    I1=I2;
    goto label22;
 label23:
    if (I2 != I) goto label20;
/* C REARRANGE ELEMENTS OF A LOOP. */
 label30:
    I1=I;
 label31:
    B=A[I1+1];
 label32:
    I2=M*I1-K*(I1/N);
    if (I1 <= IWRK) MOVE[I1]=2;
 /*label33:*/
    NCOUNT=NCOUNT+1;
    if (I2 == I || I2 >= KMI) goto label35;
 label34:
    A[I1+1]=A[I2+1];
    I1=I2;
    goto label32;
 label35:
    if (MAX == KMI || I2 == I) goto label41;
    MAX=KMI;
    goto label34;
/* C TEST FOR SYMMETRIC PAIR OF LOOPS. */
 label41:
    A[I1+1]=B;
    if (NCOUNT >= MN) goto label60;
    if (I2 == MAX || MAX == KMI) goto label20;
    MAX=KMI;
    I1=MAX;
    goto label31;
/* C NORMAL RETURN. */
 label60:
    IOK=0;
    return;
/* C IF MATRIX IS SQUARE, EXCHANGE ELEMENTS A(I,J) AND A(J,I). */
 label70:
    N1=N-1;
    for (I=1; I<=N1; I++) {
      J1=I+1;
      for (J=J1; J<=N; J++) {
    I1=I+(J-1)*N;
    I2=J+(I-1)*M;
    B=A[I1];
    A[I1]=A[I2];
    A[I2]=B;
      }
    }
    goto label60;
/* C ERROR RETURNS. */
 label90:
    IOK=I;
 label91:
    return;
 label92:
    IOK=-1;
    goto label91;
 label93:
    IOK=-2;
    goto label91;
}

Here is the caller graph for this function: