ReadBinarySparseMatrix_DKE

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 /*Reads Binary Sparse Matrices as written by writeBinarySparseMat_mex_c*/
0002 
0003 #include <stdlib.h>
0004 #include <stdio.h>
0005 #include "Fokker_Planck_DKE_loop.h"
0006 
0007 void ReadBinarySparseMatrix_DKE(char* file,struct SparseMatrix *A)
0008 {
0009 FILE* TENSOR;
0010 int i;
0011 int cookie;
0012 /*fprintf(stdout,"Opening\n");*/
0013 TENSOR=fopen(file,"r");
0014 
0015 /*fprintf(stdout,"Reading cookie\n");*/
0016 fread(&cookie,sizeof(int),1,TENSOR);
0017 
0018 /*fprintf(stdout,"reading A m\n");*/
0019 fread(&((*A).m),sizeof(int),1,TENSOR);
0020 
0021 /*fprintf(stdout,"reading A n\n");*/
0022 fread(&((*A).n),sizeof(int),1,TENSOR);
0023 
0024 /*fprintf(stdout,"reading A nnz\n");*/
0025 fread((&(*A).nnz),sizeof(int),1,TENSOR);
0026 
0027 (*A).jc=malloc((*A).m*sizeof(int));
0028 fread((*A).jc,sizeof(int),((*A).n+1),TENSOR);
0029 
0030 (*A).ir=malloc((*A).nnz*sizeof(int));
0031 fread(((*A).ir),sizeof(int),(*A).nnz,TENSOR);
0032 
0033 (*A).vals=malloc((*A).nnz*sizeof(DOUBLE));
0034 fread(((*A).vals),sizeof(DOUBLE),(*A).nnz,TENSOR);
0035 
0036 /*fprintf(stdout,"%i \t", ((*A).m));
0037 fprintf(stdout,"%i \t", ((*A).n));
0038 fprintf(stdout,"%i \t", ((*A).nnz));*/
0039 
0040 fclose(TENSOR);
0041 /*fprintf(stdout,"end read\n");*/
0042 }

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