Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nlptoolkit-math

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nlptoolkit-math - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

3

dist/Matrix.d.ts
import { Vector } from "./Vector";
import { Eigenvector } from "./Eigenvector";
import { Random } from "nlptoolkit-util/dist/Random";
export declare class Matrix {

@@ -7,3 +8,3 @@ private readonly row;

private values;
constructor(row: any, col?: any, minValue?: any, maxValue?: any);
constructor(row: any, col?: any, minValue?: any, maxValue?: any, random?: Random);
initZeros(): void;

@@ -10,0 +11,0 @@ /**

@@ -16,3 +16,3 @@ (function (factory) {

class Matrix {
constructor(row, col = undefined, minValue = undefined, maxValue = undefined) {
constructor(row, col, minValue, maxValue, random) {
if (typeof row == 'number') {

@@ -37,3 +37,8 @@ this.row = row;

for (let j = 0; j < this.col; j++) {
this.values[i].push(minValue + (maxValue - minValue) * Math.random());
if (random != undefined) {
this.values[i].push(random.nextDouble(minValue, maxValue));
}
else {
this.values[i].push(minValue + (maxValue - minValue) * Math.random());
}
}

@@ -40,0 +45,0 @@ }

{
"name": "nlptoolkit-math",
"version": "1.0.0",
"version": "1.0.1",
"description": "Math library",

@@ -23,2 +23,3 @@ "main": "index.js",

"mocha": "^9.1.3",
"nlptoolkit-util": "^1.0.3",
"ts-node": "^10.4.0",

@@ -25,0 +26,0 @@ "typescript": "^4.4.4"

import {Vector} from "./Vector";
import {Eigenvector} from "./Eigenvector";
import {Random} from "nlptoolkit-util/dist/Random";

@@ -10,3 +11,3 @@ export class Matrix{

constructor(row: any, col: any = undefined, minValue: any = undefined, maxValue: any = undefined) {
constructor(row: any, col?: any, minValue?: any, maxValue?: any, random?: Random) {
if (typeof row == 'number'){

@@ -29,3 +30,7 @@ this.row = row

for (let j = 0; j < this.col; j++){
this.values[i].push(minValue + (maxValue - minValue) * Math.random());
if (random != undefined){
this.values[i].push(random.nextDouble(minValue, maxValue));
} else {
this.values[i].push(minValue + (maxValue - minValue) * Math.random());
}
}

@@ -32,0 +37,0 @@ }

import * as assert from "assert";
import {Vector} from "../dist/Vector";
import {Matrix} from "../dist/Matrix";
import {Random} from "nlptoolkit-util/dist/Random";

@@ -32,3 +33,3 @@ function nearlyEqual(value1: number, value2: number, difference: number) {

let vr = new Vector(100, 1.0)
let random = new Matrix(100, 100, 1, 10)
let random = new Matrix(100, 100, 1, 10, new Random(0))
let originalSum = random.sumOfElements()

@@ -35,0 +36,0 @@ let identity = new Matrix(100)

Sorry, the diff of this file is not supported yet

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