Re: [eigen] EigenLab: C++ run-time matrix math ala MATLAB. |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] EigenLab: C++ run-time matrix math ala MATLAB.*From*: Marcel Goldschen <marcel.goldschen@xxxxxxxxx>*Date*: Thu, 25 Sep 2014 09:19:02 -0500*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=XNY9U43jkDhkZpzabDDJ5YHA4iXcfqXFRnNNee3pYH4=; b=zOjZtAUpRuEr9Onb3hE5oiFrOF/qMX3SAtuBHxS76wUzAajlBFaqddFapUCF8g8+JG kdGy3bLtnK0Y2RCeVmYs9XCChFy/bsBrM2xEJWHi7azNyTkku/VfMailuwJUkYxcdz69 RKGstlLOmWYthHp42Hyy0NfSqY9q5JehsEu8xxWf/v3dB5zQv+YqHoHu3Ggz3YtZWt2u pzCZIxzpTEi0B6VyDs77JJNdQXFbjQiuSggbgOMYM/VD9lfJLqREXDhCC/vYyeypjd9t GqLEPmIjEse9RR6Ojw4wORDUYObzn45H7WNTkzDV6gyxGJycHcucmY3Nllir0ekzNiGu gWrQ==

Thanks for the comments Ilja. As you have shown, my goal with EigenLab was not brute efficiency at simple numeric expressions, but to provide a parser that can handle matrix operations and also provide an simple intuitive interface. If your equations do not require matrices, then something like muParser may be better for you. That said, if you are interested in increasing EigenLab's efficiency in this regard, that would be great. Regarding parsing an equation once and reusing it with new values, EigenLab currently does not do this. However, it would not be hard to store the parsed chunks and then rerun an evaluation on them with new variable values. For my uses, the matrix operations take way longer than parsing the equation, so I never bothered to do anything like this, but it's fairly easily implemented if needed. I'll add it to the list of things for the next version. This might also go a long way to closing the performance gap you've shown in your examples assuming EigenLab is parsing the equation 1e6 times whereas muParser is parsing it only once. I'll also see about putting a custom error message in for bad indices rather than using Eigen's error messages.

Cheers,

Marcel

On Wed, Sep 24, 2014 at 3:11 PM, Ilja Honkonen <ilja.j.honkonen@xxxxxxxx> wrote:

Hello

On 31/8/14, 10:18, Marcel Goldschen wrote:

Hi all,....

I've created a header only library called

EigenLab (https://github.com/marcel-goldschen-ohm/EigenLab

<https://github.com/marcel-goldschen-ohm/EigenLab>) which provides

run-time parsing/evaluation of matrix math expressions in C++ with a

what you think. Also, if anyone knows how I could improve its

performance by using Eigen's _expression_ templates, I'd love to hear

about it.

I finally had time to try it out and it seems quite nice except it's very slow compared to muparserx. Parsing a simple _expression_ (i + 1) 1e6 times on my laptop takes about 0.07 s with muparserx and 4.7 s with EigenLab using these test programs:

https://github.com/nasailja/pamhd/blob/master/tests/eigenlab/performance1.cpp

https://github.com/nasailja/pamhd/blob/master/tests/muparserx/performance1.cpp

The muparserx test only has to parse the _expression_ once, would it be possible to do a similar optimization in eigenlab if the _expression_ doesn't change but only the value(s) of variable(s)?

Also it would be nice to have a better error message for using a wrong index [v1(1) instead of v1(0)] in an _expression_ than: Assertion failed: (a_startRow >= 0 && blockRows >= 0 && a_startRow <= xpr.rows() - blockRows && a_startCol >= 0 && blockCols >= 0 && a_startCol <= xpr.cols() - blockCols), function Block, file /Users/iljah/libraries/eigen/Eigen/src/Core/Block.h, line 146. This is far less important than performance though as currently I don't think I could use eigenlab in my program because even muparserx takes a few seconds.

Ilja

Postdoctoral fellow, Chanda laboratory

**References**:**Re: [eigen] EigenLab: C++ run-time matrix math ala MATLAB.***From:*Ilja Honkonen

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] EigenLab: C++ run-time matrix math ala MATLAB.** - Next by Date:
**[eigen] DecisionNeeded: (Optionally) avoiding/prohibiting copies in Ref<const Matrix> objects (cf Bug 884)** - Previous by thread:
**Re: [eigen] EigenLab: C++ run-time matrix math ala MATLAB.** - Next by thread:
**Re: [eigen] BDCSVD update**

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