diff --git a/README.md b/README.md index 06aa0ea..f8693b2 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@ -# Multi Array Container Library +# Container with Native Operation Routines by XZ (CNORXZ) ## Description -This library provides a framework for handling multi dimensional containers. This includes the basic container class template `MultiArrayBase` and their derivates, the Range class templates on which the containers are defined, as well as some operation class templates, which allow comfortable calling of operations on the containers. +This library provides a framework for handling multi dimensional containers. This includes the basic container class template `ArrayBase` and their derivates, the Range class templates on which the containers are defined, as well as some operation class templates, which allow comfortable calling of operations on the containers. ## Build instructions The library can be installed by the following procedure (`gtest` required): ```bash -git clone git@rqcd.ur.de:czimmermann/multi_array.git +git clone git@git.f3l.de:chizeta/cnorxz.git cd cmake -DCMAKE_INSTALL_PREFIX:PATH= make install @@ -17,18 +17,18 @@ make install ## Usage and Examples -To use the features of the libraries one has to include `multi_array_header.h` and link against the `libmultiarray.so`. -The tools of the library are accessible within the namespace `MultiArrayTools`. +To use the features of the libraries one has to include `cnorxz.h` and link against the `libcnorxz.so`. +The tools of the library are accessible within the namespace `CONORXZ`. ### Some Terms * Ranges: A set of meta data which is mapped onto the linear position. Every container is supposed to be defined on at least one Range. In the simplest case a Range space "containes" the numbers [0,...,rangesize]. Ranges have to be created via the corresponding factory and only exist within a shared pointer. They cannot be copied. The reason is, that every operation performed on the containers, has to identify common sets of ranges, on which the containers are defined. Every range inherits the `RangeBase` class. -* Indices: They can be thought of as iterators of the range space. In the special case of the `ContainerIndex` it is also an iterator over the corresponding container. The index type must be known at compile time (static polymorphism). Indices on a range can be obtained by `getIndex( range )`. For Container Indices call the `begin()` function of a `MultiArray`. Indices are crucial for defining operations. +* Indices: They can be thought of as iterators of the range space. In the special case of the `ContainerIndex` it is also an iterator over the corresponding container. The index type must be known at compile time (static polymorphism). Indices on a range can be obtained by `getIndex( range )`. For Container Indices call the `begin()` function of a `Array`. Indices are crucial for defining operations. -* `MultiArray`: Contains data of type `T` and is defined on `Ranges...`. -* `[Const]Slice`: Views data of type `T` and acts as a MultiArray defined on `Ranges...`. -* `FunctionalMultiArray`: Additional template argument indicating the funtion. The value at some position is then defined by the function value obtained from the meta data of the indices/ranges. +* `Array`: Contains data of type `T` and is defined on `Ranges...`. +* `[Const]Slice`: Views data of type `T` and acts as an Array defined on `Ranges...`. +* `FunctionalArray`: Additional template argument indicating the funtion. The value at some position is then defined by the function value obtained from the meta data of the indices/ranges. On each of these types one can perform an operation by calling `operator(...)` where within the braces the corresponding indices have to be specified (see example below). @@ -36,16 +36,16 @@ On each of these types one can perform an operation by calling `operator(...)` w ```c++ -#include "multi_array_header.h" +#include "cnorxz.h" -namespace mat = MultiArrayTools; +namespace cnx = CNORXZ; -typedef mat::SingleRange DRange; -typedef mat::SingleRangeFactory DRangeF; -typedef mat::SingleRange SRange; -typedef mat::SingleRangeFactory SRangeF; -typedef mat::SingleRange CRange; // also provided as 'ClassicR' -typedef mat::SingleRangeFactory CRangeF; +typedef cnx::SingleRange DRange; +typedef cnx::SingleRangeFactory DRangeF; +typedef cnx::SingleRange SRange; +typedef cnx::SingleRangeFactory SRangeF; +typedef cnx::SingleRange CRange; // also provided as 'ClassicR' +typedef cnx::SingleRangeFactory CRangeF; /*create ranges*/ std::vector meta1({...}); @@ -57,13 +57,13 @@ DRangeF drf2(meta2); SRangeF srf(meta3); CRangeF crf(10); // specialized in this case; only size needed. -auto dr1 = mat::createExplicit( drf1 ); -auto dr2 = mat::createExplicit( drf2 ); -auto sr = mat::createExplicit( srf ); -auto cr = mat::createExplicit( crf ); +auto dr1 = cnx::createExplicit( drf1 ); +auto dr2 = cnx::createExplicit( drf2 ); +auto sr = cnx::createExplicit( srf ); +auto cr = cnx::createExplicit( crf ); -mat::MultiArray ma_a(dr1,dr2,sr,cr,0); -mat::MultiArray ma_b(sr,sr,0); +cnx::Array ma_a(dr1,dr2,sr,cr,0); +cnx::Array ma_b(sr,sr,0); /* assign some values... */ double val = 1.; @@ -75,16 +75,16 @@ for(auto& x: ma_b){ x = val /= 2.; } -mat::FunctionalMultiArray,DRange,DRange> fma(dr1,dr2); -mat::MultiArray res1(dr1,dr2); -mat::MultiArray res2(dr1,dr2); +cnx::FunctionalArray,DRange,DRange> fma(dr1,dr2); +cnx::Array res1(dr1,dr2); +cnx::Array res2(dr1,dr2); /* get indices... */ -auto i1 = mat::getIndex( dr1 ); -auto i2 = mat::getIndex( dr2 ); -auto i3 = mat::getIndex( sr ); -auto i4 = mat::getIndex( sr ); -auto i5 = mat::getIndex( cr ); +auto i1 = cnx::getIndex( dr1 ); +auto i2 = cnx::getIndex( dr2 ); +auto i3 = cnx::getIndex( sr ); +auto i4 = cnx::getIndex( sr ); +auto i5 = cnx::getIndex( cr ); i3->at(); i5->at(); @@ -107,7 +107,7 @@ Multithreading can be enabled by the operation class member function `par()`, wh /* Enable multithreading for the loop over i1 */ res1(i1,i2).par() = (ma_a(i1,i2,i4,i5) + ma_b(i4,i3)).c(i4); ``` -Caution: If you want to multithread operations over functional multi arrays, you have to make sure by yourself that involved functors are either static or const (const member variables). +Caution: If you want to multithread operations over functional arrays, you have to make sure by yourself that involved functors are either static or const (const member variables). # Planned features @@ -115,6 +115,6 @@ Basically the structure of the operation routines allows in some cases (at least # Known Issues -I didn't care that much about error handling because of missing time. There it might happen that you declare a `MultiArray` or `Slice` and an operation on it yields a segfault because it was forgotten to instancate the underlying container. Of course, there should be some mechanism, that catches such things, but due to the afore mentioned lack of time, it has not been implemented in every case. If you encounter such problems, pleas tell me, but be aware, that I won't fix it very soon. +I didn't care that much about error handling because of missing time. There it might happen that you declare a `Array` or `Slice` and an operation on it yields a segfault because it was forgotten to instancate the underlying container. Of course, there should be some mechanism, that catches such things, but due to the afore mentioned lack of time, it has not been implemented in every case. If you encounter such problems, pleas tell me, but be aware, that I won't fix it very soon. There are unit tests, which cover the all crucial parts of this library, but probably not every special case. Hence, there is no warranty, that, if you do something fancy I didn't consider, everything works fine. \ No newline at end of file