0

How can I declare a 3d array(like arrays nested in arrays which are in turn nested in arrays) with blitz++? Say the dimensions are 3,4,5. Also how would I access said array elements? Could you also tell me how to get the size of each dimension of this multi dimensional array? like for c++ vectors there are oneDvec.size(), twoDvec.size() or twoDvec[di].size() etc.

amy
  • 33
  • 7

2 Answers2

1
// declare
blitz::Array<double, 3> blitzArray( 3, 4, 5 );
// access
blitzArray(0,0,0) = 1.0001;
Öö Tiib
  • 10,809
  • 25
  • 44
  • Thank you Oo. Could you also tell me how to get the size of each dimension of this multi dimensional array? like for c++ vectors there are oneDvec.size(), twoDvec.size() or twoDvec[di].size() etc. – amy Apr 09 '13 at 09:58
  • Could it be blitzArray.extent(0), blitzArray.extent(1) and blitzArray.extent(2) for 1D, 2D and 3D array size respectively? – amy Apr 09 '13 at 10:12
1

Yes, it is blitzArray.extent(0), blitzArray.extent(1) and blitzArray.extent(2) for 1D, 2D and 3D array size respectively.

amy
  • 33
  • 7