get_block_mask(block_sizes)
The get_block_mask
function generates a block structure matrix to be used as an input to the finite part of Block
objects.
Parameters
- block_sizes (
list[int]
):
A list of integers where each element represents the size of the block for the corresponding section of the matrix. The number of blocks in the matrix is determined by the length of this list.
Returns
- structure (
ndarray
):
A symmetric block structure matrix assembled from the specified block sizes.
Example Usage
Below is an example demonstrating how to use the get_block_mask
function:
from sympt import get_block_mask # Replace with the actual module name
# Define block sizes for each section of the matrix
block_sizes = [2, 3, 4]
# Generate the block mask matrix
mask = get_block_mask(block_sizes)
print("Block Mask Matrix:")
print(mask)
Block Mask Matrix:
[[0. 0. 1. 1. 1. 1. 1. 1. 1.]
[0. 0. 1. 1. 1. 1. 1. 1. 1.]
[1. 1. 0. 0. 0. 1. 1. 1. 1.]
[1. 1. 0. 0. 0. 1. 1. 1. 1.]
[1. 1. 0. 0. 0. 1. 1. 1. 1.]
[1. 1. 1. 1. 1. 0. 0. 0. 0.]
[1. 1. 1. 1. 1. 0. 0. 0. 0.]
[1. 1. 1. 1. 1. 0. 0. 0. 0.]
[1. 1. 1. 1. 1. 0. 0. 0. 0.]]
In this example, a block mask is generated for a matrix with three block sections of sizes 2, 3, and 4 respectively. The resulting matrix will have its upper blocks filled with ones and lower blocks with zeros, then symmetrized to reflect the block structure.
License
SymPT is licensed under the MIT License. See the LICENSE
file for details.
Citation
If you use SymPT in your research, please cite the following paper:
BibTeX Entry:
@misc{diotallevi2024symptcomprehensivetoolautomating,
title={SymPT: a comprehensive tool for automating effective Hamiltonian derivations},
author={Giovanni Francesco Diotallevi and Leander Reascos and Mónica Benito},
year={2024},
eprint={2412.10240},
archivePrefix={arXiv},
primaryClass={quant-ph},
url={https://arxiv.org/abs/2412.10240},
}
APA Citation:
Diotallevi, G. F., Reascos, L., & Benito, M. (2024). SymPT: a comprehensive tool for automating effective Hamiltonian derivations. arXiv preprint arXiv:2412.10240.
IEEE Citation:
G. F. Diotallevi, L. Reascos, and M. Benito, "SymPT: a comprehensive tool for automating effective Hamiltonian derivations," arXiv preprint arXiv:2412.10240, 2024.