[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: questions regarding liboctave

**From**: |
Gorazd Brumen |

**Subject**: |
Re: questions regarding liboctave |

**Date**: |
Tue, 05 Dec 2006 17:27:26 +0100 |

**User-agent**: |
Thunderbird 1.5.0.8 (X11/20061116) |

Hi David,
Thanks a lot for the answers. They were very helpful.
>* *
>*> 2. What is the most effective way to compute the scalar product of two*
>*> vectors?*
>* *
>* const ColumnVector a*
>* const ColumnVector b*
>* octave_idx_type mn = (a.length() < b.length() ? a.length() : b.length());*
>* ColumnVector c(mn);*
>* const double *avec = a.fortran_vec();*
>* const double *bvec = b.fortran_vec()*
>* double *cvec = c.fortran_vec();*
>* for (octave_idx_type i = 0; i < mn; i++)*
>* cvec[i] = avec[i] * bvec[i];*
>* *
Isn't there a blas routine that does that? I thought there is a
method to do this by calling this blas routine.
Or is this captured by transforming the vectors into fortran-type vectors?
Thanks again,
Gorazd
P.s. Where is the tex-source of the Octave C++ Classes book?
--
Gorazd Brumen
Mail: address@hidden
WWW: http://www.gorazdbrumen.net/
PGP: Key at http://pgp.mit.edu, ID BCC93240