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

vdotproduct in C# not implemented?
http://forum.alglib.net/viewtopic.php?f=2&t=460
Page 1 of 1

Author:  ShanbinZhao [ Tue Oct 25, 2011 6:14 pm ]
Post subject:  vdotproduct in C# not implemented?

I've downloaded the alglib-3.4.0.csharp, but not able to find the vdotproduct function under alglib.

btw, I can see functions like rmatrixmv or rmatrixgemm.

Author:  Sergey.Bochkanov [ Tue Oct 25, 2011 7:41 pm ]
Post subject:  Re: vdotproduct in C# not implemented?

Yes, these functions (vdot/vmove/...) are C++ specific. They all are pointer-based, and you can't work with pointer from C#.

The idea is that there are two layers in ALGLIB - basic functions, which are language-specific (some functions can be used from C#, some from C++), and high-level functions which are 100% same in all languages.

Author:  ShanbinZhao [ Tue Oct 25, 2011 8:02 pm ]
Post subject:  Re: vdotproduct in C# not implemented?

Thanks for the reply, Sergey.

AlgLib is great and I am gradually replacing our current math/stat implementation with this package. However simple manipulations such as dot product missing makes the transition incompletable. It would be nice to have this very basic operation in other language too - considering it already has other 'more complicated' operators in C#, such as matrix vector multiplications...

Author:  Sergey.Bochkanov [ Wed Oct 26, 2011 5:53 am ]
Post subject:  Re: vdotproduct in C# not implemented?

Hmm, it would be good, but... do you have any idea how to implement dot product in C#, so it will work with both 1- and 2-dimensional rectangular arrays?

The problem is that in C++ you can just get pointer to a matrix row and pass it to the vdotproduct. And if you want to work with column, you can pass pointer to column with non-unit stride (step) equal to N. So you can handle both matrices and vectors within one function. But you can't do such things in C#. The only solution is to have many overloaded versions of vdotproduct: vdotproduct(array[,],array[]), vdotproduct(array[],array[]), ... And many overloads for other functions. Another solution is to use pointers (C# supports them), but it will make ALGLIB code unsafe.

Do you have any idea how to solve this issue? It is not rhetoric question :) I'd be glad to hear any suggestions.

Author:  ShanbinZhao [ Wed Oct 26, 2011 6:43 pm ]
Post subject:  Re: vdotproduct in C# not implemented?

I just went through the cpp files, and yes, same thing can not be done in c#, at least I don't know:p Overloading in c# sounds like the correct implimentation, but i am not sure how annoying it will be for you since the codes are automatically generated. anyway, thanks for the good work!

Author:  Sergey.Bochkanov [ Thu Oct 27, 2011 5:56 am ]
Post subject:  Re: vdotproduct in C# not implemented?

Now, when you popped up this issue, I begin to think that we may have to use overloading. In any case, this work (many overloaded versions of the same function) has to be done only once, so it may be worth the effort. I have to think on it for a day or two before coming up with decision :)

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