{"id":18380569,"url":"https://github.com/piyueh/simpoly","last_synced_at":"2025-10-13T22:08:03.239Z","repository":{"id":79981921,"uuid":"119622438","full_name":"piyueh/SimPoly","owner":"piyueh","description":"Simple Polynomial Toolbox for C++","archived":false,"fork":false,"pushed_at":"2018-05-21T23:18:03.000Z","size":126,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-15T23:28:52.977Z","etag":null,"topics":["cpp","polynomial"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/piyueh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-01-31T02:18:59.000Z","updated_at":"2024-02-24T17:04:13.000Z","dependencies_parsed_at":"2023-09-18T01:33:38.714Z","dependency_job_id":null,"html_url":"https://github.com/piyueh/SimPoly","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piyueh%2FSimPoly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piyueh%2FSimPoly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piyueh%2FSimPoly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piyueh%2FSimPoly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piyueh","download_url":"https://codeload.github.com/piyueh/SimPoly/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248442500,"owners_count":21104197,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","polynomial"],"created_at":"2024-11-06T00:43:01.940Z","updated_at":"2025-10-13T22:07:58.215Z","avatar_url":"https://github.com/piyueh.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SimPoly -- Simple Polynomial\n\nSimPoly is a very simple C++ library intended for basic polynomial operations, series, and special polynomials.\nCurrently, it only supports polynomials with a single variable and real coefficients (though roots can be complex numbers). \n\nThere is already a polynomial module in the Boost library. \nAnd that module has become a part of C++17 standard. \nThe reasons I wrote my own polynomial library:\n\n* I don't like to use Boost just for its polynomial module.\n* I don't like the usage of Boost's polynomial module.\n* I want something in C++ similar to polynomial objects of Numpy or Scipy.\n* Many HPC systems I've used so far have old C++ compilers and are unlikely to have new compilers in the future.\n\nSimPoly is not something computationally efficient. \nImplementations are naive. \nHowever, for many numerical methods of interest to me, polynomial operations or calculations are not performance bottlenecks. \nSo it's fine to me.\nSimPoly is not something intended for doing mathematics research.\nIt's more like a helper for some numerical schemes, such as pseudospectral methods, hp-finite element methods, etc.\n\nDue to the naive implementations, SimPoly may not be numerically stable. \nFor ill-conditioned polynomials, it's users' responsibility to take care of rounding errors. \nAgain, however, in many scientific computing areas, polynomials are rarely ill-conditioned (I imagine ...). \nSo stability issue may not be users' top concern.\nAt least it's not my concern.\n\n## Features\n\n* `numpy.polynomial.Polynomial`-like usage\n    - arithmetic, including division\n    - calculus\n    - initialize with either coefficients or roots\n    - better evaluation if using roots for initialization\n* Capability of obtaining accurate roots with multiplicity greater than 1. (Algorithm proposed by Yan \u0026 Chieng (2006)[1].)\n* Jacobi family polynomials, including Legendre polynomial\n* Radau polynomials\n\n## Example code\n\nUsage example of `Polynomial` objects:\n\n```c++\nusing namespace simpoly;\npoly::Polynomial p1({1, 2, 3, 4}); // initialization by coefficients\npoly::Polynomial p2(1.0, {1, 2, 3, 4, 5, 6}); // initialization by roots\npoly::Polynomial p3 = p1 * p2;\npoly::Polynomial r = p2 % p1;\npoly::Polynomial Q, R;\nQ = p2.divide(p1, R);\nassert(r == R);\np1 += p2;\nstd::cout \u003c\u003c p3 \u003c\u003c std::endl;\nstd::cout \u003c\u003c p2.roots() \u003c\u003c std::endl;\nstd::cout \u003c\u003c (p2 * p3).interg() \u003c\u003c std::endl;\n```\n\nFor more operations of `Polynomial` objects, please refer to the header file `include/polynomial.h`\n\nJacobi polynomials:\n\n```c++\nusing namespace simpoly;\ndouble alpha=1.0, beta=0.0, degree=4;\npoly::Polynomial p = poly::Jacobi(alpha, beta, degree);\n```\n\nLegendre polynomials:\n\n```c++\nusing namespace simpoly;\npoly::Polynomial p = poly::Legendre(degree);\n```\n\nLeft Radau polynomials:\n\n```c++\nusing namespace simpoly;\npoly::Polynomial p = poly::Radau(degree, poly::PolyType::LEFTRADAU);\n```\n\n## Build and installation\n\n```\n$ cd SimPoly\n$ mkdir build\n$ cmake -DCMAKE_INSTALL_PREFIX=\u003cpreferred location\u003e ../\n$ make all\n$ make test\n$ make install\n```\n\nIf CMake complains about not finding GTest, please specify the root directory\nof GTest through CMake CMD argument: `-DGTEST_ROOT=\u003cpath\u003e`.\n\nThe following CMake CMD options are supported:\n\n* `CMAKE_BUILD_TYPE`: either `DEBUG`(default) or `RELEASE`\n* `BUILD_SHARED_LIBS`: wither `ON` (default) or `OFF`\n\n\n## Current development\n\nThe following features are still in progress (I will implement them when I need them):\n\n* Operation: scaling and shift\n* Special polynomial: Lobatto polynomial\n* Polynomial series: Lagrange polynomials, Legendre series, Chebychev series, etc\n* Quadratures\n* Upgrade `double` to `long double`.\n\nPull requests are welcome.\n\n## Contact\n\nThrough GitHub issue section or email pychuang@gwu.edu.\n\n## Reference\n\n[1] Yan, Chang-Dau, and Wei-Hua Chieng. \"Method for finding multiple roots of polynomials.\" Computers \u0026 Mathematics with Applications 51, no. 3-4 (2006): 605-620.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiyueh%2Fsimpoly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiyueh%2Fsimpoly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiyueh%2Fsimpoly/lists"}