New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nadder

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nadder - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

esm/core/datatype.js

19

lib/core/evaluate/index.js

@@ -199,2 +199,21 @@ "use strict";

};
const powExpr = () => {
let left = unit();
while (tokens[0] && tokens[0].t == 0 /* TokenType.Operator */) {
switch (tokens[0].v) {
case '**':
tokens.shift();
const right = unit();
if (left === Math.E)
left = ops.exp(right);
else if (left === 2)
left = ops.exp2(right);
else
left = ops.pow(left, right);
break;
default: return left;
}
}
return left;
};
const mulExpr = () => {

@@ -201,0 +220,0 @@ let left = unit();

1

lib/core/ndarray.js

@@ -453,2 +453,3 @@ "use strict";

const flat = Array.isArray(data) ? data.flat(Infinity) : [data];
// potentially optimizable
const arr = ndarray(type, dims);

@@ -455,0 +456,0 @@ for (let i = 0; i < flat.length; ++i) {

18

lib/util/ufunc/ops/numeric.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.tan = exports.cos = exports.sin = exports.expm1 = exports.exp = exports.sqrt = exports.div = exports.neg = exports.pos = exports.conj = exports.conjugate = exports.abs = exports.mod = exports.floorDiv = exports.mul = exports.sub = exports.add = void 0;
exports.tan = exports.cos = exports.sin = exports.expm1 = exports.exp2 = exports.exp = exports.sqrt = exports.div = exports.neg = exports.pos = exports.conj = exports.conjugate = exports.abs = exports.mod = exports.pow = exports.floorDiv = exports.mul = exports.sub = exports.add = void 0;
const ufunc_1 = require("../ufunc");

@@ -54,3 +54,7 @@ const identity = (x) => x;

}));
exports.mod = (0, ufunc_1.ufunc)('div', 2, 1, ...typeImpls((a, b) => a % b, (a, b) => a % b));
exports.pow = (0, ufunc_1.ufunc)('pow', 2, 1, ...typeImpls((a, b) => a ** b, (a, b) => a ** b), complexTypeImpl((a, b) => {
// TODO
throw new TypeError('pow is not implemented for complex numbers');
}));
exports.mod = (0, ufunc_1.ufunc)('mod', 2, 1, ...typeImpls((a, b) => a % b, (a, b) => a % b));
exports.abs = (0, ufunc_1.ufunc)('abs', 1, 1, (0, ufunc_1.opImpl)([[1024 /* DataType.Bool */]], [1024 /* DataType.Bool */], identity), (0, ufunc_1.opImpl)([[1 /* DataType.Int8 */]], [1 /* DataType.Int8 */], Math.abs), (0, ufunc_1.opImpl)([[2 /* DataType.Uint8 */]], [2 /* DataType.Uint8 */], Math.abs), (0, ufunc_1.opImpl)([[4 /* DataType.Uint8Clamped */]], [4 /* DataType.Uint8Clamped */], Math.abs), (0, ufunc_1.opImpl)([[8 /* DataType.Int16 */]], [8 /* DataType.Int16 */], Math.abs), (0, ufunc_1.opImpl)([[16 /* DataType.Uint16 */]], [16 /* DataType.Uint16 */], Math.abs), (0, ufunc_1.opImpl)([[32 /* DataType.Int32 */]], [32 /* DataType.Int32 */], Math.abs), (0, ufunc_1.opImpl)([[64 /* DataType.Uint32 */]], [64 /* DataType.Uint32 */], Math.abs), (0, ufunc_1.opImpl)([[4096 /* DataType.Int64 */]], [4096 /* DataType.Int64 */], a => a < 0 ? -a : a), (0, ufunc_1.opImpl)([[8192 /* DataType.Uint64 */]], [8192 /* DataType.Uint64 */], a => a < 0 ? -a : a), (0, ufunc_1.opImpl)([[128 /* DataType.Float32 */]], [128 /* DataType.Float32 */], Math.abs), (0, ufunc_1.opImpl)([[256 /* DataType.Float64 */]], [256 /* DataType.Float64 */], Math.abs), (0, ufunc_1.opImpl)([[512 /* DataType.Complex */]], [256 /* DataType.Float64 */], (a) => +a));

@@ -98,5 +102,11 @@ exports.conjugate = (0, ufunc_1.ufunc)('conjugate', 1, 1, (0, ufunc_1.opImpl)([[1024 /* DataType.Bool */, 1 /* DataType.Int8 */]], [1 /* DataType.Int8 */], (a) => +a), (0, ufunc_1.opImpl)([[2 /* DataType.Uint8 */]], [2 /* DataType.Uint8 */], identity), (0, ufunc_1.opImpl)([[4 /* DataType.Uint8Clamped */]], [4 /* DataType.Uint8Clamped */], identity), (0, ufunc_1.opImpl)([[8 /* DataType.Int16 */]], [8 /* DataType.Int16 */], identity), (0, ufunc_1.opImpl)([[16 /* DataType.Uint16 */]], [16 /* DataType.Uint16 */], identity), (0, ufunc_1.opImpl)([[32 /* DataType.Int32 */]], [32 /* DataType.Int32 */], identity), (0, ufunc_1.opImpl)([[64 /* DataType.Uint32 */]], [64 /* DataType.Uint32 */], identity), (0, ufunc_1.opImpl)([[4096 /* DataType.Int64 */]], [4096 /* DataType.Int64 */], identity), (0, ufunc_1.opImpl)([[8192 /* DataType.Uint64 */]], [8192 /* DataType.Uint64 */], identity), (0, ufunc_1.opImpl)([[128 /* DataType.Float32 */]], [128 /* DataType.Float32 */], identity), (0, ufunc_1.opImpl)([[256 /* DataType.Float64 */]], [256 /* DataType.Float64 */], identity), (0, ufunc_1.opImpl)([[512 /* DataType.Complex */]], [512 /* DataType.Complex */], (a) => ({ real: a.real, imag: -a.imag })));

}));
exports.exp2 = (0, ufunc_1.ufunc)('exp2', 1, 1, ...floatTypeImpls(a => 2 ** a, a => {
const base = 2 ** a.real;
const rad = a.imag * Math.LN2;
return { real: base * Math.cos(rad), imag: base * Math.sin(rad) };
}));
exports.expm1 = (0, ufunc_1.ufunc)('expm1', 1, 1, ...floatTypeImpls(Math.expm1, a => {
const base = Math.expm1(a.real);
return { real: base * Math.cos(a.imag), imag: base * Math.sin(a.imag) };
// This loses precision if a.real and a.imag are near 0 - possible TODO
// Though expm1 probably shouldn't be used for complex numbers anyway
return { real: Math.exp(a.real) * Math.cos(a.imag) - 1, imag: Math.exp(a.real) * Math.sin(a.imag) };
}));

@@ -103,0 +113,0 @@ exports.sin = (0, ufunc_1.ufunc)('sin', 1, 1, ...floatTypeImpls(Math.sin, a => ({

{
"name": "nadder",
"version": "0.0.1",
"version": "0.0.2",
"description": "ndarray/tensor data processing for modern browsers",
"keywords": ["ndarray", "tensor", "numpy", "stdlib", "matlab"],
"author": "Arjun Barrett",
"homepage": "https://github.com/101arrowz/nadder",
"repository": {
"type": "git",
"url": "https://github.com/101arrowz/nadder"
},
"bugs": {
"url": "https://github.com/101arrowz/nadder/issues",
"email": "arjunbarrett@gmail.com"
},
"main": "lib/index.js",
"module": "esm/index.js",
"types": "lib/index.d.ts",
"author": "Arjun Barrett",
"types": "lib/index.d.ts",
"scripts": {
"build": "tsc && tsc -p tsconfig.esm.json && node scripts/postbuild"
"build": "tsc && tsc -p tsconfig.esm.json && node scripts/postbuild",
"prepare": "yarn build"
},

@@ -12,0 +23,0 @@ "devDependencies": {

# nadder
Easy n-dimensional data manipulation with NumPy syntax.
## Installation
```sh
npm i nadder # or yarn add nadder, or pnpm add nadder
```
## Usage

@@ -45,3 +50,3 @@ ```js

- Ergonomic NumPy slicing, broadcasting
-
- All NumPy bracket syntax and indexing routines supported
- NumPy syntax and evaluation via `evaluate`

@@ -52,3 +57,3 @@ - Full support for arithmetic, advanced ops, etc.

- Interleaved complex numbers
- Arithmetic, algebraic, and trigonometric operators for real and complex numbers
- Arithmetic, algebraic, and trigonometric operations for real and complex numbers
- Full TypeScript support

@@ -55,0 +60,0 @@ - In progress: support for most NumPy manipulations, more fast paths for higher performance, fast WASM modules

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc