blitzpp / blitz

Blitz++ Multi-Dimensional Array Library for C++
https://github.com/blitzpp/blitz/wiki
Other
405 stars 84 forks source link

Extensions to Blitz++ from f2cpp-project #47

Open tobias-loew opened 6 years ago

tobias-loew commented 6 years ago

Hello,

I'm Tobias Loew. Over the last 12 month I've been working a lot with the Blitz++ library. For my Fortran 90 to C++ translation project (https://github.com/tobias-loew/Fortransformers), I use Blitz++ as template-expression library mimicking the Fortran 90 array-operations. For having a proper replacement for Fortran I had to extend Blitz++ with some additional features:

Further on, I disabled the explicit evaluation-optimizations (alignment, SIMD), since the modern C++ compiler usually do those optimizations automatically (and may finally inline everything). My version of Blitz++ compiles on VS 2015 or a comparable Clang/GCC compiler. It uses C++11/14 features as auto, decltype, constexpr, lambdas and variadic templates. IMHO Blitz++ could benefit a lot by switching to a modern C++ standard, since most of the function overload sequences can be replaced by a single variadic-template function. (E.g. this could be used in a Blitz++ 2.0 version.)

All those changes I did not just for "playing around", but are used since almost a year in a quite large code-base (which was translated from Fortran and with my f2cpp-tool). (The program I work on at my company is Ebsilon (www.ebsilon.com). The code is proprietary, but I could show you a C++ version of LAPACK using my Blitz++ library.)

When you're interested in the code, please have a lock at https://github.com/tobias-loew/Fortransformers. I would be happy if some of my changes would make it into Blitz++ (2.0 ?).

Tobias

citibeth commented 6 years ago

See here for how Fortran + Blitz can be used to pass arrays seemlessly between C++ and Fortran:

http://jerseybiker.blogspot.com/2013/10/passing-assumed-shape-arrays-between.html

https://github.com/citibeth/ibmisc/blob/develop/slib/ibmisc/f90blitz_f.py https://github.com/citibeth/ibmisc/blob/develop/slib/ibmisc/f90blitz.hpp

-- Elizabeth

On Sat, Jul 21, 2018 at 3:50 AM, Tobias Loew notifications@github.com wrote:

Hello,

I'm Tobias Loew. Over the last 12 month I've been working a lot with the Blitz++ library. For my Fortran 90 to C++ translation project ( https://github.com/tobias-loew/f2cpp), I use Blitz++ as template-expression library mimicking the Fortran 90 array-operations. For having a proper replacement for Fortran I had to extend Blitz++ with some additional features:

  • added TinyBasedVector (and its associated iterator-types), an extension of TinyVector that allows specifying a base index, this is used as base-class for non-dynamic arrays (e.g. static or stack-based)
  • added a Policy template argument to the Array class that allows optimizations when used with TinyBasedVector
  • added support for indexing-arrays (only one level currently, nesting of index-arrays is not yet supported)
  • added support for member-projections (access struct-members as blitz-array from a blitz-array over a struct; categorical-speaking: make struct-member-access a functor)
  • added many constexpr contructors

Further on, I disabled the explicit evaluation-optimizations (alignment, SIMD), since the modern C++ compiler usually do those optimizations automatically (and may finally inline everything). My version of Blitz++ compiles on VS 2015 or a comparable Clang/GCC compiler. It uses C++11/14 features as auto, decltype, constexpr, lambdas and variadic templates. IMHO Blitz++ could benefit a lot by switching to a modern C++ standard, since most of the function overload sequences can be replaced by a single variadic-template function. (E.g. this could be used in a Blitz++ 2.0 version.)

All those changes I did not just for "playing around", but are used since almost a year in a quite large code-base (which was translated from Fortran and with my f2cpp-tool). (The program I work on at my company is Ebsilon (www.ebsilon.com). The code is proprietary, but I could show you a C++ version of LAPACK using my Blitz++ library.)

When you're interested in the code, please have a lock at https://github.com/tobias-loew/f2cpp. I would be happy if some of my changes would make it into Blitz++ (2.0 ?).

Tobias

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/blitzpp/blitz/issues/47, or mute the thread https://github.com/notifications/unsubscribe-auth/AB1cdxguMLBfEmWPsvsNj8eQ8rPs9_E5ks5uIt0ugaJpZM4VZiXH .