forum.alglib.net http://forum.alglib.net/ |
|
vdotproduct http://forum.alglib.net/viewtopic.php?f=2&t=106 |
Page 1 of 1 |
Author: | norrizuan [ Fri Oct 29, 2010 11:17 am ] |
Post subject: | vdotproduct |
Hi there, I want to use the vdotproduct, but the syntax is not clear. I have 2 arrays (char), I've used these alglib::vdotproduct((double)*hypercubeA, (double)*hypercubeB, col); dotmux = vdotproduct((double)*hypercubeA, (double)*hypercubeB, col); according to the syntax double vdotproduct(const double *v1, const double *v2, ae_int_t N); but still fail. Can you also explain about the below syntax: double vdotproduct( const double *v0, ae_int_t stride0, const double *v1, ae_int_t stride1, ae_int_t n); It is not clear from the documentation page. Thanks in advance. Rizuan |
Author: | Sergey.Bochkanov [ Fri Oct 29, 2010 11:28 am ] |
Post subject: | Re: vdotproduct |
Yes, documentation on this subject is very sparse, and I think that I'll expand it in the near future. Code: double vdotproduct( const double *v0, ae_int_t stride0, const double *v1, ae_int_t stride1, ae_int_t n); It calculates dot product of two vectors, n elements each. First one is given by (v0,stride0) and is stored in {v0, v0+1*stride0, v0+2*stride0, ...}. Usual C++/C pointer arithmetics is used, i.e. stride is measured in 8-byte chunks (size of double), not in bytes. Second vector uses same storage. This function has highest performance when stride0==stride1==1. BTW, recently you talked about covariance matrix estimation... I've finally decided to implement it in the ALGLIB 3.1 which will be released within two days. I recommend you to wait for the release because I'll implement very good algorithm which uses cache-efficient BLAS (performance measured in GFLOPs does not drop when matrix grows) and correctly handles tricky cases when some columns of matrix are actually constant, but because of numerical errors you still get nonzero correlation between them. |
Author: | Sergey.Bochkanov [ Fri Oct 29, 2010 11:29 am ] |
Post subject: | Re: vdotproduct |
Quote: I want to use the vdotproduct, but the syntax is not clear. I have 2 arrays (char), I've used these alglib::vdotproduct((double)*hypercubeA, (double)*hypercubeB, col); dotmux = vdotproduct((double)*hypercubeA, (double)*hypercubeB, col); according to the syntax double vdotproduct(const double *v1, const double *v2, ae_int_t N); but still fail. What does this char mean? It must be doubles =) which are stored in contiguous memory (stride=1). |
Author: | norrizuan [ Fri Oct 29, 2010 2:37 pm ] |
Post subject: | Re: vdotproduct |
Hi Sergey, I never received any good support from any forum before. This is my first time. Congratulation to ALGLIB and your team! There are a lot that you guys can improve in future. Thanks for the replies. Sorry, actually my input is not char, it is signed __int16, can't I just cast the variable, (double)hypercube, can I? I'm using the double vdotproduct(const double *v1, const double *v2, ae_int_t N); not the other 3 syntax as in the documentation. Ok, let's said I have double input, with size 512 x 512, hypercubeA and hypercubeB, how can I invoke this command ? alglib::vdotproduct(hypercubeA, hypercubeB, 512); or result = vdotproduct(hypercubeA, hypercubeB, 512); Hope this is clear. About the covariance matrix, thanks. I open this new thread so that anyone can find this problem through search. Well done and thanks man! Rizuan |
Author: | Sergey.Bochkanov [ Fri Oct 29, 2010 7:09 pm ] |
Post subject: | Re: vdotproduct |
If your data are actually array of int16's - not array of doubles for some reason passed as pointer to int16 - then you can't use vdotproduct. It will work with double precision numbers only, even float's won't do. So you should convert all your data to double before using ALGLIB. If you have two vectors, each 512x1, then you can use Code: double result = vdotproduct(hypercubeA, 1, hypercubeB, 1, 512); However, this "hypercube" looks suspicious to me - do you really have vectors? These functions won't work with matrices or tensors or anything else. |
Author: | norrizuan [ Sat Oct 30, 2010 2:39 pm ] |
Post subject: | Re: vdotproduct |
Hi Sergey, I thought vdotproduct is for matrices. Yeah, both of my input are matrices. Sorry. I didn't notice earlier. Regards, Rizuan |
Author: | Sergey.Bochkanov [ Sat Oct 30, 2010 4:49 pm ] |
Post subject: | Re: vdotproduct |
You can use alglib::rmatrixgemm() for matrix-matrix products, there are more functions in ablas subpackage which work with matrices. |
Author: | norrizuan [ Sun Oct 31, 2010 11:48 am ] |
Post subject: | Re: vdotproduct |
Hi Sergey, As far as I'm concern, rmatrixgemm() is not dot-product. It is A(MxN) multiply by B(NxK) that results in output with size of (MxK). Correct me if I'm wrong. I think maybe you should improve the documentation page. Anyway, all you've been doing is great! Thanks. Regards, Rizuan |
Author: | Sergey.Bochkanov [ Sun Oct 31, 2010 3:09 pm ] |
Post subject: | Re: vdotproduct |
Yes, rmatrixgemm is matrix-matrix product - a separate kind of multiplication, which is not dot-product. |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |