numpy-ts offers a comprehensive implementation of NumPy for TypeScript and JavaScript, achieving 94% API coverage with extensive testing. With Type-safe definitions and tree-shakeable modules, it provides a familiar NumPy experience in a modern programming environment, ideal for both Node.js and browser applications.
numpy-ts is a comprehensive implementation of the full NumPy library, designed specifically for TypeScript and JavaScript environments. With 94% API coverage, this project includes 476 of 507 NumPy functions, making it an ideal choice for developers who require NumPy's capabilities in web and server-side applications.
Key Features:
- Extensive API: Access to a wide range of NumPy functions with high coverage for seamless migration from Python.
- NumPy-validated: Over 6,000 tests ensure reliability by comparing functionality against the original Python version of NumPy.
- Type-safe: Offers complete TypeScript type definitions, improving developer experience and enabling error checking at compile time.
- Tree-shakeable: Import only the components required for your application, enhancing efficiency and reducing bundle size.
- Universal compatibility: Works seamlessly across both Node.js and web browsers, facilitating client-side and server-side development.
Quick Start Example:
Begin utilizing numpy-ts with simple, concise code snippets:
import * as np from 'numpy-ts';
// Array creation with dtype support
const A = np.array([[1, 2], [3, 4]], 'float32');
const B = np.ones([2, 2], 'int32');
// Broadcasting and chained operations
const result = A.add(5).multiply(2);
// Linear algebra operations
const C = A.matmul(B);
const trace = A.trace();
// Reductions with axis support
const colMeans = A.mean(0); // Returns [2.0, 3.0]
// NumPy-style slicing
const row = A.slice('0', ':'); // Equivalent to A[0, :]
const submatrix = A.slice('0:2', '1:'); // Equivalent to A[0:2, 1:]
Additional Resources:
To deepen understanding and find more examples, access the following:
Contributions in the form of issues and pull requests are encouraged to enhance this project further.
This will help to elevate TypeScript as a first-class research language. Great work!
Sign in to comment.