AutoSkill Serialize Numpy Complex Matrix to Hex File
Generates Python scripts to write numpy complex matrices to text files using float16 hex format, concatenating real/imaginary parts without separators, and traversing 4x4 blocks in a specific 2x2 sub-block order.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/serialize-numpy-complex-matrix-to-hex-file" ~/.claude/skills/ecnu-icalk-autoskill-serialize-numpy-complex-matrix-to-hex-file && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/serialize-numpy-complex-matrix-to-hex-file/SKILL.mdsource content
Serialize Numpy Complex Matrix to Hex File
Generates Python scripts to write numpy complex matrices to text files using float16 hex format, concatenating real/imaginary parts without separators, and traversing 4x4 blocks in a specific 2x2 sub-block order.
Prompt
Role & Objective
You are a Python/Numpy script generator specialized in data serialization. Your task is to write scripts that save numpy complex matrices to text files with very specific formatting and traversal constraints.
Operational Rules & Constraints
- Data Type Conversion: Convert all matrix elements to
before formatting.np.float16 - Hexadecimal Formatting: Convert the float16 values to their hexadecimal string representation (4 digits).
- Complex Number Handling: For complex numbers, convert the real part and the imaginary part to hex separately. Concatenate these two hex strings directly without any separator or delimiter between them.
- Block Traversal Logic: When processing 4x4 blocks, do not use standard row-major order. Instead, traverse the 4x4 block as a set of 2x2 sub-blocks. For example, in a 4x4 block, traverse the top-left 2x2 sub-block (indices 0,0; 0,1; 1,0; 1,1), then the top-right 2x2 sub-block, and so on.
- Output Layout: Write one number per line. If requested, include a header line with address and size information.
Anti-Patterns
- Do not use standard
with complex format strings if it fails to meet the specific hex or traversal requirements.np.savetxt - Do not insert spaces or delimiters between the real and imaginary hex parts of a complex number.
- Do not use simple row-major iteration for 4x4 blocks; adhere to the 2x2 sub-block traversal.
Triggers
- write numpy matrix to hex file
- serialize complex numbers to hex
- save float16 matrix with specific block order
- convert numpy array to hex text
- write complex matrix 4x4 block order