Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00011 #include <fvar.hpp>
00012
00013 #ifdef __TURBOC__
00014 #pragma hdrstop
00015 #endif
00016
00020 void imatrix::save_imatrix_value(void)
00021 {
00022 for (int i=rowmin();i<=rowmax();i++)
00023 {
00024 ((*this)(i).save_ivector_value());
00025 ((*this)(i).save_ivector_position());
00026 }
00027 }
00031 void imatrix::save_imatrix_position(void)
00032 {
00033 imatrix_position tmp(*this);
00034 size_t wsize=sizeof(int);
00035 size_t wsize1=sizeof(void*);
00036
00037 int min=rowmin();
00038 int max=rowmax();
00039 for (int i=min;i<=max;i++)
00040 {
00041 gradient_structure::get_fp()->fwrite(&(tmp.lb(i)),wsize);
00042 gradient_structure::get_fp()->fwrite(&(tmp.ub(i)),wsize);
00043 gradient_structure::get_fp()->fwrite(&(tmp.ptr(i)),wsize1);
00044 }
00045 gradient_structure::get_fp()->fwrite(&(tmp.row_min),wsize);
00046 gradient_structure::get_fp()->fwrite(&(tmp.row_max),wsize);
00047 }
00051 imatrix_position restore_imatrix_position(void)
00052 {
00053 int min;
00054 int max;
00055 gradient_structure::get_fp()->fread(&max,sizeof(int));
00056 gradient_structure::get_fp()->fread(&min,sizeof(int));
00057 imatrix_position tmp(min,max);
00058 for (int i=max;i>=min;i--)
00059 {
00060 gradient_structure::get_fp()->fread(&(tmp.ptr(i)),sizeof(void*));
00061 gradient_structure::get_fp()->fread(&(tmp.ub(i)),sizeof(int));
00062 gradient_structure::get_fp()->fread(&(tmp.lb(i)),sizeof(int));
00063 }
00064 return tmp;
00065 }
00070 imatrix restore_imatrix_value(const imatrix_position& mpos)
00071 {
00072
00073
00074 imatrix out(mpos);
00075 int min=out.rowmin();
00076 int max=out.rowmax();
00077 for (int i=max;i>=min;i--)
00078 {
00079 ivector_position vpos=restore_ivector_position();
00080 out(i)=restore_ivector_value(vpos);
00081 }
00082 return out;
00083 }