Code Monkey home page Code Monkey logo

Comments (10)

markrogoyski avatar markrogoyski commented on May 15, 2024

I'm not familiar with the PHP license and what restrictions it has. For now please do not use any potentially restrictive licensed code.
I was planning on creating a LinearAlgebra namespace that would have vector and matrix operations. I can get started on that after merging and updating the recent changes if that works for you.

from math-php.

Beakerboy avatar Beakerboy commented on May 15, 2024

No worries, I wasn't planning on merging anything that I hadn't written. There are a few Matrix Libraries in composer that might work as starting points too. MIT License-Linear Algebra

from math-php.

markrogoyski avatar markrogoyski commented on May 15, 2024

I added an initial Math\LinearAlgebra namespace with Vector and Matrix classes. I still have some methods to add but it should be enough to get started working with. Let me know if you have any particular features you want added. Usage is documented in the main page README.

from math-php.

Beakerboy avatar Beakerboy commented on May 15, 2024

It definitely needs inverse and determinant before I can use it to expand the regressions. The Linear Algebra package I linked to above has everything I'd need. I requested some "Matrix Concatenation" methods from him a couple days ago and he added it very quickly.

from math-php.

markrogoyski avatar markrogoyski commented on May 15, 2024

Those are on my list of functions to implement.

from math-php.

Beakerboy avatar Beakerboy commented on May 15, 2024

Besides concatenation, another good matrix function would be "exclusion".

$M = new Matrix([[1,2,3,4,5],[2,3,4,5,6],[3,4,5,6,7]];
print $m->rowExclude(2); 
// [[1,2,3,4,5],
//  [3,4,5,6,7]]
print $M->columnExclude(3);
//   [[1,2,4,5],
//    [2,3,5,6],
//    [3,4,6,7]]

Calculating the standard errors of multiple linear regression is simplified by using this.

from math-php.

Beakerboy avatar Beakerboy commented on May 15, 2024

I've been reading up on the MIT license, and it looks like we could just grab any matrix code from another MIT licensed project, and use it, as long as the original author's copyright is included. Since I've contributed a fair amount of code, I should probably get credit too. Would you object to pulling some matrix code into our project and modifying the project license?

from math-php.

markrogoyski avatar markrogoyski commented on May 15, 2024

I've slowly been working on adding the matrix operations by working it out. I added LU Decomposition, which will be a step in adding solving linear equations and doing inverse and determinant etc. It's been a long time since I've studied linear algebra so I've been relearning as I go.
I'd prefer that all code be original, and if you don't mind waiting, I'll try to get it done. Or, if you want to take a stab at it, that's cool too. I don't think there is anything preventing you from looking at someone else's code to learn the general logic of how something works (This is general math after all), and then write your own implementation.
Otherwise, if you want to start with the other person's code and modify it from there, we will have to include the license. Since this project is already MIT and I already have an MIT license in the root directory I don't think we need a second license file, since it isn't like we are incorporating GPL code or something, so I think we can give the original source credit in the method's Docbloc comments and that should suffice. If you know of some projects that do the same thing that we can verify on how to do it that would be helpful. Another option is to have the other author contribute here and do a pull request.

Btw, back when you first started contributing I added your name to the authors section of the composer file. For example, when you look at the project on any page that parses the composer manifest, such as Packagist, you will see it appear:
https://packagist.org/packages/markrogoyski/math-php

from math-php.

markrogoyski avatar markrogoyski commented on May 15, 2024

Looking around on the Web, it looks like how some people do it is if you copy the code verbatim, you want to site the source and provide the license text. This could be done at the top of the class that includes the included code or in the docblock of the method if it is just one method.

If you are going to reference it as a base of understanding to adapt the code or implement it on your own, it seems OK to site the source of the original code and give credit that it was used as a reference without needing to include the license, since the original licensed code was not used

I'm not an expert in this, but that seems reasonable to me.

from math-php.

markrogoyski avatar markrogoyski commented on May 15, 2024

I added an initial implementation of Matrix inverse, determinant and reduced echelon form. See if these work for you.

from math-php.

Related Issues (20)

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.