Skip to content

Const

dstz.math.matrix.const

get_bfrm(n)

Generates the Belief Function Relation Matrix for a space of size n.

Parameters:

Name Type Description Default
n int

The size of the Frame of Discernment.

required

Returns:

Type Description

np.ndarray: The BFRM matrix of size 2^n x 2^n.

Source code in dstz/math/matrix/const.py
47
48
49
50
51
52
53
54
55
56
def get_bfrm(n):
    """Generates the Belief Function Relation Matrix for a space of size n.

    Args:
        n (int): The size of the Frame of Discernment.

    Returns:
        np.ndarray: The BFRM matrix of size 2^n x 2^n.
    """
    return matrix_self_kron(BFRM, n)

get_qfrm(n)

Generates the Commonality Function Relation Matrix for a space of size n.

Parameters:

Name Type Description Default
n int

The size of the Frame of Discernment.

required

Returns:

Type Description

np.ndarray: The QFRM matrix of size 2^n x 2^n.

Source code in dstz/math/matrix/const.py
35
36
37
38
39
40
41
42
43
44
def get_qfrm(n):
    """Generates the Commonality Function Relation Matrix for a space of size n.

    Args:
        n (int): The size of the Frame of Discernment.

    Returns:
        np.ndarray: The QFRM matrix of size 2^n x 2^n.
    """
    return matrix_self_kron(QFRM, n)

matrix_self_kron(matrix, n)

Computes the n-th Kronecker power of a matrix.

This function repeatedly calculates the Kronecker product of a matrix with itself n times.

Parameters:

Name Type Description Default
matrix ndarray

The input matrix.

required
n int

The number of times to perform the Kronecker product.

required

Returns:

Type Description

np.ndarray: The resulting matrix from the repeated Kronecker product.

Source code in dstz/math/matrix/const.py
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
def matrix_self_kron(matrix, n):
    """Computes the n-th Kronecker power of a matrix.

    This function repeatedly calculates the Kronecker product of a matrix with
    itself `n` times.

    Args:
        matrix (np.ndarray): The input matrix.
        n (int): The number of times to perform the Kronecker product.

    Returns:
        np.ndarray: The resulting matrix from the repeated Kronecker product.
    """
    res = 1
    for i in range(n):
        res = np.kron(res, matrix)
    return res