forum.alglib.net
http://forum.alglib.net/

Using ae_vector with std algorithms
http://forum.alglib.net/viewtopic.php?f=2&t=633
Page 1 of 1

Author:  thorsan [ Tue Oct 23, 2012 5:40 am ]
Post subject:  Using ae_vector with std algorithms

Hi

Can ae_vector be used together with std algorithms? How is the correct way to do it:

alglib::real_1d_vector a;
a.setlength(100);
std::fill((double*)a.c_ptr(),(double*)a.c_ptr() + a.length(),0.0);

Thanks,
thorsan

Author:  Sergey.Bochkanov [ Tue Oct 23, 2012 10:18 am ]
Post subject:  Re: Using ae_vector with std algorithms

With ae_vector you can just take pointer to the first element of the array - elements are stored contiguously, such order is 100% compatible with STL. With ae_matrix, however, you should be very careful - elements are stored row-by-row, with additional padding between rows, which should be taken into account (this padding is used to align data in memory).

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/