npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@euriklis/quadprog

v1.1.0

Published

A javascript implementation of the quadprog Fortran subroutine.

Downloads

4

Readme

Euriklis QUADPROG package.

This package implements the A. Idnani and D. Goldfarb dual algorithm. It is well known that this algorithm was initially implemented from Alberto Santini. We provide an exact translation of the Fortran code in a javascript - like pattern. Thus we avoid the goto_* functions which increase the time efficiency and the readability of the algorithm implementation.

Usage

The quadratic programming is widely used in the optimization procedures, the portfolio management with restrictions, the least squares method with restrictions and many other cases. We use this algorithm this algorithm for the so called supported vector machines (or SVM - neuronal networks architectures) - an architecture of neuronal networks.

Installation of the package

To install the package run in terminal:

npm install @euriklis/quadprog@latest --save

To use the package you have to declare the package with the conventional require approach:

import { solveQP } from '@euriklis/quadprog';
let Dmat = [], dvec = [], Amat = [], bvec = [], res;

Dmat[0] = [];
Dmat[1] = [];
Dmat[2] = [];
Dmat[0][0] = 1;
Dmat[1][0] = 0;
Dmat[2][0] = 0;
Dmat[0][1] = 0;
Dmat[1][1] = 1;
Dmat[2][1] = 0;
Dmat[0][2] = 0;
Dmat[1][2] = 0;
Dmat[2][2] = 1;

dvec[0] = 0;
dvec[1] = 5;
dvec[2] = 0;

Amat[0] = [];
Amat[1] = [];
Amat[2] = [];
Amat[0][0] = -4;
Amat[1][0] = -3;
Amat[2][0] = 0;
Amat[0][1] = 2;
Amat[1][1] = 1;
Amat[2][1] = 0;
Amat[0][2] = 0;
Amat[1][2] = -2;
Amat[2][2] = 1;

bvec[0] = -8;
bvec[1] = 2;
bvec[2] = 0;
console.log(solveQP(Dmat, dvec, Amat, bvec));

Dependencies

The package does not use any dependencies and is implemented without using of classes, methods and additional packages/functions. This pattern implementation was preferred because of the simplicity and time efficiency, which is crucial for this class of algorithms.

Technical details

The implemented from Alberto Santini package is accurately translated. However, in the original Fortran subroutine also the lagrangian multipliers are provided, so in our implementation we obtain these multipliers and returns then in the output of the function.

Tests

Tests of the time efficiency and the accuracy of the algorithm can be run with running of the following commands in the terminal:

git clone https://github.com/VelislavKarastoychev/tests-for-quadprog
cd tests-for-quadprog && npm t

Bugs and tips

Everyone who wants to inform me about useful things and practices can sends me an email to [email protected] or [email protected].

License

MIT License. This package will be provided for free to any user that use it for personal and non commercial usage. The author of the package is not liable for any errors in third party software, libraries, packages and source code used at these libraries. The author also may not responsible for some possible bugs that may exists in the library.