{"id":3042,"date":"2020-04-25T13:44:12","date_gmt":"2020-04-25T04:44:12","guid":{"rendered":"https:\/\/www.ktech.biz\/jp\/?p=3042"},"modified":"2020-08-09T15:10:48","modified_gmt":"2020-08-09T06:10:48","slug":"python","status":"publish","type":"post","link":"https:\/\/www.ktech.biz\/jp\/manual-api\/python\/","title":{"rendered":"XLPack API: Python \u4f7f\u7528\u4f8b"},"content":{"rendered":"<h3>Python\u304b\u3089XLPack\u3092\u547c\u3073\u51fa\u3059<\/h3>\n<p>Python\u304b\u3089XLPack Lite\u3092\u547c\u3073\u51fa\u3059\u305f\u3081\u306b\u5fc5\u8981\u306a\u62e1\u5f35\u30e2\u30b8\u30e5\u30fc\u30eb\u304cSDK\u306b\u5165\u3063\u3066\u3044\u307e\u3059. \u3053\u308c\u3092\u4f7f\u3046\u3068, \u547c\u3073\u51fa\u3057\u30d7\u30ed\u30b0\u30e9\u30e0\u306f &#8220;import XLPackLite&#8221; (32\u30d3\u30c3\u30c8\u7248\u3067\u306f &#8220;import XLPackLite_32&#8221;) \u3068\u5ba3\u8a00\u3059\u308b\u3060\u3051\u3067\u7d44\u8fbc\u307f\u95a2\u6570\u306e\u3088\u3046\u306b\u7c21\u5358\u306bXLPack Lite\u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059.<br \/>\n\u884c\u5217\u3092\u8868\u3059\u305f\u3081\u306b\u306fNumpy\u306endarray\u3092\u4f7f\u7528\u3057\u307e\u3059. \u4fc2\u6570\u884c\u5217a, \u53f3\u8fbab\u3068\u3082\u306b1\u6b21\u5143\u914d\u5217\u3067\u30822\u6b21\u5143\u914d\u5217\u3067\u3082\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059.<\/p>\n<h3>Python\u30d7\u30ed\u30b0\u30e9\u30e0\u4f8b (\u4f8b\u984c(1))<\/h3>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>import numpy as np\nfrom XLPack import *\n\ndef TestDgesv():\n    n = 3\n    a = np.array([\n        [0.2, -0.32, -0.8],\n        [-0.11, 0.81, -0.92],\n        [-0.93, 0.37, -0.29]])\n    b = np.array([-0.3727, 0.4319, -1.4247])\n    ipiv = np.empty(n, dtype=int)\n    info = dgesv(n, a, ipiv, b)\n    print(b, info)\n\nTestDgesv()<\/code><\/pre>\n<\/div>\n<p>\u5b9f\u884c\u7d50\u679c<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-plane\"><code>[0.86 0.64 0.51] 0<\/code><\/pre>\n<\/div>\n<h3>Python\u30d7\u30ed\u30b0\u30e9\u30e0\u4f8b (\u4f8b\u984c(2))<\/h3>\n<p>\u4f8b\u984c(2)\u3067\u306ff(x)\u306e\u7a4d\u5206\u3092qk15\u3092\u4f7f\u3063\u3066\u6c42\u3081\u307e\u3059. qk15\u306ff(x)\u3092\u5b9a\u7fa9\u3059\u308b\u5916\u90e8\u95a2\u6570\u3092\u5fc5\u8981\u3068\u3057\u307e\u3059. \u5916\u90e8\u95a2\u6570\u306fPython\u3067\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d, qk15\u306f\u5fc5\u8981\u306a\u3068\u304d\u306b\u305d\u308c\u3092\u547c\u3073\u51fa\u3057\u307e\u3059.<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>import numpy as np\nfrom XLPack import *\n\ndef f(x):\n    return 1\/(1 + x**2)\n\ndef TestQk15():\n    a = 0\n    b = 4\n    s, abserr = qk15(f, a, b)\n    print(s, abserr)\n\nTestQk15()<\/code><\/pre>\n<\/div>\n<p>\u5b9f\u884c\u7d50\u679c<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-plane\"><code>1.3258176613637855 0.0014827239412162237\n<\/code><\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Python\u304b\u3089XLPack\u3092\u547c\u3073\u51fa\u3059 Python\u304b\u3089XLPack Lite\u3092\u547c\u3073\u51fa\u3059\u305f\u3081\u306b\u5fc5\u8981\u306a\u62e1\u5f35\u30e2\u30b8\u30e5\u30fc\u30eb\u304cSDK\u306b\u5165\u3063\u3066\u3044\u307e\u3059. \u3053\u308c\u3092\u4f7f\u3046\u3068, \u547c\u3073\u51fa\u3057\u30d7\u30ed\u30b0\u30e9\u30e0\u306f &#8220;import XLPackL [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[16],"tags":[],"class_list":["post-3042","post","type-post","status-publish","format-standard","hentry","category-manual-api"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/posts\/3042","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/comments?post=3042"}],"version-history":[{"count":3,"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/posts\/3042\/revisions"}],"predecessor-version":[{"id":3137,"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/posts\/3042\/revisions\/3137"}],"wp:attachment":[{"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/media?parent=3042"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/categories?post=3042"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/tags?post=3042"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}