Registered Member
|
In the development branch, line 150 of IO.h does this:
RealScalar explicit_precision_fp = ... explicit_precision = static_cast<std::streamsize>(explicit_precision_fp); In my case, RealScalar is a custom fixed-point type that is not implicitly convertible to an integer (though it has a member function to explicitly do the conversion). I suppose I could specialize ei_print_matrix for my type, but I was trying to think of a more generic solution before doing that. Any ideas? Perhaps the conversion could be abstracted out into some sort of "ei_to_integer" template function or something. Then I could just specialize that small function instead of the large ei_print_matrix function. |
Registered Member
|
ok, i just updated this file so this computation is now made in a separated templated struct ei_significant_decimals_impl which you can specialize to your custom type.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
|
Registered Member
|
by the way, the name "HasFloatingPoint" is not good for fixed-point... should be renamed to IsNonInteger, or rather its negation IsInteger... let's try to remember that for 3.0...
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
|
Registered Member
|
And, my solution was not as good as your idea, so i now added ei_cast_to_int in MathFunctions.h. You can extend it by specializing ei_cast_to_int_impl.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
Also, is there an easy way to specialize Matrix<>::data()? For example, if I wanted to convert my fixed-point data to floating-point data and then return a pointer to that. I could always wrap this functionality in my own function if there isn't an easy way to do this.
|
Registered Member
|
data() is only available in plain matrices, not expressions, so the cast can't be lazy evaluated here.
but careful about the lifespan of the temporary returned by eval()... you may have to create a named variable for that.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
And if I need to call something like myFixedPointNumber.ToFloat() to explicitly perform the conversion, where would I do that?
|
Registered Member
|
excellent point
So I generalized your idea to all types of casts: there now is ei_cast and ei_cast_impl, see in MathFunctions.h. Just specialize (you can do partial specializations) that to any types combinations that you neeed. Should address both of your problems at once.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
...forgot to update the cast functor. should work now.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
Yep, everything works great now...I can seamlessly toggle fixed-point usage on and off throughout my entire codebase Also, slightly off-topic, but thought you might like to know there are at least 3 iPhone games in the appstore right now that use Eigen...soon to be 4.
|
Registered Member
|
Excellent, don't hesitate to mention them under "Projects using Eigen" on the wiki main page, if you think it's OK!
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
I just saw your update on the Main Page. Excellent! If I had a iphone, i'd buy a game... but I don't even have a cell phone
Just a question, out of curiosity, how are you handling (or planning to handle) the license requirement to say somewhere that you're using Eigen, that it's LGPL, and provide a way to get a copy of the LGPL? (see section 3 of the LGPL v3 pasted below, it's basically the same thing as a 2-clause BSD license as long as you're not forking Eigen itself). Of course your end-users don't want to know about Eigen, so there's no point putting that info in a highly user-visible place I'm mostly asking to know what I could suggest in the future when people ask what they should be doing. Out of the top of my head, without thinking much, I'd say that a good solution is to ship with the game a text file (say license.txt) where you mention that; and I'd say there's no need to ship a copy of the LGPL and of the GPL, just giving links to them should be enough. But I'm not a lawyer. The only thing is to make sure that it is possible for the user to view this file (if he wants to). For reference: http://www.gnu.org/copyleft/lesser.html
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
I believe the plan was to put the statement of Eigen usage and link to the LGPL in the text description for each game that is displayed when a user views the game's entry in the Apple appstore. This seems to be the best way to handle it in the case of the iPhone since users must view that page prior to downloading the game and putting that information in the games themselves is difficult on a platform with limited screen space. Also, it would be difficult to include a text file with a game and have the user be able to view that file on the iPhone (iPhone doesn't expose a typical file system and doesn't have a typical text editor). All that being said, I'm not sure if that actually happened since publishing the games wasn't my responsibility, so I will check on that right away and have the text updated if necessary.
|
Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]