Tenncor
Classes | Typedefs | Functions | Variables
tag Namespace Reference

Classes

struct  GroupRegistry
 
struct  GroupTag
 
struct  iTag
 
struct  PropertyRegistry
 TagRegistry wrapper to tag and check properties on tensors. More...
 
struct  PropTag
 PropTag (properties tag) define node properties. More...
 
struct  Query
 
struct  Subgraph
 Subgraph group encapsulation. More...
 
struct  TagCollective
 Collective of generic iTag instances. More...
 
struct  TagRegistry
 Registry for associating tensors to tag collectives. More...
 
struct  TensKey
 Tensor ref key wrapper. More...
 
struct  TensKeyHash
 TensKey hasher. More...
 

Typedefs

using TensSetT = std::unordered_set< TensKey, TensKeyHash >
 Tensor ref set. More...
 
using AGroupsT = std::map< std::string, std::unordered_set< std::string > >
 
using AdjMapT = std::unordered_map< teq::iTensor *, AGroupsT >
 Map tensors to groups. More...
 
using SgraphptrT = std::shared_ptr< Subgraph >
 Smart pointer of the subgraph. More...
 
using SubgraphsT = std::unordered_set< SgraphptrT >
 Set of subgraphs. More...
 
using SubgraphAssocsT = std::unordered_map< teq::iTensor *, SubgraphsT >
 Root of the subgraph associated with the subgraph representations. More...
 
using TagRepsT = std::map< std::string, std::vector< std::string > >
 Map tag key to a series of labels. More...
 
using TagptrT = std::unique_ptr< iTag >
 Unique pointer of tag. More...
 
using TagrF = std::function< void(teq::TensrefT, std::string)>
 Function that associate tag key to tensor ref. More...
 
using LTensT = std::unordered_map< std::string, std::vector< teq::iTensor * > >
 Map tag label to any tensor with label. More...
 
using TTensT = std::unordered_map< std::string, LTensT >
 Map tag key to label-tensor association. More...
 

Functions

GroupRegistryget_group_reg (void)
 Return reference to global group registry. More...
 
void recursive_group_tag (teq::TensptrT tens, std::string group, teq::TensSetT stops, GroupRegistry &registry=get_group_reg())
 
void adjacencies (AdjMapT &out, teq::TensptrsT roots, GroupRegistry &registry=get_group_reg())
 
void beautify_groups (SubgraphAssocsT &out, const AdjMapT &adjs)
 
void filter_head (SubgraphAssocsT &out, const SubgraphAssocsT &assocs)
 
PropertyRegistryget_property_reg (void)
 Return reference to global property registry. More...
 
bool operator== (const TensKey &lhs, const TensKey &rhs)
 TensKey equality overload. More...
 
TagRegistryget_reg (void)
 Return reference to global tag registry. More...
 
void recursive_tag (teq::TensptrT root, teq::TensSetT stops, std::function< void(teq::TensrefT)> tag_op)
 

Variables

const std::string groups_key
 Identifier of groups tag. More...
 
const std::string commutative_tag = "commutative"
 Identifier for commutative property. More...
 
const std::string immutable_tag = "immutable"
 Identifier for immutable property. More...
 
const std::string props_key
 Identifier of property tag. More...
 

Detailed Description

group.hpp tag

Purpose: Implement group tag

prop.hpp tag

Purpose: Implement property tag

tag.hpp tag

Purpose: Define tag interface and tag registry

Typedef Documentation

◆ AdjMapT

using tag::AdjMapT = typedef std::unordered_map<teq::iTensor*,AGroupsT>

Map tensors to groups.

◆ AGroupsT

using tag::AGroupsT = typedef std::map<std::string,std::unordered_set<std::string> >

Map group label to unique ids specifying different adjacent groups of the same label

◆ LTensT

using tag::LTensT = typedef std::unordered_map<std::string,std::vector<teq::iTensor*> >

Map tag label to any tensor with label.

◆ SgraphptrT

using tag::SgraphptrT = typedef std::shared_ptr<Subgraph>

Smart pointer of the subgraph.

◆ SubgraphAssocsT

using tag::SubgraphAssocsT = typedef std::unordered_map<teq::iTensor*,SubgraphsT>

Root of the subgraph associated with the subgraph representations.

◆ SubgraphsT

using tag::SubgraphsT = typedef std::unordered_set<SgraphptrT>

Set of subgraphs.

◆ TagptrT

using tag::TagptrT = typedef std::unique_ptr<iTag>

Unique pointer of tag.

◆ TagRepsT

using tag::TagRepsT = typedef std::map<std::string,std::vector<std::string> >

Map tag key to a series of labels.

◆ TagrF

using tag::TagrF = typedef std::function<void(teq::TensrefT,std::string)>

Function that associate tag key to tensor ref.

◆ TensSetT

using tag::TensSetT = typedef std::unordered_set<TensKey,TensKeyHash>

Tensor ref set.

◆ TTensT

using tag::TTensT = typedef std::unordered_map<std::string,LTensT>

Map tag key to label-tensor association.

Function Documentation

◆ adjacencies()

void tag::adjacencies ( AdjMapT out,
teq::TensptrsT  roots,
GroupRegistry registry = get_group_reg() 
)

Populate out with every grouped-node under roots subgraphs and associate to unique adjacent groups

◆ beautify_groups()

void tag::beautify_groups ( SubgraphAssocsT out,
const AdjMapT adjs 
)

Populate subgraph associations using adjacency output out associates every tensor under an adjacent group to its subgraph representations

◆ filter_head()

void tag::filter_head ( SubgraphAssocsT out,
const SubgraphAssocsT assocs 
)

Transform subgraph content tensor-subgraph representation associations to subgraph root-subgraph representation associations

◆ get_group_reg()

GroupRegistry& tag::get_group_reg ( void  )

Return reference to global group registry.

◆ get_property_reg()

PropertyRegistry& tag::get_property_reg ( void  )

Return reference to global property registry.

◆ get_reg()

TagRegistry& tag::get_reg ( void  )

Return reference to global tag registry.

◆ operator==()

bool tag::operator== ( const TensKey lhs,
const TensKey rhs 
)
inline

TensKey equality overload.

◆ recursive_group_tag()

void tag::recursive_group_tag ( teq::TensptrT  tens,
std::string  group,
teq::TensSetT  stops,
GroupRegistry registry = get_group_reg() 
)

Recursive add every nodes under root's graph to specified group ignoring subgraphs of roots in stops set

◆ recursive_tag()

void tag::recursive_tag ( teq::TensptrT  root,
teq::TensSetT  stops,
std::function< void(teq::TensrefT)>  tag_op 
)

Recursive apply tag_op to nodes under root's graph ignoring subgraphs of roots in stops set

Variable Documentation

◆ commutative_tag

const std::string tag::commutative_tag = "commutative"

Identifier for commutative property.

◆ groups_key

const std::string tag::groups_key
Initial value:
= get_reg().register_tagr("groups",
[](teq::TensrefT ref, std::string tag)
{
})
Definition: group.hpp:17
std::string register_tagr(std::string tag_key, TagrF tagr)
Definition: tag.hpp:232
TagRegistry & get_reg(void)
Return reference to global tag registry.
void group_tag(teq::TensrefT tens, std::string tag)
Bidirectionally assocate tensor and group.
Definition: group.hpp:63
GroupRegistry & get_group_reg(void)
Return reference to global group registry.
std::weak_ptr< iTensor > TensrefT
Tensor weak pointers.
Definition: itensor.hpp:54

Identifier of groups tag.

◆ immutable_tag

const std::string tag::immutable_tag = "immutable"

Identifier for immutable property.

◆ props_key

const std::string tag::props_key
Initial value:
= get_reg().register_tagr("properties",
[](teq::TensrefT ref, std::string property)
{
get_property_reg().property_tag(ref, property);
})
std::string register_tagr(std::string tag_key, TagrF tagr)
Definition: tag.hpp:232
void property_tag(teq::TensrefT tens, std::string property)
Associate property with tensor.
Definition: prop.hpp:57
TagRegistry & get_reg(void)
Return reference to global tag registry.
PropertyRegistry & get_property_reg(void)
Return reference to global property registry.
std::weak_ptr< iTensor > TensrefT
Tensor weak pointers.
Definition: itensor.hpp:54

Identifier of property tag.