{"id":22546538,"url":"https://github.com/deephaven/suanshu","last_synced_at":"2025-04-10T00:52:19.660Z","repository":{"id":46872744,"uuid":"358646660","full_name":"deephaven/SuanShu","owner":"deephaven","description":"Extension of original open-sourced math library, SuanShu.","archived":false,"fork":false,"pushed_at":"2024-07-22T17:16:10.000Z","size":2160,"stargazers_count":11,"open_issues_count":0,"forks_count":7,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-04-10T00:52:13.247Z","etag":null,"topics":["math"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deephaven.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-16T15:42:31.000Z","updated_at":"2024-07-22T17:16:14.000Z","dependencies_parsed_at":"2024-07-22T18:43:20.966Z","dependency_job_id":null,"html_url":"https://github.com/deephaven/SuanShu","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deephaven%2FSuanShu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deephaven%2FSuanShu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deephaven%2FSuanShu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deephaven%2FSuanShu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deephaven","download_url":"https://codeload.github.com/deephaven/SuanShu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137995,"owners_count":21053775,"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":["math"],"created_at":"2024-12-07T15:08:09.734Z","updated_at":"2025-04-10T00:52:19.629Z","avatar_url":"https://github.com/deephaven.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SuanShu\n\nSuanShu is a Java math library for numerical analysis, statistics, root finding, linear algebra, optimization, curve fitting, interpolation, regression, differential equation solvers, and more.  \n\nThis repository is a fork of the most recent Open Source SuanShu release (2012-06-06).  It has enhancements that include fixes to test cases, serialization, etc.  If you are interested in the commercially licensed version, see [https://nm.dev/](https://nm.dev/).\n\n## Installation\n\nThe latest version of this package can be found on [Maven](https://search.maven.org/artifact/io.deephaven/SuanShu).\n\n### pom.xml\n\n```\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.deephaven\u003c/groupId\u003e\n    \u003cartifactId\u003eSuanShu\u003c/artifactId\u003e\n    \u003cversion\u003e0.1.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Gradle\n\n```\nimplementation 'io.deephaven:SuanShu:0.1.1'\n```\n\n## Usage\n\nThe following Java class shows a few examples of how to use the package. [Source](https://github.com/eugenp/tutorials/blob/master/libraries-data-2/src/main/java/com/baeldung/suanshu/SuanShuMath.java)\n\n```\npackage com.SuanShuSample.app;\n\nimport com.numericalmethod.suanshu.matrix.doubles.Matrix;\nimport com.numericalmethod.suanshu.matrix.doubles.matrixtype.dense.DenseMatrix;\nimport com.numericalmethod.suanshu.matrix.doubles.operation.Inverse;\nimport com.numericalmethod.suanshu.vector.doubles.Vector;\nimport com.numericalmethod.suanshu.vector.doubles.dense.DenseVector;\nimport com.numericalmethod.suanshu.analysis.function.polynomial.Polynomial;\nimport com.numericalmethod.suanshu.analysis.function.polynomial.root.PolyRoot;\nimport com.numericalmethod.suanshu.analysis.function.polynomial.root.PolyRootSolver;\nimport com.numericalmethod.suanshu.number.complex.Complex;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\nimport java.util.List;\n\nclass App {\n\n    private static final Logger log = LoggerFactory.getLogger(App.class);\n\n    public static void main(String[] args) throws Exception {\n        App math = new App();\n        org.apache.log4j.BasicConfigurator.configure();\n\n        math.addingVectors();\n        math.scaleVector();\n        math.innerProductVectors();\n\n        math.addingMatrices();\n        math.multiplyMatrices();\n        math.inverseMatrix();\n\n        Polynomial p = math.createPolynomial();\n        math.evaluatePolynomial(p);\n        math.solvePolynomial();\n    }\n\n    public void addingVectors() throws Exception {\n        Vector v1 = new DenseVector(new double[]{1, 2, 3, 4, 5});\n        Vector v2 = new DenseVector(new double[]{5, 4, 3, 2, 1});\n        Vector v3 = v1.add(v2);\n        log.info(\"Adding vectors: {}\", v3);\n    }\n\n    public void scaleVector() throws Exception {\n        Vector v1 = new DenseVector(new double[]{1, 2, 3, 4, 5});\n        Vector v2 = v1.scaled(2.0);\n        log.info(\"Scaling a vector: {}\", v2);\n    }\n\n    public void innerProductVectors() throws Exception {\n        Vector v1 = new DenseVector(new double[]{1, 2, 3, 4, 5});\n        Vector v2 = new DenseVector(new double[]{5, 4, 3, 2, 1});\n        double inner = v1.innerProduct(v2);\n        log.info(\"Vector inner product: {}\", inner);\n    }\n\n    public void addingMatrices() throws Exception {\n        Matrix m1 = new DenseMatrix(new double[][]{\n            {1, 2, 3},\n            {4, 5, 6}\n        });\n\n        Matrix m2 = new DenseMatrix(new double[][]{\n            {3, 2, 1},\n            {6, 5, 4}\n        });\n\n        Matrix m3 = m1.add(m2);\n        log.info(\"Adding matrices: {}\", m3);\n    }\n\n    public void multiplyMatrices() throws Exception {\n        Matrix m1 = new DenseMatrix(new double[][]{\n            {1, 2, 3},\n            {4, 5, 6}\n        });\n\n        Matrix m2 = new DenseMatrix(new double[][]{\n            {1, 4},\n            {2, 5},\n            {3, 6}\n        });\n\n        Matrix m3 = m1.multiply(m2);\n        log.info(\"Multiplying matrices: {}\", m3);\n    }\n\n    public void inverseMatrix() {\n        Matrix m1 = new DenseMatrix(new double[][]{\n            {1, 2},\n            {3, 4}\n        });\n\n        Inverse m2 = new Inverse(m1);\n        log.info(\"Inverting a matrix: {}\", m2);\n        log.info(\"Verifying a matrix inverse: {}\", m1.multiply(m2));\n    }\n\n    public Polynomial createPolynomial() {\n        return new Polynomial(new double[]{3, -5, 1});\n    }\n\n    public void evaluatePolynomial(Polynomial p) {\n        // Evaluate using a real number\n        log.info(\"Evaluating a polynomial using a real number: {}\", p.evaluate(5));\n        // Evaluate using a complex number\n        log.info(\"Evaluating a polynomial using a complex number: {}\", p.evaluate(new Complex(1, 2)));\n    }\n\n    public void solvePolynomial() {\n        Polynomial p = new Polynomial(new double[]{2, 2, -4});\n        PolyRootSolver solver = new PolyRoot();\n        List\u003c? extends Number\u003e roots = solver.solve(p);\n        log.info(\"Finding polynomial roots: {}\", roots);\n    }\n\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeephaven%2Fsuanshu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeephaven%2Fsuanshu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeephaven%2Fsuanshu/lists"}