Direct sampler

Direct sampler by contiguity relations of GKZ hypergeometric systems

Version 0.1

November 3, 2025

by S.Mano, N.Takayama

Copyright © Risa/Asir committers 2004–2025. All rights reserved.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1 About this document

This document explains Risa/Asir functions for direct sampler by contiguity relations of GKZ hypergeometric systems
Loading the package:

import("gtt_ds.rr");

References cited in this document.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2 Simplicial complex to A matrix


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.1 gtt_ds.getA

gtt_ds.getA(Levels,Facets)

:: It returns a matrix A standings for a simplicial complex defined by Facets and the set of levels of each vertex Levels.

return

Matrix A to define a GKZ system.

Levels

Levels of each vertex of the simplicial complex Facets.

Facets

The set of facets of a simplicial complex. A facet is expressed by a 0, 1 vector. 1 stands for the vertex of the position belongs to the facet and 0 stands for the vertex of the position does not belong to the facet.

Example: Consider the simplicial complex [1][2] (independent two points) with Levels=[2,2]. Then, the rows of the matrix A is indexed by [1,0],[2,0],[0,1],[0,2] and the columns of the matrix A is indexed by [1,1],[1,2],[2,1],[2,2]. The matrix A is \pmatrix{1&1&0&0\cr 0&0&1&1\cr 1&0&1&0\cr 0&1&0&1\cr } For example, [1,0],[1,1] matches (1?,11, replace 0 by the wild card ? and regard it a regular expression), [1,0],[1,2] also matches (1?,12), but [1,0],[0,1] does not match (1?,01).

[2122] import("gtt_ds.rr");
[4432] gtt_ds.getA([2,2],[[1,0],[0,1]]);
[ 1 1 0 0 ]
[ 0 0 1 1 ]
[ 1 0 1 0 ]
[ 0 1 0 1 ]

Example: Consider the simplicial complex [1][2] (independent two points) with Levels=[2,3]. Then, the rows of the matrix A is indexed by [1,0],[2,0],[0,1],[0,2],[0,3] and the columns of the matrix A is indexed by [1,1],[1,2],[1,3],[2,1],[2,2],[2,3]. The matrix A is \pmatrix{ 1& 1& 1& 0& 0& 0 \cr 0& 0& 0& 1& 1& 1 \cr 1& 0& 0& 1& 0& 0 \cr 0& 1& 0& 0& 1& 0 \cr 0& 0& 1& 0& 0& 1 \cr }

[2122] import("gtt_ds.rr");
[4432]  gtt_ds.getA([2,3],[[1,0],[0,1]]);
[ 1 1 1 0 0 0 ]
[ 0 0 0 1 1 1 ]
[ 1 0 0 1 0 0 ]
[ 0 1 0 0 1 0 ]
[ 0 0 1 0 0 1 ]

Example: Consider the simplicial complex [123][134] with Levels=[2,2,3,4]. For example, the row index [1,2,2,0] and the column index [1,1,1,1]. They do not match (122? and 1111). The row index [1,2,2,0] and the column index [1,2,2,4]. matches (122? and 1114).

The row index [1,1,1,0] and the column index [1,1,1,1]. matches (111? and 1111). The row index [1,1,1,0] and the column index [1,1,1,2]. matches (111? and 1112). ... The row index [1,1,1,0] and the column index [1,2,1,1]. does not matche (111? and 1211). ... The row index [1,1,1,0] and the column index [2,2,3,4]. does not matche (111? and 2234).

[2122] import("gtt_ds.rr");
[4432] gtt_ds.getA([2,2,3,4],[[1,1,1,0],[1,0,1,1]]);
[ 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
                         0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
[ 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
                         0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
--- snip ---
[ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
                         0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 ]

Example: See pages 20, 21 of [MT2021v2].

[2123] import("mt_mm.rr");
[4432] gtt_ds.getA([2,2,2,2],[[1,1,1,0],[1,1,0,1]]);
[ 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
[ 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 ]
[ 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 ]
[ 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 ]
[ 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 ]
[ 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 ]
[ 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 ]
[ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 ]
[ 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
[ 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 ]
[ 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 ]
[ 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 ]
[ 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 ]
[ 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 ]
[ 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 ]
[ 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 ]

Refer to

gtt_ds.direct_sampler


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3 Direct sampler of two way contingency table


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1 gtt_ds.direct_sampler

gtt_ds.direct_sampler(MarginalSum,CellProb)

:: It returns a sample contingency table.

return

A sample contingency table.

MarginalSum

Marginal sums of a two way contingency table.

CellProb

A list of probabilities of each cell of the table.

Example: we consider 2 \times 3 contingency tables with the cell probability \pmatrix{ 1& 1/2 & 1/3 \cr 1& 1 & 1 \cr } , the row marginal sums (5,6), and the column marignal sums (3,3,5).

[1883] import("gtt_ds.rr");
[4447] for (I=0; I<3; I++) 
  printf("%a\n-----\n",gtt_ds.direct_sampler(MarginalSum,CellProb));  
[ 2 0 3 ]
[ 1 3 2 ]
-----
[ 2 2 1 ]
[ 1 1 4 ]
-----
[ 2 0 3 ]
[ 1 3 2 ]
-----

Todo, install a function to obtain contiguity relations for a given matrix A. Call this function with optional variable a (A matrix), MarginalSum is \beta. Refer to mt_mm.rr and latest isom-project codes.


Refer to

gtt_ds.getA


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Index

Jump to:   G  
Index Entry  Section

G
gtt_ds.direct_sampler 3.1 gtt_ds.direct_sampler
gtt_ds.getA 2.1 gtt_ds.getA

Jump to:   G  

[Top] [Contents] [Index] [ ? ]

Table of Contents


[Top] [Contents] [Index] [ ? ]

Short Table of Contents


[Top] [Contents] [Index] [ ? ]

About This Document

This document was generated on December 8, 2025 using texi2html 5.0.

The buttons in the navigation panels have the following meaning:

Button Name Go to From 1.2.3 go to
[ << ] FastBack Beginning of this chapter or previous chapter 1
[ < ] Back Previous section in reading order 1.2.2
[ Up ] Up Up section 1.2
[ > ] Forward Next section in reading order 1.2.4
[ >> ] FastForward Next chapter 2
[Top] Top Cover (top) of document  
[Contents] Contents Table of contents  
[Index] Index Index  
[ ? ] About About (help)  

where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:


This document was generated on December 8, 2025 using texi2html 5.0.