C/C++ source
0001 #include <stdio.h> 0002 #include <stdlib.h> 0003 #include "tensor.h" 0004 void Tensor_Save(char * file, struct Tensor A){ 0005 FILE * TENSOR; 0006 TENSOR=fopen(file,"w"); 0007 int cookie=1; 0008 fwrite(&(cookie),sizeof(int),1,TENSOR); 0009 fwrite(&(A.ndims),sizeof(int),1,TENSOR); 0010 fwrite(A.sizedim,sizeof(int),A.ndims,TENSOR); 0011 fwrite(&(A.size),sizeof(int),1,TENSOR); 0012 fwrite(A.vals,sizeof(DOUBLE),A.size,TENSOR); 0013 fclose(TENSOR); 0014 }