Best practices for NumPy array programming, numerical computing, and performance optimization in Python
Expert guidelines for NumPy development, focusing on array programming, numerical computing, and performance optimization.
weights, gradients, input_array)np.array(), np.zeros(), np.ones(), np.empty(), np.arange(), np.linspace()np.zeros() or np.empty() for pre-allocation when array size is knownnp.concatenate(), np.vstack(), np.hstack() for combining arraysnp.where() for conditional element selectiondtype parameternp.float32 for memory-efficient computations when full precision is not needednp.asarray() for type conversion without unnecessary copiesnp.einsum() for complex tensor operationsnp.dot() or @ operator for matrix multiplicationnp.ndarray.flags to check memory layout (C-contiguous vs Fortran-contiguous)out parameter when possiblenp.memmap) for large datasetsnp.sum(), np.mean(), np.std() with axis parameter for aggregationsnp.cumsum(), np.cumprod() for cumulative operationsnp.searchsorted() for efficient sorted array operationsnp.isnan(), np.isinf()np.errstate() context manager for controlling floating-point error handlingnp.random.default_rng() for modern random number generationrng = np.random.default_rng(seed=42)np.random functionsrng.normal(), rng.uniform(), rng.choice()np.linalg for linear algebra operationsnp.linalg.solve() instead of computing inverse for linear systemsnp.linalg.eig(), np.linalg.svd() for decompositionsnp.linalg.cond() before inversionpytest with np.testing assertionsnp.testing.assert_array_equal() for exact comparisonsnp.testing.assert_array_almost_equal() for floating-point comparisonsimport numpy as npsnake_case for variables and functions%timeit to identify bottlenecksnpx skills add Mindrally/numpy-best-practices下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer