Re: [eigen] alpha3

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi again,

I wanted to notify you about a change I made since alpha3, which does not 
appear in the documentation.

The Eval class has been simplified and has now much more restricted 
functionality. It is now only usable as the return type of eval().

The following no longer works:

Eval<Block<MatrixType> > b = m.block(x,y,z,t);

Instead I have introduced new convenience typedefs RowType, ColumnType, 
BlockType in the Matrix class, so the above can be done as follows:

typename MatrixType::BlockType b = m.block(x,y,z,t);

Note that BlockType is just a typedef for Matrix<...parameters...> so it can 
be used whenever these parameters are adequate. For instance:

typename MatrixType::BlockType b = m.lazyProduct(n).block(x,y,z,t);

Similarly RowType and ColumnType are self-explanatory,

typename MatrixType::RowType r = m.row(i);

With that I think the core module is really ready for the development of other 
modules.

Cheers,

Benoit

On Monday 14 January 2008 01:29:54 Benoît Jacob wrote:
> Hi List,
>
> alpha3 is released, website updated.
>
> The goal of this release is to adress the needs of module developers (hey
> Jonas and Ramon!). Indeed, as I said, the API in alpha2 had some
> shortcomings which became apparent after a good irc discussion with Jonas.
> This new alpha release should address all of them, so I really hope that
> this time it will provide a solid foundation for module developers. Here's
> a summary of the changes since alpha2:
>
> * big rework of the block API, but more on this below, suffices for now to
> say that dynBlock() is renamed to block() and block() is renamed to
> fixedBlock().
>
> * evaluating a dynamic-size expression no longer causes a dynamic memory
> allocation, if a fixed bound is known
>
> example:
> Matrix3d m;
> m.block(a,b,c,d).eval(); // no dynamic memory allocation because
>                          // regardless of a,b,c,d, the size is <= 9
>
> this is really the biggest change. It caused big architecture changes: in
> addition to the "actual" number of rows and cols, Eigen now remember
> the "maximum" possible numbers; in the above examples while the "actual"
> numbers are Dynamic, the "maximum" numbers are 3 so we can avoid a dynamic
> memory allocation.
>
> * some expression classes saw their sizeof() shrink due to a trick allowing
> to not waste space storing an int when it's a compile-time constant while
> allowing it to be a runtime variable in other cases. see class
> IntAtRunTimeIfDynamic in Util.h.
>
> * so, as I said, big rework of the block API. In addition to the above
> renaming, special versions of block() were added for vectors, and
> convenience functions start() and end() were added to access the start and
> the end of a vector. Also, a convenience method corner() was added for
> matrices:
>
> m.corner(Eigen::BottomLeft, num_rows, num_cols)
>
> * as discussed on this list, we switched to enums which is an optimization,
> even though it seems that g++ was clever enough to do it on its own.
>
> * added setZero(), setOnes(), setRandom(), setIdentity(). This is much more
> convenient than the static methods in the case when it is tedious to write
> down the expression type and dimensions.
>
> * and of course more cleanup and reorganization, e.g. the forward
> declarations are in their own file.
>
> There now are 2455 lines of code, up from 2234.
>
> This time (I know I've been caught saying that many times before) I really
> think this is it and I can get back to math research for now!!
>
> Cheers,
>
> Benoit


Attachment: signature.asc
Description: This is a digitally signed message part.



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/