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 bottlenecksCreate or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.
CLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.
CLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).