Transpose_Vector

PURPOSE ^

C/C++ source

SYNOPSIS ^

C/C++ source

DESCRIPTION ^

C/C++ source

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 #include "Fokker_Planck_DKE_loop.h"
0002 #include <stdio.h>
0003 void Transpose_Vector(struct Tensor *A){
0004 /*Simple routine to make column vectors from row vectors and vice-versa*/
0005 
0006 /*check *A is a vector*/
0007 if((*A).sizedim[0]!=1 && (*A).sizedim[1]!=1){
0008 int i,j,dim;
0009 DOUBLE val;
0010 /*printf("A is a matrix\n");*/
0011    for(i=0;i<(*A).sizedim[0];i++){
0012       for(j=0;j<(*A).sizedim[1];j++){   
0013       val=(*A).vals[i+j*(*A).sizedim[0]];
0014       (*A).vals[i+j*(*A).sizedim[0]]=(*A).vals[i*(*A).sizedim[1]+j];
0015       (*A).sizedim[1]=val;
0016       }
0017     }
0018       (*A).sizedim[0]=dim;
0019       (*A).sizedim[0]=(*A).sizedim[1];
0020       (*A).sizedim[1]=dim;
0021 }
0022 
0023 else{
0024 int a=(*A).sizedim[0];
0025 (*A).sizedim[0]=(*A).sizedim[1];
0026 (*A).sizedim[1]=a;
0027 }
0028 }

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.