Git Product home page Git Product logo

nda's Introduction

build

nda - A multi-dimensional array library in C++

nda is a C++ library providing an efficient and flexible multi-dimensional array class. It is an essential building-block of the TRIQS project. Some features include

  • coded in C++17/20 using concepts
  • expressions are implemented lazily for maximum performance
  • flexible and lightweight view-types
  • matrix and vector class with BLAS / LAPACK backend
  • easily store and retrieve arrays to and from hdf5 files using h5
  • common mpi functionality using mpi

Install instructions are provided here.

A prelimenary reference documentation based on Doxygen is provided at triqs.github.io/nda.

Simple Example

#include <nda/nda.hpp>
#include <nda/h5.hpp>

using namespace nda;

int main() {

  // Create array of shape (4,4,4)
  array<long, 3> A(4, 4, 4);

  // Create an array given its data
  array<long, 2> B{{1, 2}, {3, 4}, {5, 6}};

  // Assign
  A() = 0;
  A(0, 1, 2) = 40;

  // Access
  int a = A(0, 1, 2) + B(0, 1);

  // Slicing to a view of shape (3, 2)
  auto V = A(range(0, 3), range(0, 2), 0);

  // Lazy Arithmetic operations
  auto C = V + 2 * B;

  // Algorithms
  min_element(V);
  max_element(V);
  sum(V);

  // write to file
  {
    h5::file file("dat.h5", 'w');
    h5_write(file, "A", A);
  }

  // read from file
  array<long, 3> D;
  {
    h5::file file("dat.h5", 'r');
    h5_read(file, "A", D);
  }

}

For further examples we refer the users to our tests. We outline some important design principles here.

nda's People

Contributors

wentzell avatar dylex avatar mmorale3 avatar dominikkiese avatar the-hampel avatar parcollet avatar hugostrand avatar phdum avatar thoemi09 avatar hmenke avatar iskakoff avatar

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.