Conditional Independence Net

This website uses Javascript to render markdown documents in your browser, apply syntax highlighting to code fragments and render $\LaTeX$ formulas. Below is the markdown source code of this page. You can either read that or enable Javascript to have it rendered to HTML.

# NAME

CInet::Imset - Integer-valued multiset

# SYNOPSIS

    my $cube = Cube(5);  # see L<CInet::Cube> and L<CInet::Cube::Polyhedral>
    # Create an imset with 1's in [1,3] and [2,3] and -1's in [1,2,3] and [3].
    my $Δ = $cube->ci([1,3], [2,3]);

# DESCRIPTION

This class represents an integer-valued multiset (_imset_) over a finite
ground set `$N`. This maps every subset of `$N` to an integer. In this
module, subsets of `$N` are identified with `Cube($N)->vertices`.

## Methods

### new

    my $h = CInet::Imset->new($cube);
    my $h = CInet::Imset->new($cube, @elts);

Create a new CInet::Imset object. The first argument is the mandatory
[CInet::Cube](/doc/CInet%3A%3ACube) instances which provides the ground set of the imset.
All other arguments are subsets of the ground set (encoded as arrayrefs)
which are set to `1` in the returned imset.

### clone

    my $copy = $h->clone;

Creates a deep copy of the imset.

This method is inherited from [Clone](/doc/Clone).

### is\_zero

    my $bool = $h->is_zero;

Returns whether the imset is identically zero.

### cube

    my $cube = $h->cube;

Returns the `$cube` the imset was created with.

### val

    my $v = $h->val($K);

Return the integer `$v` associated with the subset `$K`.

### ci

    my $bool = $h->ci($ijK);

Given a 2-face `(ij|K)` of `$h->cube`, return whether `$h` is
modular at `(ij|K)`, i.e., whether it satisfies

    h(iK) + h(jK) == h(ijK) + h(K).

This is the definition of conditional independence `i ⫫ j | K` for
an imset.

### relation

    my $A = $h->relation;

Return the [CInet::Relation](/doc/CInet%3A%3ARelation) associated to this imset by repeatedly
calling [ci](#ci).

### permute

    my $hp = $h->permute($p);

Given a permutation `$p` of the ground set (in one-line notation),
return the permuted imset which exists over the same `$cube`.

### co

    my $hc = $h->co;

Return the co-imset of `$h` which at a subset `$K` takes the value
which `$h` takes at the complement of `$K`.

### 

    my $hZ = $h->swap($Z);

Apply a swap of the ground set to the relation. The resulting imset
exists over the same `$cube` and contains exactly the images of the
invocant's squares under the `$cube->swap` method.

### to\_string

    my $str = $h->to_string;

Stringify the imset. The result is a space-separated string of the
integer values, in the order of `$cube->vertices`.

## Overloaded operators

### Addition

    my $f = $g + $h;

Add imsets over the same cube element-wise.

### Unary negation

    my $mh = -$h;

Negate the imset element-wise.

### Subtraction

    my $f = $g - $h;

The inverse of addition.

### Multiplication

    my $v = $g * $h;
    my $hc = $c * $h;

If both operands are imsets, then the operation performed is the scalar
product of them and the result is a scalar. If one operand is a scalar,
then it scales the imset element-wise and the result is an imset over
the same cube.

### Stringification

    my $str = "$h";

Stringify an imset, cf. [to\_string](#to_string).

# AUTHOR

Tobias Boege <tobs@taboege.de>

# COPYRIGHT AND LICENSE

This software is copyright (C) 2020 by Tobias Boege.

This is free software; you can redistribute it and/or
modify it under the terms of the Artistic License 2.0.