Efficient Generation of Binary Magic Squares
We propose a simple algorithm for generating Binary Magic Squares (BMS), i.e., square binary matrices where the sum of all rows and all columns are equal. We show by induction that our algorithm always returns valid BMS with optimal theoretical complexity. We then extend our study to non-square Binary Magic Squares, formalize conditions on the sum of rows and columns for these BMS to exist, and show that a slight variant of our first algorithm can generate provably generate them. Finally, we publicly release two implementations of our algorithm as Python packages, including one that can generate several BMS in parallel using GPU acceleration.
Code (0)
등록된 구현이 없습니다.
Similar Papers 제목 키워드 기반
MAGIC: Microlensing Analysis Guided by Intelligent Computation
The modeling of binary microlensing light curves via the standard sampling-based method can be challenging, because of the time-consuming light-curve computation and the pathological likelihood landscape in the high-dime…
Time SeriesTime Series AnalysisA Quantum Search Approach to Magic Square Constraint Problems with Classical Benchmarking
This paper presents a quantum search approach to combinatorial constraint satisfaction problems, demonstrated through the generation of magic squares. We reformulate magic square construction as a quantum search problem …
MAGIC: Mask-Guided Image Synthesis by Inverting a Quasi-Robust Classifier
We offer a method for one-shot mask-guided image synthesis that allows controlling manipulations of a single image by inverting a quasi-robust classifier equipped with strong regularizers. Our proposed method, entitled M…
Image GenerationMagicAvatar: Multimodal Avatar Generation and Animation
This report presents MagicAvatar, a framework for multimodal video generation and animation of human avatars. Unlike most existing methods that generate avatar-centric videos directly from multimodal inputs (e.g., text p…
Video GenerationMagical: Medical Lay Language Generation via Semantic Invariance and Layperson-tailored Adaptation
Medical Lay Language Generation (MLLG) plays a vital role in improving the accessibility of complex scientific content for broader audiences. Recent literature to MLLG commonly employ parameter-efficient fine-tuning meth…
parameter-efficient fine-tuning