The ChainCon Software (Release 0.03)
awdiag.h
Go to the documentation of this file.
1 /////////////////////////////////////////////////////////////////////////////
2 ///
3 /// \file
4 ///
5 /// Alexander-Whitney diagonal of a chain.
6 ///
7 /////////////////////////////////////////////////////////////////////////////
8 
9 // Copyright (C) 2009-2016 by Pawel Pilarczyk.
10 //
11 // This file is part of my research software package. This is free software:
12 // you can redistribute it and/or modify it under the terms of the GNU
13 // General Public License as published by the Free Software Foundation,
14 // either version 3 of the License, or (at your option) any later version.
15 //
16 // This software is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this software; see the file "license.txt". If not,
23 // please, see <http://www.gnu.org/licenses/>.
24 
25 // Started on March 24, 2009. Last revision: April 12, 2013.
26 
27 
28 #ifndef _CHAINCON_AWDIAG_H_
29 #define _CHAINCON_AWDIAG_H_
30 
31 
32 // include some standard C++ header files
33 #include <istream>
34 #include <ostream>
35 
36 // include selected header files from the CHomP library
37 #include "chomp/system/config.h"
38 
39 // include relevant local header files
40 #include "chaincon/combtensor.h"
41 #include "chaincon/tensor.h"
42 
43 
44 // --------------------------------------------------
45 // ------------------ AW diagonal -------------------
46 // --------------------------------------------------
47 
48 /// Computes the Alexander-Whitney diagonal of a chain,
49 /// using the procedure defined for individual cells.
50 template <class CellT>
51 inline void AWdiagonal (const tCombChain<CellT> &ch,
53 {
54  int_t size = ch. size ();
55  for (int_t n = 0; n < size; ++ n)
56  AWdiagonal (ch. getCell (n), t);
57  return;
58 } /* AWdiagonal */
59 
60 /// Computes the Alexander-Whitney diagonal of a chain,
61 /// using the procedure defined for individual cells.
62 template <class CellT, class CoefT>
63 inline void AWdiagonal (const tChain<CellT,CoefT> &ch,
65 {
66  int_t size = ch. size ();
67  for (int_t n = 0; n < size; ++ n)
68  {
69  if (ch. getCoef (n) == 1)
70  {
71  AWdiagonal (ch. getCell (n), t);
72  }
73  else
74  {
76  AWdiagonal (ch. getCell (n), tmp);
77  tmp *= ch. getCoef (n);
78  t += tmp;
79  }
80  }
81  return;
82 } /* AWdiagonal */
83 
84 
85 #endif // _CHAINCON_AWDIAG_H_
86 
A chain with coefficients in an arbitrary ring.
Definition: chain.h:50
A tensor of chains with coefficients in an arbitrary commutative ring.
Tensor of chains.
Definition: tensor.h:52
Combinatorial tensor of cells.
Definition: combtensor.h:53
A combinatorial chain.
Definition: combchain.h:49
A combinatorial tensor (for coefficients in Z_2).
void AWdiagonal(const tCombChain< CellT > &ch, tCombTensor< CellT, CellT > &t)
Computes the Alexander-Whitney diagonal of a chain, using the procedure defined for individual cells...
Definition: awdiag.h:51