Giter Site home page Giter Site logo

naturalnode / node-sylvester Goto Github PK

View Code? Open in Web Editor NEW
152.0 18.0 27.0 8.86 MB

:cat: Sylvester is a vector, matrix, and geometry library for JavaScript, that runs in the browser and on the server.

Home Page: https://naturalnode.github.io/node-sylvester/

License: MIT License

JavaScript 32.96% Dockerfile 0.22% TypeScript 66.32% CSS 0.50%
matrix linear-algebra vector javascript sylvester graphics

node-sylvester's People

Contributors

chrisumbel avatar connor4312 avatar dependabot[bot] avatar fabianfiorotto avatar hugo-ter-doest avatar nyxtom avatar silentrob avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-sylvester's Issues

Use of Global variables in $V, $L, $M, $P node package

Is there a reason that $V ,$L, $M, $P are in global scope? This is currently causing issues when testing with mocha, so we are having to add these to the mocha --globals option. Since everything is being exported it would seem like the attachment to global variable isn't required.

I assume there may be a very good reason for this but doesn't seem like best practice?

Sylvester cannot be used with browserify

Browserify emits en error message:
Error: Cannot find module 'lapack' from '<path>/node_modules/sylvester/lib/node-sylvester'

One way to fix the issue would be to add lapack as dependency of sylvester. In the meantime, I use browserify's --ignore lapack option.

TypeError: Line.create is not a function

I'm getting this error when I use plane.intersectionWith.

repro:

const {Plane} = require('sylvester');

const plane1 = Plane.create([0, 0, 0], [0, 1, 0]);
const plane2 = Plane.create([0, 0, 0], [0, 0, 1]);
plane1.intersectionWith(plane2);
$ npm ls sylvester
[email protected] C:\Users\denjj\Documents\GitHub\smart-cube-timer
`-- [email protected]

$ node --version
v10.3.0

$ node temp.js
C:\Users\denjj\Documents\GitHub\smart-cube-timer\node_modules\sylvester\lib\node-sylvester\plane.js:126
      return Line.create(anchor, direction);
                  ^

TypeError: Line.create is not a function
    at Plane.intersectionWith (C:\Users\denjj\Documents\GitHub\smart-cube-timer\node_modules\sylvester\lib\node-sylvester\plane.js:126:19)
    at Object.<anonymous> (C:\Users\denjj\Documents\GitHub\smart-cube-timer\temp.js:5:8)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
    at startup (internal/bootstrap/node.js:238:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:572:3)

svdJs is broken, qrJs too, probably from identSize

See NaturalNode/node-lapack#2

Using the following on matlab / octave:

A = [ 1, 2; 3, 4; 5, 6];
[u, s, v] = svd(A)

I obtain:

u =
  -0.22985   0.88346   0.40825
  -0.52474   0.24078  -0.81650
  -0.81964  -0.40190   0.40825

  s =
  9.52552  0.00000
  0.00000  0.51430
  0.00000  0.00000

  v =
  -0.61963  -0.78489
  -0.78489   0.61963

Now with the js implementation:

require('sylvester');
var A = $M([
  [1, 2],
  [3, 4],
  [5, 6]
]);
var svd = A.svd();
console.log(JSON.stringify(svd));

I obtain nothing because it crashes:

  /[...]/node_modules/sylvester/lib/node-sylvester
  /matrix.js:60
    var e = S.triu(1).unroll().norm();
              ^
  TypeError: Cannot call method 'triu' of null
    at Object.svdJs (/[...]/node_modules/sylvester
  /lib/node-sylvester/matrix.js:60:15)

Error summary: it breaks because of a null value being returned by qrJs, which in turn starts with the R matrix being null at some point. That comes from identSize.

However, it's mostly just an issue notification. I personally needed to have reliable and fast svd, so I used SVDLIBC and bound it as a C++ module (see node-svd). You may look at SVDLIBC if you think it can help you with svd / qr processing.

Sylvester.precision is missing from modules

Sylvester.precision is defined only in vector.js:

var Sylvester = {
    precision: 1e-6
};

Other modules, such as matrix.js, do not see this local variable, so all of the methods that use Sylvester.precision in other files will throw a ReferenceError: Sylvester is not defined. You will need to export and require the precision (or Sylvester) in all relevant files or invent some other scheme.

Npm version not updated ?

Hi ! I am running into a small issue : apparently the version on NPM (version number matches the one here ) does not include the updated package.json with :

browser": {
    "lapack": false
  }

which breaks browserified builds: would it be just possible to publish a version to npm with an updated package.json , that is all that is needed to fix things :)
Thanks in advance !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.