Skip to content

Design guidelines

Christian Kahr edited this page Nov 10, 2018 · 1 revision

NumSharp is a project that welcomes everybody who want to help make it better.

During the development of NumSharp we did a lot of experiments, benchmark tests and investigations. Since we do not want to make a mistakes twice this page was created.

So here are the main guidelines

  • NumSharp is a numpy port
    • we try to follow their function, classes, methods, etc. names (so arange instead of ARange)
    • we try to focus just the APIs from Numpy in NumSharp main project (/src/NumSharp folder)
    • new APIs (e.g. better language support, new ideas and features) shall be part of other projects in (/src folder)
    • it is allowed to have non numpy style APIs if there is a good reason (better usability of other methods, helper, ...)
  • Performance is a must
    • Numpy was designed for performance and is base for other libraries (we want to follow this)
    • the dynamic keyword is strictly forbidden (slows down operations about 20 times)
    • we are C# developers and so we use strict data types (one reason more to never use dynamic)
    • we do not use the DynamicObject class (same reason like dynamic keyword)
    • we try to avoid using LINQ in performance critical sections (not forbidden but slows down execution)
    • we do not use boxing because this kind of casting is quite slow
    • our preferred casting is the "as" keyword (e.g. when casting a generic Array T[] into double[])
    • in situation when execution depending on a generic type T or T[] we prefer pattern matching
  • A small unit test for every API
    • if you commit a new method or something please add at least a small test to let us see how the method is called ;)
  • .NET Core is our preferred framework
    • we try to always go with .NET Standard
    • in case we find something in .NET Core we can not find in .NET Standard (and it is useful) --> we go with .NET Core
  • Enjoy the project and let us know your wishes ;)
Clone this wiki locally