GithubHelp home page GithubHelp logo

tdegeus / cppmat Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 2.0 1.11 MB

[deprecated in favour of xtensor]

Home Page: http://cppmat.geus.me

License: MIT License

C++ 97.67% CMake 0.81% Python 1.03% C 0.48%
cpp interface library matrices python python3 tensor

cppmat's People

Contributors

tdegeus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cppmat's Issues

Simplify implementation

The initial design started out was decoupled as much as possible to allow a lot of flexibility. It is now starting to become a bit bulky.

pybind11 vector bound checks

In 11a31a9 the default pybind11 interface for vectors was introduced for all vector types. This does however not yet include bounds-checks. This needs to be done.

(The upper-bound is checked by push_back, the lower bound is however not checked)

Rename classes

Rename classes:

  • matrix -> array (rename header to regular_array.h, modify pybind11)
  • matrix2 -> matrix (rename header to regular_matrix.h, modify pybind11)
  • vector -> vector (rename header to regular_vector.h, modify pybind11)
  • periodic::matrix -> periodic::array (rename header to periodic_array.h, modify pybind11)
  • periodic::matrix2 -> periodic::matrix (rename header to periodic_matrix.h, modify pybind11)
  • periodic::vector -> periodic::vector (rename header to periodic_vector.h, modify pybind11)
  • tiny::matrix2 -> tiny::matrix (rename header to tiny_matrix.h, modify pybind11)
  • tiny::vector -> tiny::vector (rename header to tiny_vector.h, modify pybind11)
  • view::matrix2 -> view::matrix (rename header to view_matrix.h, modify pybind11)
  • view::vector -> view::vector (rename header to view_vector.h, modify pybind11)
  • Introduce a private.h and corresponding namespace for specific support functions

Replace conversion majority of conversion operators

Equip every class with:

  • copy(...) to copy from (many) overloaded templates.
  • cast<...>() to copy to many overloaded templates. This will incorporate the assymmetric, ... functions for the tensors.

This will replace the more implicit conversion operators, which have the risk making casts (including approximations) that stay unnoticed by the user.

N.B. The conversions from tensor2d -> tensor2 will stay as this cast is very common, and allowing this conversion actually leads to more readable code.

Finish `abs` implementation

Implement cppmat::abs for

  • cppmat::array
  • cppmat::matrix
  • cppmat::vector
  • cppmat::periodic::array
  • cppmat::periodic::matrix
  • cppmat::periodic::vector
  • cppmat::tiny::matrix
  • cppmat::tiny::vector
  • cppmat::view::matrix
  • cppmat::view::vector
  • cppmat::cartesian::tensor4
  • cppmat::cartesian::tensor2
  • cppmat::cartesian::tensor2s
  • cppmat::cartesian::tensor2d
  • cppmat::cartesian::vector
  • cppmat::cartesian2d::tensor4
  • cppmat::cartesian2d::tensor2
  • cppmat::cartesian2d::tensor2s
  • cppmat::cartesian2d::tensor2d
  • cppmat::cartesian2d::vector
  • cppmat::cartesian3d::tensor4
  • cppmat::cartesian3d::tensor2
  • cppmat::cartesian3d::tensor2s
  • cppmat::cartesian3d::tensor2d
  • cppmat::cartesian3d::vector
  • cppmat::view::cartesian2d::tensor4
  • cppmat::view::cartesian2d::tensor2
  • cppmat::view::cartesian2d::tensor2s
  • cppmat::view::cartesian2d::tensor2d
  • cppmat::view::cartesian2d::vector
  • cppmat::view::cartesian3d::tensor4
  • cppmat::view::cartesian3d::tensor2
  • cppmat::view::cartesian3d::tensor2s
  • cppmat::view::cartesian3d::tensor2d
  • cppmat::view::cartesian3d::vector
  • Document

Code clean-up and uniformity

  • Disconnect 'header' from implementation everywhere. The finished cppmat::matrix can be used as guideline.
  • Make sure that all commuting implementations have the same order, to quickly checks the differences and similarities.

Update automatic testing

  • regular_array.h
  • regular_matrix.h
  • regular_vector.h
  • periodic_array.h
  • periodic_matrix.h
  • periodic_vector.h
  • tiny_matrix.h
  • tiny_vector.h
  • tensor.h
  • tensor2.h
  • tensor3.h
  • view_matrix2.h
  • view_vector.h
  • view_tensor2.h
  • view_tensor3.h

Full arithmetic between different formats

  • tensor2.h: <-> view_tensor2.h: operator? (X, X) (2e79399)
  • tensor2.h: <-> view_tensor2.h: operator? (X), class member
  • tensor2.h: <-> view_tensor2.h: tensor products
  • tensor2.h: <-> view_tensor2.h: tensor products, class member
  • tensor3.h: <-> view_tensor3.h: operator? (X, X) (2e79399)
  • tensor3.h: <-> view_tensor3.h: operator? (X), class member
  • tensor3.h: <-> view_tensor3.h: tensor products
  • tensor3.h: <-> view_tensor3.h: tensor products, class member
  • matrix2.h: <-> view_matrix2.h: operator? (X, X)
  • matrix2.h: <-> view_matrix2.h: operator? (X), class member
  • vector.h: <-> view_vector.h: operator? (X, X)
  • vector.h: <-> view_vector.h: operator? (X), class member

Introduce variable names for fixed sizes

Implementation option 1

#include <iostream>

template<class X, int nd=2>
class Foo
{
  static_assert( nd == 2 );

  private:
    X data[nd];

  public:
    Foo() = default;
};

Implementation option 2

#include <iostream>

template<class X>
class Foo
{
  private:
    const expr int nd = 2;
    X data[nd];

  public:
    Foo() = default;
};

Warning: this has some limitations, such as binding to a reference

Introduce argmax and argmin in all modules

Introduce argmax and argmin in all modules:

  • regular_array.h
  • regular_matrix.h
  • regular_vector.h
  • periodic_array.h
  • periodic_matrix.h
  • periodic_vector.h
  • tiny_matrix.h
  • tiny_vector.h
  • tensor.h
  • tensor2.h
  • tensor3.h
  • view_matrix2.h
  • view_vector.h
  • view_tensor2.h
  • view_tensor3.h

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.