{"id":14989252,"url":"https://github.com/atsushisakai/numpycpp","last_synced_at":"2025-10-08T15:15:41.883Z","repository":{"id":147425209,"uuid":"86411215","full_name":"AtsushiSakai/numpycpp","owner":"AtsushiSakai","description":"A c++ header library for matrix operation inspired Numpy Scipy, MATLAB only using Eigen.","archived":false,"fork":false,"pushed_at":"2017-04-10T22:28:42.000Z","size":15,"stargazers_count":47,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-19T05:36:16.571Z","etag":null,"topics":["cpp","cpp-library","eigen","header-only","matrix-library","numpy","scipy"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AtsushiSakai.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":"2017-03-28T03:33:19.000Z","updated_at":"2025-01-21T09:55:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"090e92ad-888c-4ccf-ad1e-011bbbc95df6","html_url":"https://github.com/AtsushiSakai/numpycpp","commit_stats":{"total_commits":15,"total_committers":1,"mean_commits":15.0,"dds":0.0,"last_synced_commit":"e171558f1440bc82425dc527b515eff80a37c3b6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AtsushiSakai/numpycpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtsushiSakai%2Fnumpycpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtsushiSakai%2Fnumpycpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtsushiSakai%2Fnumpycpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtsushiSakai%2Fnumpycpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AtsushiSakai","download_url":"https://codeload.github.com/AtsushiSakai/numpycpp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtsushiSakai%2Fnumpycpp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278965531,"owners_count":26076919,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","cpp-library","eigen","header-only","matrix-library","numpy","scipy"],"created_at":"2024-09-24T14:17:56.574Z","updated_at":"2025-10-08T15:15:41.855Z","avatar_url":"https://github.com/AtsushiSakai.png","language":"C++","readme":"# numpycpp\n[![Build Status](https://travis-ci.org/AtsushiSakai/numpycpp.svg?branch=master)](https://travis-ci.org/AtsushiSakai/numpycpp)\n\nA c++ header library for matrix operation inspired Numpy, Scipy and MATLAB only using Eigen.\n\nThis library has some APIs which Numpy, Scipy, MATLAB has, but Eigen doesn't.\n\nYou can use it with only Eigen, and only include it.\n\n# Requrements\n\n- [Eigen](http://eigen.tuxfamily.org/index.php?title=Main_Page)\n\n# How to use\n\nJust add a compile option to add the Eigen path, and include numpycpp.h in your code.\n\n# APIs\n\nThe test code: numpycppTest.cpp helps to understand APIs.\n\n## reshape\n\nGives a new shape to an array without changing its data.\n\nThis function is based on numpy.reshape \n\nsee: https://docs.scipy.org/doc/numpy/reference/generated/numpy.reshape.html\n\n    Eigen::MatrixXf x(6,1);\n    x\u003c\u003c1.0,2.0,3.0,4.0,5.0,6.0;\n    PRINT(x);\n\n    Eigen::MatrixXf rx = reshape(x,2,3);\n    PRINT(rx);\n    //rx:\n    //1 3 5\n    //2 4 6\n\n    Eigen::MatrixXf rx2 = reshape(x,3,2);\n    PRINT(rx2);\n    //rx2:\n    //1 4\n    //2 5\n    //3 6\n\n\n## isdiag\n\nDetemine if matrix is diagonal\n\nIf matrix is not square, return false\n\nIt is inspired by MATLAB isdiag function.\n\nsee: https://www.mathworks.com/help/matlab/ref/isdiag.html\n\n\n\n    Eigen::MatrixXf x(3,1);\n    x\u003c\u003c5.0,6.0,7.0;\n    bool flag = isdiag(x);//return false\n\n    Eigen::MatrixXf x2(2,2);\n    x2\u003c\u003c5.0,6.0,7.0,1.0;\n    bool flag2 = isdiag(x2);//return false\n\n    Eigen::MatrixXf x3(3,3);\n    x3\u003c\u003c1.0,0.0,0.0,\n        0.0,1.0,0.0,\n        0.0,0.0,1.0;\n    bool flag3 = isdiag(x3);//return true\n\n\n\n## vstack\n\nStack matrix in sequence vertically\n\nimspired by numpy.vstack\n\nsee :https://docs.scipy.org/doc/numpy/reference/generated/numpy.vstack.html\n\n    Eigen::MatrixXf x(3,1);\n    x\u003c\u003c5.0,\n       6.0,\n       7.0;\n\n    Eigen::MatrixXf y(3,1);\n    y\u003c\u003c1.0,\n       10.0,\n       100.0;\n\n    Eigen::MatrixXf a = vstack(x,y);\n    //ans\u003c\u003c5,\n    //     6,\n    //     7,\n    //     1,\n    //     10,\n    //     100;\n\n## hstack\n\nStack matrix in sequence horizontally\n\nimspired by numpy.hstack\n\nsee: https://docs.scipy.org/doc/numpy/reference/generated/numpy.hstack.html\n \n\n    Eigen::MatrixXf x(3,1);\n    x\u003c\u003c5.0,\n       6.0,\n       7.0;\n\n    Eigen::MatrixXf y(3,1);\n    y\u003c\u003c1.0,\n       10.0,\n       100.0;\n\n    Eigen::MatrixXf a = hstack(x,y);\n    //a=\n    //5   1\n    //6  10\n    //7 100\n\n## kron\n\nCompute the Kronecker product\n\nA composite array made of blocks of the second array scaled by the first.\n\nInspired numpy.kron. \n\nsee: https://docs.scipy.org/doc/numpy/reference/generated/numpy.kron.html\n\n\n    Eigen::MatrixXf x(1,3);\n    x\u003c\u003c1.0,10.0,100.0;\n\n    Eigen::MatrixXf y(1,3);\n    y\u003c\u003c5.0,6.0,7.0;\n\n    Eigen::MatrixXf a = kron(x,y);\n    // a = [5 50 500  6 60 600  7  70 700]\n\n\n## block_diag\n\nCreate a block diagonal matrix from provided matrices\n\ninspired scipy.linalg.block_diag\n\nsee: https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.linalg.block_diag.html\n\n\n    Eigen::MatrixXf x(3,1);\n    x\u003c\u003c5.0,\n       6.0,\n       7.0;\n\n    Eigen::MatrixXf y(1,3);\n    y\u003c\u003c1.0,10.0,100.0;\n\n    Eigen::MatrixXf a = block_diag(x,y);\n    //a=  5,  0,  0,  0,\n    //    6,  0,  0,  0,\n    //    7,  0,  0,  0,\n    //    0,  1, 10,100;\n\n\n# License \n\nMIT\n\n# Author\n\nAtsushi Sakai ([@Atsushi_twi](https://twitter.com/Atsushi_twi))\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatsushisakai%2Fnumpycpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatsushisakai%2Fnumpycpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatsushisakai%2Fnumpycpp/lists"}