The LAPACK forum has moved to https://github.com/Reference-LAPACK/lapack/discussions.

vector division

Open discussion regarding features, bugs, issues, vendors, etc.

vector division

Postby asp » Sat Jul 19, 2008 3:27 pm

hello,

i'm looking for a lapack function equivalent to MATLAB's "./" operation which e.g. for two vectors x and y of the same dimensions does element wise division, i.e. it returns a vector of the same dimentions as x and y whose elements are x_i/y_i.
is there anything similar in lapack?

thanks a lot!
asp
 
Posts: 15
Joined: Sat Jul 19, 2008 3:21 pm

Re: vector division

Postby Julien Langou » Sat Jul 19, 2008 3:55 pm

Nope. Not "./".

I know to emulate " .* " with a BLAS call:
Code: Select all
cblas dgbmv( CblasColMajor, CblasNoTrans, m, m, 0, 0, 1, 0e0, X, 1, Y, 1, 0, 0e0, Z, 1);


I do not recommend this kind of trick though ... Most of the people are not able to read the previous line,
while they have no problem understanding the following:
Code: Select all
for(i=0;i<m;i++) Z[i] = X[i]*Y[i];


-julien.
Julien Langou
 
Posts: 835
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA

Re: vector division

Postby sven » Sat Jul 19, 2008 4:48 pm

If you are happy to use Fortran, then it is part of the language since Fortran 90. That is, if x and y are 1-d arrays, then x/y is elementwise division. The array operations are a very nice feature of the language.

Sven.
sven
 
Posts: 146
Joined: Wed Dec 22, 2004 4:28 am

Re: vector division

Postby asp » Sun Jul 20, 2008 4:39 pm

oh well... disappointing what else is there to say
thanks though anyway
asp
 
Posts: 15
Joined: Sat Jul 19, 2008 3:21 pm


Return to User Discussion

Who is online

Users browsing this forum: No registered users and 8 guests