![]() |
Blitz Support : |
From: Julian Cummings (cummings_at_[hidden])
Date: 2003-09-11 20:21:51
Hello Navneet,
Navneet Dalal wrote:
> Hi all,
>
> I just checkout blitz and execute "make check-testsuite". gcc gives
> error in vecexpr.h file. I failed to understand why it fails. May be
> someone can look at it. I am using gcc3.2.2 on linux.
I believe this bug has been reported and fixed already. Make sure you
have cvs version 1.8
of vecexpr.h and then retest.
>
> Another few things: I have used blitz in past for few tasks. And it
> lacks some very basic things: related to TinyMatrix and TinyVector.
Yes. The expression template support for the TinyVector and TinyMatrix
classes was never
fully completed in blitz. There is a project called tvmet that has
taken these Tiny classes
and fully developed the expression template support for them,
independent of blitz. You
can find tvmet on the SourceForge website. I have been thinking about
how best to approach
folding this work back into blitz so that blitz could benefit from the
work done in tvmet.
I plan to contact the tvmet developer and discuss this. Perhaps we can
just adopt the current
tvmet::Vector and tvmet::Matrix types and use them in blitz in place of
blitz::TinyVector
and blitz::TinyMatrix...? I would much rather do that than redo much of
the tvmet work.
>
> Since, I am unsure about my coding skills so if someone can look at my
> changes/suggestions and decide if they has any repercussions and if
> not, commit them to CVS.
>
> [snip]
>
> 3. In TinyVector class (tinyvec.h and tinyvec.cc), all constructors
> take T_numtype argument, a slightly better way may be to pass const
> T_numtype&: for e.g. inline TinyVector(const T_numtype&
> initValue); compare to
> inline TinyVector(T_numtype initValue);
>
> The same holds for all variants of TinyVector(T_numtype ... constructors.
This is mostly a matter of programming style. I typically pass
arguments by value if
the objects are small simple types such as the built-in number types.
That is how it
happens to be done here in blitz. Also, tvmet constructs its Vector
with pass-by-value.
There is only an efficiency issue if the object is expensive to copy.
>
> 4. in file array_impl.h, isInRange should be changed to
>
> template<class T>
> _bz_bool isInRange(const TinyVector<T,N_rank>& index) const
> // Was : _bz_bool isInRange(const T_index& index) const
>
>
> This will allow to check range for TinyVector values of types double.
> T_index is typedef to TinyVector<int, rank>.
>
The reason why this is limited to TinyVectors of ints is that blitz
Arrays can only
be indexed with int arguments. Indexing an Array with floating-point
indices is
not defined. Thus, there is really no purpose to checking whether a
TinyVector
of doubles falls within the index domain of an Array (at least, none
that I can think of).
Of course, if you *really* need to do this, you can loop over the
elements of your
TinyVector and check that each value lies between base(d) and
base(d)+length(d).
Regards, Julian C.
-- Dr. Julian C. Cummings E-mail: cummings_at_[hidden] California Institute of Technology Phone: 626-395-2543 1200 E. California Blvd., Mail Code 158-79 Fax: 626-584-5917 Pasadena, CA 91125