[ADMB Users] What is the 3D version of save_dvar_matrix_position() and relatives?

dave fournier davef at otter-rsch.com
Sat Aug 10 09:08:47 PDT 2013


Anyway still extant.  Perhaps this sort of stuff is a good topic for the 
workshop.


   The easiest, but not so efficient solution is to use the fact that 
if  T is a dvar3_array,
then  T(i) is a dvar_matrix.  This enables you to use the dvar_matrix 
functions. so something like

      int mmin=T.indexmin();
      int mmax=T.indexmax();

      for (int i=mmin;i<=mmax;i++)
      {
         T(i).save_dvar_matrix_position();
      }

To get the stuff back you need to reverse the order because this is a stack.


      int mmin=T.indexmin();
      int mmax=T.indexmax();

      for (int i=mmax;i>=mmin;i--)
      {
         dvar_matrix_position Ti_pos=restore_dvar_matrix_position()

        //  Now do whatever with Ti_pos

      }

also you should put a stack identifer string into the code to check that
things are being written and read as you expect.






More information about the Users mailing list