From 8091cec1aa788de1f4eff51cd6ba6330999c87d9 Mon Sep 17 00:00:00 2001 From: RaggleDodo Date: Tue, 15 Jan 2019 19:12:45 -0800 Subject: [PATCH] remove executable flag for dot files and update docs --- .dockerignore | 0 .gitignore | 0 .travis.yml | 0 Doxyfile | 4 +- docs/coord_8hpp_source.html | 21 +++++---- docs/functions.html | 4 ++ docs/functions_func.html | 14 ++++-- docs/matops_8hpp.html | 2 + docs/matops_8hpp_source.html | 3 +- docs/menudata.js | 1 + docs/mtens_8hpp.html | 2 + docs/mtens_8hpp_source.html | 5 ++- docs/namespaceade.html | 50 ++++++++++++++++++++++ docs/namespacemembers.html | 6 +++ docs/namespacemembers_func.html | 6 +++ docs/search/all_3.js | 1 + docs/search/all_7.js | 1 + docs/search/all_d.js | 1 + docs/search/all_e.js | 2 +- docs/search/functions_3.js | 3 +- docs/search/functions_7.js | 3 +- docs/search/functions_c.js | 1 + docs/search/functions_d.js | 2 +- docs/shape_8hpp_source.html | 2 +- docs/structade_1_1_coord_map-members.html | 7 +-- docs/structade_1_1_coord_map.html | 33 ++++++++++++++ docs/structade_1_1i_coord_map-members.html | 7 +-- docs/structade_1_1i_coord_map.html | 33 ++++++++++++++ 28 files changed, 186 insertions(+), 28 deletions(-) mode change 100755 => 100644 .dockerignore mode change 100755 => 100644 .gitignore mode change 100755 => 100644 .travis.yml diff --git a/.dockerignore b/.dockerignore old mode 100755 new mode 100644 diff --git a/.gitignore b/.gitignore old mode 100755 new mode 100644 diff --git a/.travis.yml b/.travis.yml old mode 100755 new mode 100644 diff --git a/Doxyfile b/Doxyfile index 4eb1da3cd..412ec25a2 100644 --- a/Doxyfile +++ b/Doxyfile @@ -874,7 +874,7 @@ RECURSIVE = YES # Note that relative paths are relative to the directory from which doxygen is # run. -EXCLUDE = ade/test bwd/test +EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded @@ -890,7 +890,7 @@ EXCLUDE_SYMLINKS = NO # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories for example use the pattern */test/* -EXCLUDE_PATTERNS = +EXCLUDE_PATTERNS = */test */bm # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the diff --git a/docs/coord_8hpp_source.html b/docs/coord_8hpp_source.html index d9a8cd4ea..81b64b148 100644 --- a/docs/coord_8hpp_source.html +++ b/docs/coord_8hpp_source.html @@ -69,31 +69,34 @@
coord.hpp
-Go to the documentation of this file.
1 
9 #include <functional>
10 
11 #include "ade/matops.hpp"
12 
13 #ifndef ADE_COORD_HPP
14 #define ADE_COORD_HPP
15 
16 namespace ade
17 {
18 
20 struct iCoordMap
21 {
22  virtual ~iCoordMap (void) = default;
23 
25  virtual iCoordMap* connect (const iCoordMap& rhs) const = 0;
26 
28  virtual void forward (CoordT::iterator out,
29  CoordT::const_iterator in) const = 0;
30 
33  virtual iCoordMap* reverse (void) const = 0;
34 
36  virtual std::string to_string (void) const = 0;
37 
40  virtual void access (std::function<void(const MatrixT&)> cb) const = 0;
41 };
42 
45 struct CoordMap final : public iCoordMap
46 {
47  CoordMap (std::function<void(MatrixT)> init)
48  {
49  std::memset(fwd_, 0, mat_size);
50  fwd_[rank_cap][rank_cap] = 1;
51  init(fwd_);
52  }
53 
55  iCoordMap* connect (const iCoordMap& rhs) const override
56  {
57  return new CoordMap([&](MatrixT out)
58  {
59  rhs.access([&](const MatrixT& in)
60  {
61  matmul(out, fwd_, in);
62  });
63  });
64  }
65 
67  void forward (CoordT::iterator out,
68  CoordT::const_iterator in) const override;
69 
71  iCoordMap* reverse (void) const override
72  {
73  return new CoordMap([this](MatrixT m)
74  {
75  inverse(m, this->fwd_);
76  });
77  }
78 
80  std::string to_string (void) const override
81  {
82  return ade::to_string(fwd_);
83  }
84 
86  void access (std::function<void(const MatrixT&)> cb) const override
87  {
88  cb(fwd_);
89  }
90 
91 private:
94 };
95 
97 using CoordptrT = std::shared_ptr<iCoordMap>;
98 
100 extern CoordptrT identity;
101 
106 CoordptrT reduce (uint8_t rank, std::vector<DimT> red);
107 
112 CoordptrT extend (uint8_t rank, std::vector<DimT> ext);
113 
122 CoordptrT permute (std::vector<uint8_t> order);
123 
127 CoordptrT flip (uint8_t dim);
128 
129 }
130 
131 #endif // ADE_COORD_HPP
virtual void forward(CoordT::iterator out, CoordT::const_iterator in) const =0
Forward transform coordinates.
+Go to the documentation of this file.
1 
9 #include <functional>
10 
11 #include "ade/matops.hpp"
12 
13 #ifndef ADE_COORD_HPP
14 #define ADE_COORD_HPP
15 
16 namespace ade
17 {
18 
20 struct iCoordMap
21 {
22  virtual ~iCoordMap (void) = default;
23 
25  virtual iCoordMap* connect (const iCoordMap& rhs) const = 0;
26 
28  virtual void forward (CoordT::iterator out,
29  CoordT::const_iterator in) const = 0;
30 
33  virtual iCoordMap* reverse (void) const = 0;
34 
36  virtual std::string to_string (void) const = 0;
37 
40  virtual void access (std::function<void(const MatrixT&)> cb) const = 0;
41 
43  virtual bool is_bijective (void) const = 0;
44 };
45 
48 struct CoordMap final : public iCoordMap
49 {
50  CoordMap (std::function<void(MatrixT)> init)
51  {
52  std::memset(fwd_, 0, mat_size);
53  fwd_[rank_cap][rank_cap] = 1;
54  init(fwd_);
55  }
56 
58  iCoordMap* connect (const iCoordMap& rhs) const override
59  {
60  return new CoordMap([&](MatrixT out)
61  {
62  rhs.access([&](const MatrixT& in)
63  {
64  matmul(out, fwd_, in);
65  });
66  });
67  }
68 
70  void forward (CoordT::iterator out,
71  CoordT::const_iterator in) const override;
72 
74  iCoordMap* reverse (void) const override
75  {
76  return new CoordMap([this](MatrixT m)
77  {
78  inverse(m, this->fwd_);
79  });
80  }
81 
83  std::string to_string (void) const override
84  {
85  return ade::to_string(fwd_);
86  }
87 
89  void access (std::function<void(const MatrixT&)> cb) const override
90  {
91  cb(fwd_);
92  }
93 
95  bool is_bijective (void) const override
96  {
97  return (int) determinant(fwd_) != 0;
98  }
99 
100 private:
103 };
104 
106 using CoordptrT = std::shared_ptr<iCoordMap>;
107 
109 extern CoordptrT identity;
110 
115 CoordptrT reduce (uint8_t rank, std::vector<DimT> red);
116 
121 CoordptrT extend (uint8_t rank, std::vector<DimT> ext);
122 
131 CoordptrT permute (std::vector<uint8_t> order);
132 
136 CoordptrT flip (uint8_t dim);
137 
138 }
139 
140 #endif // ADE_COORD_HPP
virtual void forward(CoordT::iterator out, CoordT::const_iterator in) const =0
Forward transform coordinates.
CoordptrT flip(uint8_t dim)
+
virtual bool is_bijective(void) const =0
Return true if this instance maps coordinates/shapes bijectively.
virtual ~iCoordMap(void)=default
const uint8_t rank_cap
Number of dimsensions in a shape/coordinate.
Definition: shape.hpp:34
virtual std::string to_string(void) const =0
Return string representation of coordinate transformer.
-
std::shared_ptr< iCoordMap > CoordptrT
Type of iCoordMap smartpointer.
Definition: coord.hpp:97
-
void access(std::function< void(const MatrixT &)> cb) const override
Implementation of iCoordMap.
Definition: coord.hpp:86
-
CoordMap(std::function< void(MatrixT)> init)
Definition: coord.hpp:47
+
bool is_bijective(void) const override
Implementation of iCoordMap.
Definition: coord.hpp:95
+
std::shared_ptr< iCoordMap > CoordptrT
Type of iCoordMap smartpointer.
Definition: coord.hpp:106
+
void access(std::function< void(const MatrixT &)> cb) const override
Implementation of iCoordMap.
Definition: coord.hpp:89
+
CoordMap(std::function< void(MatrixT)> init)
Definition: coord.hpp:50
virtual void access(std::function< void(const MatrixT &)> cb) const =0
void matmul(MatrixT out, const MatrixT &lhs, const MatrixT &rhs)
Apply matrix multiplication for lhs and rhs to out matrix.
-
iCoordMap * connect(const iCoordMap &rhs) const override
Implementation of iCoordMap.
Definition: coord.hpp:55
+
iCoordMap * connect(const iCoordMap &rhs) const override
Implementation of iCoordMap.
Definition: coord.hpp:58
CoordptrT extend(uint8_t rank, std::vector< DimT > ext)
const size_t mat_size
Number of bytes in a homogeneous matrix.
Definition: matops.hpp:25
CoordptrT identity
Identity matrix instance.
Interface for transforming coordinates and reversing the coordinate.
Definition: coord.hpp:20
double[mat_dim][mat_dim] MatrixT
Coordinate transformation matrix (using homogeneous)
Definition: matops.hpp:28
Definition: ade.hpp:13
-
Definition: coord.hpp:45
-
std::string to_string(void) const override
Implementation of iCoordMap.
Definition: coord.hpp:80
+
Definition: coord.hpp:48
+
std::string to_string(void) const override
Implementation of iCoordMap.
Definition: coord.hpp:83
void forward(CoordT::iterator out, CoordT::const_iterator in) const override
Implementation of iCoordMap.
-
iCoordMap * reverse(void) const override
Implementation of iCoordMap.
Definition: coord.hpp:71
+
double determinant(const MatrixT &mat)
+
iCoordMap * reverse(void) const override
Implementation of iCoordMap.
Definition: coord.hpp:74
virtual iCoordMap * reverse(void) const =0
CoordptrT permute(std::vector< uint8_t > order)
-
MatrixT fwd_
Forward transformation matrix.
Definition: coord.hpp:93
+
MatrixT fwd_
Forward transformation matrix.
Definition: coord.hpp:102
std::string to_string(const MatrixT &mat)
Return the string representation of input matrix.
virtual iCoordMap * connect(const iCoordMap &rhs) const =0
Return matmul(this, rhs)
void inverse(MatrixT out, const MatrixT &in)
Inverse in matrix and dump to out matrix.
diff --git a/docs/functions.html b/docs/functions.html index 3106799f0..3de2110a9 100644 --- a/docs/functions.html +++ b/docs/functions.html @@ -184,6 +184,10 @@

- g -

-Go to the documentation of this file.
1 
10 #include <cassert>
11 #include <cstring>
12 
13 #include "ade/shape.hpp"
14 
15 #ifndef ADE_MATOPS_HPP
16 #define ADE_MATOPS_HPP
17 
18 namespace ade
19 {
20 
22 const uint8_t mat_dim = rank_cap + 1;
23 
25 const size_t mat_size = sizeof(double) * mat_dim * mat_dim;
26 
28 using MatrixT = double[mat_dim][mat_dim];
29 
31 std::string to_string (const MatrixT& mat);
32 
34 void inverse (MatrixT out, const MatrixT& in);
35 
37 void matmul (MatrixT out, const MatrixT& lhs, const MatrixT& rhs);
38 
39 }
40 
41 #endif
const uint8_t rank_cap
Number of dimsensions in a shape/coordinate.
Definition: shape.hpp:34
+Go to the documentation of this file.
1 
10 #include <cassert>
11 #include <cstring>
12 
13 #include "ade/shape.hpp"
14 
15 #ifndef ADE_MATOPS_HPP
16 #define ADE_MATOPS_HPP
17 
18 namespace ade
19 {
20 
22 const uint8_t mat_dim = rank_cap + 1;
23 
25 const size_t mat_size = sizeof(double) * mat_dim * mat_dim;
26 
28 using MatrixT = double[mat_dim][mat_dim];
29 
31 std::string to_string (const MatrixT& mat);
32 
33 double determinant (const MatrixT& mat);
34 
36 void inverse (MatrixT out, const MatrixT& in);
37 
39 void matmul (MatrixT out, const MatrixT& lhs, const MatrixT& rhs);
40 
41 }
42 
43 #endif
const uint8_t rank_cap
Number of dimsensions in a shape/coordinate.
Definition: shape.hpp:34
const uint8_t mat_dim
Number of rows and columns for the homogeneous matrix.
Definition: matops.hpp:22
void matmul(MatrixT out, const MatrixT &lhs, const MatrixT &rhs)
Apply matrix multiplication for lhs and rhs to out matrix.
const size_t mat_size
Number of bytes in a homogeneous matrix.
Definition: matops.hpp:25
double[mat_dim][mat_dim] MatrixT
Coordinate transformation matrix (using homogeneous)
Definition: matops.hpp:28
Definition: ade.hpp:13
+
double determinant(const MatrixT &mat)
std::string to_string(const MatrixT &mat)
Return the string representation of input matrix.
void inverse(MatrixT out, const MatrixT &in)
Inverse in matrix and dump to out matrix.
diff --git a/docs/menudata.js b/docs/menudata.js index c73c95c23..2a18a3c81 100644 --- a/docs/menudata.js +++ b/docs/menudata.js @@ -75,6 +75,7 @@ var menudata={children:[ {text:"e",url:"functions_func.html#index_e"}, {text:"f",url:"functions_func.html#index_f"}, {text:"g",url:"functions_func.html#index_g"}, +{text:"i",url:"functions_func.html#index_i"}, {text:"m",url:"functions_func.html#index_m"}, {text:"n",url:"functions_func.html#index_n"}, {text:"o",url:"functions_func.html#index_o"}, diff --git a/docs/mtens_8hpp.html b/docs/mtens_8hpp.html index 5b64a5419..09fcc7392 100644 --- a/docs/mtens_8hpp.html +++ b/docs/mtens_8hpp.html @@ -119,6 +119,8 @@ MappedTensor ade::identity_map (TensptrT tensor)  Return MappedTensor that identity maps input tensor. More...
  +MappedTensor ade::reduce_1d_map (TensptrT tensor, uint8_t rank) +  MappedTensor ade::reduce_map (TensptrT tensor, uint8_t rank, std::vector< DimT > red)   MappedTensor ade::extend_map (TensptrT tensor, uint8_t rank, std::vector< DimT > ext) diff --git a/docs/mtens_8hpp_source.html b/docs/mtens_8hpp_source.html index ea51389b1..107f1fc1b 100644 --- a/docs/mtens_8hpp_source.html +++ b/docs/mtens_8hpp_source.html @@ -69,7 +69,7 @@
mtens.hpp
-Go to the documentation of this file.
1 #include "ade/itensor.hpp"
2 #include "ade/coord.hpp"
3 
4 #ifndef ADE_MTENS_HPP
5 #define ADE_MTENS_HPP
6 
7 namespace ade
8 {
9 
11 struct MappedTensor final
12 {
14  MappedTensor (TensptrT tensor, CoordptrT shaper) :
15  tensor_(tensor), shaper_(shaper)
16  {
17  if (tensor_ == nullptr)
18  {
19  logs::fatal("cannot map a null tensor");
20  }
21  map_io_ = tensor_->shape().n_elems() > shape().n_elems();
22  if (shaper == identity || map_io_)
23  {
24  coorder_ = shaper;
25  }
26  else
27  {
28  coorder_ = CoordptrT(shaper->reverse());
29  }
30  }
31 
33  MappedTensor (TensptrT tensor, CoordptrT shaper,
34  bool map_io, CoordptrT coorder) :
35  tensor_(tensor), shaper_(shaper),
36  map_io_(map_io), coorder_(coorder)
37  {
38  if (tensor_ == nullptr)
39  {
40  logs::fatal("cannot map a null tensor");
41  }
42  }
43 
45  Shape shape (void) const
46  {
47  ade::Shape shape = tensor_->shape();
48  CoordT out;
49  CoordT in;
50  std::copy(shape.begin(), shape.end(), in.begin());
51  shaper_->forward(out.begin(), in.begin());
52  std::vector<DimT> slist(rank_cap);
53  std::transform(out.begin(), out.end(), slist.begin(),
54  [](CDimT cd) -> DimT
55  {
56  if (cd < 0)
57  {
58  cd = -cd - 1;
59  }
60  return std::round(cd);
61  });
62  return Shape(slist);
63  }
64 
66  TensptrT get_tensor (void) const
67  {
68  return tensor_;
69  }
70 
72  CoordptrT get_shaper (void) const
73  {
74  return shaper_;
75  }
76 
79  bool map_io (void) const
80  {
81  return map_io_;
82  }
83 
85  CoordptrT get_coorder (void) const
86  {
87  return coorder_;
88  }
89 
90 private:
93 
96 
99  bool map_io_;
100 
103 };
104 
107 
111  uint8_t rank, std::vector<DimT> red);
112 
116  uint8_t rank, std::vector<DimT> ext);
117 
119 MappedTensor permute_map (TensptrT tensor, std::vector<uint8_t> order);
120 
122 MappedTensor flip_map (TensptrT tensor, uint8_t dim);
123 
124 }
125 
126 #endif // ADE_MTENS_HPP
MappedTensor extend_map(TensptrT tensor, uint8_t rank, std::vector< DimT > ext)
+Go to the documentation of this file.
1 #include "ade/itensor.hpp"
2 #include "ade/coord.hpp"
3 
4 #ifndef ADE_MTENS_HPP
5 #define ADE_MTENS_HPP
6 
7 namespace ade
8 {
9 
11 struct MappedTensor final
12 {
14  MappedTensor (TensptrT tensor, CoordptrT shaper) :
15  tensor_(tensor), shaper_(shaper)
16  {
17  if (tensor_ == nullptr)
18  {
19  logs::fatal("cannot map a null tensor");
20  }
21  map_io_ = tensor_->shape().n_elems() > shape().n_elems();
22  if (shaper == identity || map_io_)
23  {
24  coorder_ = shaper;
25  }
26  else
27  {
28  coorder_ = CoordptrT(shaper->reverse());
29  }
30  }
31 
33  MappedTensor (TensptrT tensor, CoordptrT shaper,
34  bool map_io, CoordptrT coorder) :
35  tensor_(tensor), shaper_(shaper),
36  map_io_(map_io), coorder_(coorder)
37  {
38  if (tensor_ == nullptr)
39  {
40  logs::fatal("cannot map a null tensor");
41  }
42  }
43 
45  Shape shape (void) const
46  {
47  ade::Shape shape = tensor_->shape();
48  CoordT out;
49  CoordT in;
50  std::copy(shape.begin(), shape.end(), in.begin());
51  shaper_->forward(out.begin(), in.begin());
52  std::vector<DimT> slist(rank_cap);
53  std::transform(out.begin(), out.end(), slist.begin(),
54  [](CDimT cd) -> DimT
55  {
56  if (cd < 0)
57  {
58  cd = -cd - 1;
59  }
60  return std::round(cd);
61  });
62  return Shape(slist);
63  }
64 
66  TensptrT get_tensor (void) const
67  {
68  return tensor_;
69  }
70 
72  CoordptrT get_shaper (void) const
73  {
74  return shaper_;
75  }
76 
79  bool map_io (void) const
80  {
81  return map_io_;
82  }
83 
85  CoordptrT get_coorder (void) const
86  {
87  return coorder_;
88  }
89 
90 private:
93 
96 
99  bool map_io_;
100 
103 };
104 
107 
108 MappedTensor reduce_1d_map (TensptrT tensor, uint8_t rank);
109 
113  uint8_t rank, std::vector<DimT> red);
114 
118  uint8_t rank, std::vector<DimT> ext);
119 
121 MappedTensor permute_map (TensptrT tensor, std::vector<uint8_t> order);
122 
124 MappedTensor flip_map (TensptrT tensor, uint8_t dim);
125 
126 }
127 
128 #endif // ADE_MTENS_HPP
MappedTensor extend_map(TensptrT tensor, uint8_t rank, std::vector< DimT > ext)
MappedTensor permute_map(TensptrT tensor, std::vector< uint8_t > order)
Return MappedTensor that permutes input tensor by order.
bool map_io(void) const
Definition: mtens.hpp:79
CoordptrT shaper_
Shape mapper.
Definition: mtens.hpp:95
@@ -80,7 +80,7 @@
Shape shape(void) const
Return shape of tensor filtered through coordinate mapper.
Definition: mtens.hpp:45
iterator end(void)
Return end iterator of internal array.
Definition: shape.hpp:149
-
std::shared_ptr< iCoordMap > CoordptrT
Type of iCoordMap smartpointer.
Definition: coord.hpp:97
+
std::shared_ptr< iCoordMap > CoordptrT
Type of iCoordMap smartpointer.
Definition: coord.hpp:106
NElemT n_elems(void) const
Return the total number of elements represented by the shape.
Definition: shape.hpp:105
iterator begin(void)
Return begin iterator of internal array.
Definition: shape.hpp:143
CoordptrT identity
Identity matrix instance.
@@ -97,6 +97,7 @@
Coordinate mapper and tensor pair.
Definition: mtens.hpp:11
std::array< CDimT, rank_cap > CoordT
Definition: shape.hpp:43
TensptrT get_tensor(void) const
Return tensor being mapped.
Definition: mtens.hpp:66
+
MappedTensor reduce_1d_map(TensptrT tensor, uint8_t rank)
CoordptrT coorder_
Coordinate mapper.
Definition: mtens.hpp:102
MappedTensor flip_map(TensptrT tensor, uint8_t dim)
Return MappedTensor that flips input tensor along dimension.
MappedTensor reduce_map(TensptrT tensor, uint8_t rank, std::vector< DimT > red)
diff --git a/docs/namespaceade.html b/docs/namespaceade.html index fda73b3ce..b979ba8fa 100644 --- a/docs/namespaceade.html +++ b/docs/namespaceade.html @@ -154,6 +154,8 @@ std::string to_string (const MatrixT &mat)  Return the string representation of input matrix. More...
  +double determinant (const MatrixT &mat) +  void inverse (MatrixT out, const MatrixT &in)  Inverse in matrix and dump to out matrix. More...
  @@ -163,6 +165,8 @@ MappedTensor identity_map (TensptrT tensor)  Return MappedTensor that identity maps input tensor. More...
  +MappedTensor reduce_1d_map (TensptrT tensor, uint8_t rank) +  MappedTensor reduce_map (TensptrT tensor, uint8_t rank, std::vector< DimT > red)   MappedTensor extend_map (TensptrT tensor, uint8_t rank, std::vector< DimT > ext) @@ -423,6 +427,24 @@

Return the coordinate of a flat index according to shape Coordinate dimensions are 0-based For example [0, 0, ..., 0] <-> 0

+

+
+ +

◆ determinant()

+ +
+
+ + + + + + + + +
double ade::determinant (const MatrixTmat)
+
+
@@ -729,6 +751,34 @@

Return coordinate mapper dividing dimensions after rank by values in red vector For example, given coordinate [2, 2, 6, 6], rank=2, and red=[3, 3], mapper forward transforms to coordinate [2, 2, 2, 2]

+

+ + +

◆ reduce_1d_map()

+ +
+
+ + + + + + + + + + + + + + + + + + +
MappedTensor ade::reduce_1d_map (TensptrT tensor,
uint8_t rank 
)
+
+
diff --git a/docs/namespacemembers.html b/docs/namespacemembers.html index 3cc50269b..3b97b6f0b 100644 --- a/docs/namespacemembers.html +++ b/docs/namespacemembers.html @@ -87,6 +87,9 @@

- c -