Giter Site home page Giter Site logo

laplacekorea / zarray Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xtensor-stack/zarray

0.0 1.0 0.0 129 KB

Dynamically typed N-D expression system based on xtensor

License: BSD 3-Clause "New" or "Revised" License

CMake 7.05% C++ 92.95%

zarray's Introduction

Azure Pipelines Join the Gitter Chat

Dynamically typed N-D expression system based on xtensor.

Introduction

zarray is a dynamically typed N-D expression system built on top of xtensor.

Installation

Package managers

We provide a package for the mamba (or conda) package manager:

mamba install -c conda-forge zarray

Install from sources

zarray is a header-only library.

You can directly install it from the sources:

cmake -D CMAKE_INSTALL_PREFIX=your_install_prefix
make install

Dependencies

zarray depends on xtensor and nlohmann_json:

zarray xtensor nlohmann_json
master 0.23.8 3.2.0
0.1.0 0.23.8 3.2.0
0.0.6 0.23.8 3.2.0

Usage

Initialize a 2-D array and compute the sum of one of its rows and a 1-D array.

#include <zarray/zarray.hpp>

xt::zarray arr1 =
  {{1.0, 2.0, 3.0},
   {4.0, 5.0, 6.0},
   {7.0, 8.0, 9.0}};

xt::zarray arr2 =
  {5.0, 6.0, 7.0};

xt::zarray res = xt::strided_view(arr1, {1, xt::all()}) + arr2;
std::cout << res << std::endl;

Outputs:

{7, 11, 14}

Initialize a 1-D array and reshape it inplace.

#include <zarray/zarray.hpp>

xt::zarray arr =
  {1, 2, 3, 4, 5, 6, 7, 8, 9};

arr.reshape({3, 3});

std::cout << arr << std::endl;

Outputs:

{{1, 2, 3},
 {4, 5, 6},
 {7, 8, 9}}

License

We use a shared copyright model that enables all contributors to maintain the copyright on their contributions.

This software is licensed under the BSD-3-Clause license. See the LICENSE file for details.

zarray's People

Contributors

johanmabille avatar davidbrochart avatar derthorsten avatar hankliu5 avatar

Watchers

 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.