Open eunnieverse opened 9 years ago
The difficulty is that LUFactorize() creates some internal state that gets stored inside the HMatrix class but is not written to disk by the Export...() routines. In principle this could be rectified by modifying the Export() routines to write the extra state, although this would clutter the .hdf5 files.
Here is a somewhat tortured workaround.
M = (an HMatrix created somehow)
int N=M->NR;
M->LUFactorize();
ipivVector=new HVector(N);
for(int n=0; n<N; n++)
ipivVector->SetEntry(n, (double) (M->ipiv[n])) ;
M->ExportToHDF5(Context,"M");
ipivVector->ExportToHDF5(Context,"ipiv");
delete ipivVector;
M = new HMatrix("MyFile.hdf5","M");
int N=M->NR;
ipivVector=new HVector("MyFile.hdf5","ipiv");
M->ipiv=(int *)mallocEC(N*sizeof(int));
for(int n=0; n<N; n++)
M->ipiv[n]=(int)(ipivVector->GetEntryD(n));
delete ipivVector;
I am importing a Hmatrix from a HDF5 file that has already been LUFactorized. LUSolve() currently requires that LUFactorize() be run again, which is double work. It would help if this step can be skipped.