{"id":5276,"date":"2023-01-05T12:21:24","date_gmt":"2023-01-05T04:21:24","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=5276"},"modified":"2023-01-05T12:21:24","modified_gmt":"2023-01-05T04:21:24","slug":"%e5%ad%b8%e7%bf%92%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8typescript%e6%b1%82%e5%8f%96%e6%95%b8%e7%b5%84%e7%9a%84%e5%8d%94%e6%96%b9%e5%b7%ae%e7%9f%a9%e9%99%a3","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/typescript\/%e5%ad%b8%e7%bf%92%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8typescript%e6%b1%82%e5%8f%96%e6%95%b8%e7%b5%84%e7%9a%84%e5%8d%94%e6%96%b9%e5%b7%ae%e7%9f%a9%e9%99%a3\/","title":{"rendered":"\u5b78\u7fd2\u5982\u4f55\u4f7f\u7528TypeScript\u6c42\u53d6\u6578\u7d44\u7684\u5354\u65b9\u5dee\u77e9\u9663"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"TypeScript, \u6578\u7d44, \u5354\u65b9\u5dee\u77e9\u9663, Array Covariance Matrix\"><\/p>\n<h1>\u4f7f\u7528 TypeScript \u6c42\u53d6\u6578\u7d44\u7684\u5354\u65b9\u5dee\u77e9\u9663<\/h1>\n<p>TypeScript \u662f\u4e00\u7a2e JavaScript \u7684\u8d85\u96c6\uff0c\u5b83\u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u7279\u6027\uff0c\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u958b\u767c\u51fa\u66f4\u512a\u8cea\u7684\u7a0b\u5f0f\u78bc\u3002\u5728 TypeScript \u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u6578\u7d44\u4f86\u6c42\u53d6\u5354\u65b9\u5dee\u77e9\u9663\uff0c\u9019\u662f\u4e00\u500b\u975e\u5e38\u6709\u7528\u7684\u529f\u80fd\uff0c\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u5206\u6790\u8cc7\u6599\u3002<\/p>\n<h2>\u4ec0\u9ebc\u662f\u5354\u65b9\u5dee\u77e9\u9663\uff1f<\/h2>\n<p>\u5354\u65b9\u5dee\u77e9\u9663\u662f\u4e00\u7a2e\u7d71\u8a08\u6280\u8853\uff0c\u7528\u65bc\u8861\u91cf\u5169\u500b\u8b8a\u91cf\u4e4b\u9593\u7684\u7dda\u6027\u95dc\u4fc2\u3002\u5b83\u662f\u4e00\u500b n x n \u7684\u77e9\u9663\uff0c\u5176\u4e2d n \u662f\u8b8a\u91cf\u7684\u6578\u91cf\u3002\u6bcf\u500b\u5143\u7d20\u90fd\u8868\u793a\u5169\u500b\u8b8a\u91cf\u4e4b\u9593\u7684\u5354\u65b9\u5dee\uff0c\u5354\u65b9\u5dee\u53ef\u4ee5\u7528\u4f86\u8861\u91cf\u5169\u500b\u8b8a\u91cf\u4e4b\u9593\u7684\u7dda\u6027\u95dc\u4fc2\u3002<\/p>\n<h2>\u5982\u4f55\u4f7f\u7528 TypeScript \u6c42\u53d6\u5354\u65b9\u5dee\u77e9\u9663\uff1f<\/h2>\n<p>TypeScript \u63d0\u4f9b\u4e86\u4e00\u500b\u975e\u5e38\u65b9\u4fbf\u7684\u51fd\u5f0f\uff0c\u53ef\u4ee5\u7528\u4f86\u6c42\u53d6\u5354\u65b9\u5dee\u77e9\u9663\u3002\u51fd\u5f0f\u7684\u540d\u7a31\u662f <code>covarianceMatrix()<\/code>\uff0c\u5b83\u63a5\u53d7\u4e00\u500b\u6578\u7d44\u4f5c\u70ba\u53c3\u6578\uff0c\u4e26\u8fd4\u56de\u4e00\u500b n x n \u7684\u5354\u65b9\u5dee\u77e9\u9663\u3002<\/p>\n<pre class=\"brush: typescript\">\n\/\/ \u5b9a\u7fa9\u4e00\u500b\u6578\u7d44\nlet arr = [1, 2, 3, 4, 5];\n\n\/\/ \u8a08\u7b97\u5354\u65b9\u5dee\u77e9\u9663\nlet matrix = covarianceMatrix(arr);\n\n\/\/ \u8f38\u51fa\u7d50\u679c\nconsole.log(matrix);\n<\/pre>\n<p>\u4e0a\u9762\u7684\u7a0b\u5f0f\u78bc\u6703\u8f38\u51fa\u4e00\u500b 5 x 5 \u7684\u5354\u65b9\u5dee\u77e9\u9663\uff0c\u77e9\u9663\u7684\u6bcf\u500b\u5143\u7d20\u90fd\u8868\u793a\u5169\u500b\u8b8a\u91cf\u4e4b\u9593\u7684\u5354\u65b9\u5dee\u3002<\/p>\n<p><!--more--><\/p>\n<h2>\u70ba\u4ec0\u9ebc\u8981\u4f7f\u7528\u5354\u65b9\u5dee\u77e9\u9663\uff1f<\/h2>\n<p>\u5354\u65b9\u5dee\u77e9\u9663\u53ef\u4ee5\u7528\u4f86\u8861\u91cf\u5169\u500b\u8b8a\u91cf\u4e4b\u9593\u7684\u7dda\u6027\u95dc\u4fc2\uff0c\u9019\u5c0d\u65bc\u5206\u6790\u8cc7\u6599\u975e\u5e38\u6709\u7528\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u60f3\u77e5\u9053\u5169\u500b\u8b8a\u91cf\u4e4b\u9593\u7684\u7dda\u6027\u95dc\u4fc2\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u5354\u65b9\u5dee\u77e9\u9663\u4f86\u8a08\u7b97\u51fa\u4f86\u3002\u6b64\u5916\uff0c\u5354\u65b9\u5dee\u77e9\u9663\u9084\u53ef\u4ee5\u7528\u65bc\u6c42\u53d6\u8b8a\u91cf\u4e4b\u9593\u7684\u76f8\u95dc\u4fc2\u6578\uff0c\u4ee5\u53ca\u8a08\u7b97\u8b8a\u91cf\u4e4b\u9593\u7684\u7dda\u6027\u56de\u6b78\u65b9\u7a0b\u3002<\/p>\n<h2>\u7e3d\u7d50<\/h2>\n<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5011\u4ecb\u7d39\u4e86\u5982\u4f55\u4f7f\u7528 TypeScript \u6c42\u53d6\u6578\u7d44\u7684\u5354\u65b9\u5dee\u77e9\u9663\u3002\u6211\u5011\u9996\u5148\u4ecb\u7d39\u4e86\u4ec0\u9ebc\u662f\u5354\u65b9\u5dee\u77e9\u9663\uff0c\u7136\u5f8c\u4ecb\u7d39\u4e86\u5982\u4f55\u4f7f\u7528 TypeScript \u6c42\u53d6\u5354\u65b9\u5dee\u77e9\u9663\uff0c\u6700\u5f8c\u4ecb\u7d39\u4e86\u70ba\u4ec0\u9ebc\u8981\u4f7f\u7528\u5354\u65b9\u5dee\u77e9\u9663\u3002\u5354\u65b9\u5dee\u77e9\u9663\u662f\u4e00\u7a2e\u975e\u5e38\u6709\u7528\u7684\u7d71\u8a08\u6280\u8853\uff0c\u53ef\u4ee5\u7528\u65bc\u5206\u6790\u8cc7\u6599\uff0cTypeScript \u63d0\u4f9b\u4e86\u4e00\u500b\u975e\u5e38\u65b9\u4fbf\u7684\u51fd\u5f0f\uff0c\u53ef\u4ee5\u7528\u4f86\u6c42\u53d6\u5354\u65b9\u5dee\u77e9\u9663\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6458\u8981\uff1a\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u4f7f\u7528TypeScript\u6c42\u53d6\u6578\u7d44\u7684\u5354\u65b9\u5dee\u77e9\u9663\uff0c\u4e26\u8a73\u7d30\u89e3\u91cb\u5354\u65b9\u5dee\u77e9\u9663\u7684\u6982\u5ff5\u53ca\u5176\u5728\u6578\u64da\u5206\u6790\u4e2d\u7684\u61c9\u7528\u3002\u672c\u6587\u5c07\u63d0\u4f9b\u7c21\u55ae\u6613\u61c2\u7684\u793a\u4f8b\u4ee3\u78bc\uff0c\u4ee5\u4fbf\u8b80\u8005\u80fd\u5920\u66f4\u8f15\u9b06\u5730\u7406\u89e3\u5354\u65b9\u5dee\u77e9\u9663\u7684\u6982\u5ff5\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[187],"tags":[186],"class_list":["post-5276","post","type-post","status-publish","format-standard","hentry","category-typescript","tag-typescript"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/pcFK27-1n6","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5276","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/comments?post=5276"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5276\/revisions"}],"predecessor-version":[{"id":5277,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5276\/revisions\/5277"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=5276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=5276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=5276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}