forum.alglib.net

ALGLIB forum
It is currently Sun Dec 22, 2024 11:13 pm

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Array construction
PostPosted: Mon Apr 28, 2014 7:44 am 
Offline

Joined: Wed Apr 16, 2014 2:30 pm
Posts: 3
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.


Top
 Profile  
 
 Post subject: Re: Array construction
PostPosted: Mon Apr 28, 2014 1:16 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
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).


Top
 Profile  
 
 Post subject: Re: Array construction
PostPosted: Tue Apr 29, 2014 7:15 am 
Offline

Joined: Wed Apr 16, 2014 2:30 pm
Posts: 3
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.


Top
 Profile  
 
 Post subject: Re: Array construction
PostPosted: Tue Apr 29, 2014 1:23 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
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.


Top
 Profile  
 
 Post subject: Re: Array construction
PostPosted: Tue Apr 29, 2014 2:17 pm 
Offline

Joined: Wed Apr 16, 2014 2:30 pm
Posts: 3
It is completely clear now. Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 33 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group