|
Boost : |
From: Martin Weiser (weiser_at_[hidden])
Date: 2002-07-01 04:43:22
Thanks for the clarification. I'll give the xgemm-specialization a second
try as soon as I find the time.
Yours,
Martin
On Samstag, 29. Juni 2002 15:04, Joerg Walter wrote:
> Yep. But I shouldn't only state it, but also show. So I wrote a little
> sample:
>
> ----------
> #include <iostream>
> #include <boost/numeric/ublas/vector.h>
> #include <boost/numeric/ublas/matrix.h>
> #include <boost/numeric/ublas/io.h>
>
> namespace boost { namespace numerics {
>
> // vector assignment_operation scalar
> template<>
> struct vector_assign_scalar<class scalar_multiplies_assign<double,
> double> > {
> void operator () (vector<double> &v, const double &t) {
> std::cout << "here we are" << std::endl;
> for (unsigned i = 0; i < v.size (); ++ i)
> v (i) *= t;
> }
> };
>
> } }
>
> int main () {
> numerics::vector<double> v (1);
> double d = 0;
> v.clear ();
> v *= d;
> return 0;
> }
>
> ----------
>
> which should show, how to achieve this (works for me under GCC 3.1).
> And yes, I realize, that vector_assign<> and matrix_assign<> don't have
> the optimal interface: they should have been free functions in fact,
> but this is the way, we got the thing working on MSVC 6.0 ;-(.
>
> > It's just that I considered specializing matrix_assign<> for dgemm
> > and, reading the code, thought the necessary expression type
> > information to be lost somewhere. Probably I'm just to dumb.
> > Preferring a design that allows such specializations, I just wanted
> > to draw your attention to this point.
-- Dr. Martin Weiser Zuse Institute Berlin weiser_at_[hidden] Scientific Computing http://www.zib.de/weiser Numerical Analysis and Modelling
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk