[ADMB Users] init_4darray

Alex Campbell ghostofsandy at gmail.com
Sat Apr 13 19:36:07 PDT 2013


Nice!

  init_int d1
  init_ivector d2vec(1,d1)
  init_int d3
  init_int d4
  !! int ld1=d1;
  !! int ld3=d3;
  !! int ld4=d4;
  init_4darray blah(1,ld1,1,d2vec,1,ld3,1,ld4)
  //!!cout << blah << endl;
  !!cout << blah(1,1,1,1) << " " << blah(1,1,1,2) << endl;
  !!cout << blah(1,1,2,1) << " " << blah(1,1,2,2) << endl;
  !!cout << blah(2,1,1,1) << " " << blah(2,1,1,2) << endl;
  !!cout << blah(2,1,2,1) << " " << blah(2,1,2,2) << endl;
  !!cout << blah(2,2,1,1) << " " << blah(2,2,1,2) << endl;
  !!cout << blah(2,2,2,1) << " " << blah(2,2,2,2) << endl;
  //should fail
  !!cout << blah(1,2,1,1) << endl;

dat file
2
1 2
2
2
1 2
3 4
5 6
7 8
9 10
11 12

output
1 2
3 4
5 6
7 8
9 10
11 12

exited abnormally


On Sun, Apr 14, 2013 at 11:47 AM, dave fournier <davef at otter-rsch.com>wrote:

>  On 13-04-13 05:32 PM, Alex Campbell wrote:
>
> I guess it wants a constructor.  In the meantime this might do it.
>
>
> DATA_SECTION
>
>   init_int d1
>   init_ivector d2vec(1,d1)
>   init_int d3
>   init_int d4
>  !! int ld1=d3;
>  !! int ld3=d3;
>  !! int ld4=d4;
>  init_4darray blah(1,ld1,1,d2vec,1,ld3,1,ld4)
>
>
>
>  Was passing on an issue from a friend, and lazily didn't try it myself.
> Of course now I try it it compiles fine, and he now tells me the second
> dimension is ragged. Trying myself, I'm finding
> init_int d1
> init_ivector d2vec(1,d1)
> init_int d3
> init_3darray blah(1,d1,1,d2vec,1,d3)
>
>  compiles fine, but
>
>  init_int d1
> init_ivector d2vec(1,d1)
> init_int d3
> init_int d4
> init_4darray blah(1,d1,1,d2vec,1,d3,1,d4)
>
>  does not. The first candidate for data_4array:allocate contains int args
> only, the other candidate has ad_integer args for the first two, and then
> const index_type& args thereafter. Not sure what an index_type is, but it
> looks like ragged arrays are not implemented for arrays of dimension higher
> than 3. It would be very handy but we can workaround without too much
> ugliness.
>
>  Number of people desiring this functionality++;  (Number of people
> capable of and intending to implement it in the near future+=0.)
>
>  Alex
>
>
>
> On Sun, Apr 14, 2013 at 2:56 AM, dave fournier <davef at otter-rsch.com>wrote:
>
>> A little example of what you want would help.
>> _______________________________________________
>> Users mailing list
>> Users at admb-project.org
>> http://lists.admb-project.org/mailman/listinfo/users
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20130414/256127c8/attachment.html>


More information about the Users mailing list