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

Array construction
http://forum.alglib.net/viewtopic.php?f=2&t=1750
Page 1 of 1

Author:  ant [ Mon Apr 28, 2014 7:44 am ]
Post subject:  Array construction

Is it possible to construct valid Alglib array (alglib::real_2d_array) from raw data (double **ptr or double *ptr) without element wise copying? Some examples will be appreciated. Thanks.

Author:  Sergey.Bochkanov [ Mon Apr 28, 2014 1:16 pm ]
Post subject:  Re: Array construction

Hello!

No, it is not possible without copying. The reason is that ALGLIB arrays offer alignment guarantees (64 bytes in the last edition), and your raw data will almost surely be unaligned. So even if you force ALGLIB to point to your array, a lot of linear algebra and neural networks code will stop functioning (some of the code will crash program).

Author:  ant [ Tue Apr 29, 2014 7:15 am ]
Post subject:  Re: Array construction

Hi, Sergey. Thank you for fast reply. I have one more question about array structure. I have found two internal 2D array structures: x_matrix and ae_matrix. Second one seems to use double** for data store. What does it mean "stride" (ae_matrix.stride) in this case? Regards.

Author:  Sergey.Bochkanov [ Tue Apr 29, 2014 1:23 pm ]
Post subject:  Re: Array construction

ae_matrix uses double** for easier access, and double** in fact allows arbitrary allocation of matrix rows. I suppose that's why you asked about stride?

However, double** is used for easier access - and only for that. Internally ae_matrix stores data in row major order with alignment guarantees, and distance between elements in same column but different rows is equal to stride.

Author:  ant [ Tue Apr 29, 2014 2:17 pm ]
Post subject:  Re: Array construction

It is completely clear now. Thanks.

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