Agent skill
numpy-numerical-analysis-1-use-vectorization
Sub-skill of numpy-numerical-analysis: 1. Use Vectorization (+3).
Install this agent skill to your Project
npx add-skill https://github.com/vamseeachanta/workspace-hub/tree/main/.claude/skills/_archive/data/scientific/numpy-numerical-analysis/1-use-vectorization
SKILL.md
1. Use Vectorization (+3)
1. Use Vectorization
# ❌ Bad: Loop
result = np.zeros(len(x))
for i in range(len(x)):
result[i] = x[i]**2 + y[i]**2
# ✅ Good: Vectorized
result = x**2 + y**2
2. Avoid Unnecessary Copies
# ❌ Bad: Creates copies
a = np.array([1, 2, 3])
b = a
b[0] = 10 # Modifies original
# ✅ Good: Explicit copy when needed
a = np.array([1, 2, 3])
b = a.copy()
b[0] = 10 # Original unchanged
3. Use In-Place Operations
# ❌ Bad: Creates new array
a = a + 1
# ✅ Good: In-place
a += 1
4. Choose Appropriate Data Types
# Use float32 for large arrays when precision allows
large_array = np.zeros((10000, 10000), dtype=np.float32) # 400 MB instead of 800 MB
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
gsd-complete-milestone
Archive completed milestone and prepare for next version
gsd-reapply-patches
Reapply local modifications after a GSD update
gsd-verify-work
Validate built features through conversational UAT
gsd-thread
Manage persistent context threads for cross-session work
clinical-trial-protocol
Generate clinical trial protocols for medical devices or drugs through a modular, waypoint-based architecture with research-only and full protocol modes.
single-cell-rna-qc
Performs quality control on single-cell RNA-seq data (.h5ad or .h5 files) using scverse best practices with MAD-based filtering and comprehensive visualizations.
Didn't find tool you were looking for?