René's URL Explorer Experiment


Title: ostream::operator<< output shows wrong # of values for 2-d array if strides unusual · Issue #57 · ndarray/ndarray · GitHub

Open Graph Title: ostream::operator<< output shows wrong # of values for 2-d array if strides unusual · Issue #57 · ndarray/ndarray

X Title: ostream::operator<< output shows wrong # of values for 2-d array if strides unusual · Issue #57 · ndarray/ndarray

Description: The following sample code produces very odd output to cout using operator<< in the second case (doTranspose == 1): #include #include #include "ndarray.h" int main() { // include extra values to avoid reading off the e...

Open Graph Description: The following sample code produces very odd output to cout using operator<< in the second case (doTranspose == 1): #include #include #include "ndarray.h" int main() { // include...

X Description: The following sample code produces very odd output to cout using operator<< in the second case (doTranspose == 1): #include <iostream> #include <vector> #include "ndarray.h&q...

Opengraph URL: https://github.com/ndarray/ndarray/issues/57

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ostream::operator\u003c\u003c output shows wrong # of values for 2-d array if strides unusual","articleBody":"The following sample code produces very odd output to cout using `operator\u003c\u003c` in the second case (`doTranspose == 1`):\r\n```\r\n#include \u003ciostream\u003e\r\n#include \u003cvector\u003e\r\n#include \"ndarray.h\"\r\n\r\nint main() {\r\n    // include extra values to avoid reading off the end\r\n    std::vector\u003cdouble\u003e xvec = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};\r\n\r\n    int const len = 3;\r\n    auto shape1d = ndarray::makeVector(len);\r\n    auto strides1d = ndarray::makeVector(1);\r\n    // create x = {1, 2, 3} and y = {4, 5, 6}\r\n    ndarray::Array\u003cdouble, 1, 1\u003e x = ndarray::external(xvec.data(), shape1d, strides1d);\r\n    ndarray::Array\u003cdouble, 1, 1\u003e y = ndarray::external(xvec.data() + len, shape1d, strides1d);\r\n    std::cout \u003c\u003c \"x = \" \u003c\u003c x \u003c\u003c std::endl;\r\n    std::cout \u003c\u003c \"y = \" \u003c\u003c y \u003c\u003c std::endl;\r\n\r\n    for (int doTranspose = 0; doTranspose \u003c 2; ++doTranspose) {\r\n        auto xyshape = ndarray::makeVector(2, static_cast\u003cint\u003e(x.getSize\u003c0\u003e()));\r\n        std::cout \u003c\u003c \"\\nxyshape = \" \u003c\u003c xyshape \u003c\u003c std::endl;\r\n        auto xystrides = ndarray::makeVector(\u0026y[0] - \u0026x[0], static_cast\u003cstd::ptrdiff_t\u003e(1));\r\n        if (doTranspose) {\r\n            std::cout \u003c\u003c \"transpose xystrides: [[1, 4, 7], [2, 5, 8]]\" \u003c\u003c std::endl;\r\n            xystrides[1] = xystrides[0];\r\n            xystrides[0] = 1;\r\n        } else {\r\n            std::cout \u003c\u003c \"normal xystrides: [[1, 2, 3], [4, 5, 6]])\" \u003c\u003c std::endl;\r\n        }\r\n        std::cout \u003c\u003c \"xystrides = \" \u003c\u003c xystrides \u003c\u003c std::endl;\r\n        ndarray::Array\u003cdouble, 2, 1\u003e xy = ndarray::external(x.getData(), xyshape, xystrides);\r\n        std::cout \u003c\u003c \"xy.getSize\u003c0\u003e() = \" \u003c\u003c xy.getSize\u003c0\u003e() \u003c\u003c \"; xy.getSize\u003c1\u003e() = \" \u003c\u003c xy.getSize\u003c1\u003e() \u003c\u003c std::endl;\r\n\r\n        for (auto row = 0; row \u003c xy.getSize\u003c0\u003e(); ++row) {\r\n            for (int col = 0; col \u003c xy.getSize\u003c1\u003e(); ++col) {\r\n                std::cout \u003c\u003c \"xy[\" \u003c\u003c row \u003c\u003c \"][\" \u003c\u003c col \u003c\u003c \"] = \" \u003c\u003c xy[row][col] \u003c\u003c std::endl;\r\n            }\r\n        }\r\n\r\n        std::cout \u003c\u003c \"xy = \" \u003c\u003c xy \u003c\u003c std::endl;\r\n    }\r\n}\r\n```\r\n\r\nOn my system (clang 8.1.0 on macOS) all output is as expected except the final cout\u003c\u003c, which looks screwy and has far too many values:\r\n```\r\nx = [       1, 2, 3]\r\ny = [       4, 5, 6]\r\n\r\nxyshape = (2,3,)\r\nnormal xystrides: [[1, 2, 3], [4, 5, 6]])\r\nxystrides = (3,1,)\r\nxy.getSize\u003c0\u003e() = 2; xy.getSize\u003c1\u003e() = 3\r\nxy[0][0] = 1\r\nxy[0][1] = 2\r\nxy[0][2] = 3\r\nxy[1][0] = 4\r\nxy[1][1] = 5\r\nxy[1][2] = 6\r\nxy = [[       1, 2, 3], \r\n[       4, 5, 6]]\r\n\r\nxyshape = (2,3,)\r\ntranspose xystrides: [[1, 4, 7], [2, 5, 8]]\r\nxystrides = (1,3,)\r\nxy.getSize\u003c0\u003e() = 2; xy.getSize\u003c1\u003e() = 3\r\nxy[0][0] = 1\r\nxy[0][1] = 4\r\nxy[0][2] = 7\r\nxy[1][0] = 2\r\nxy[1][1] = 5\r\nxy[1][2] = 8\r\nxy = [[       1, 2, 3, 4, 5, 6, 7, 8, 9], \r\n[       2, 3, 4, 5, 6, 7, 8, 9, 10]]\r\n```","author":{"url":"https://github.com/r-owen","@type":"Person","name":"r-owen"},"datePublished":"2017-07-05T20:33:43.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/57/ndarray/issues/57"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:8c0410df-6dc6-a4f1-fe5a-a0579b1b6052
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDEF0:C8498:268DDEC:364C420:6970F678
html-safe-nonce69b6410f944d62181023ebd31974e3238d032b6bb928ed49d16f973ee43db8c1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERUYwOkM4NDk4OjI2OERERUM6MzY0QzQyMDo2OTcwRjY3OCIsInZpc2l0b3JfaWQiOiIxMTIwMzU2MTE1MTQ5ODEzMzY4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac87f8286c9f6e185b9dc34eebcf2d9bec8c14eb65b887714fa16c2ef38a8c9c6c
hovercard-subject-tagissue:240768011
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/ndarray/ndarray/57/issue_layout
twitter:imagehttps://opengraph.githubassets.com/96d4590973d7f1fb66f0d663c3f52154914b764c79f4a7e2150adb4ff09daf03/ndarray/ndarray/issues/57
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/96d4590973d7f1fb66f0d663c3f52154914b764c79f4a7e2150adb4ff09daf03/ndarray/ndarray/issues/57
og:image:altThe following sample code produces very odd output to cout using operator<< in the second case (doTranspose == 1): #include #include #include "ndarray.h" int main() { // include...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamer-owen
hostnamegithub.com
expected-hostnamegithub.com
None1b239ebed690c3053869ff31a3b7597834c25673659d63e7b6fd6a9b5d7853de
turbo-cache-controlno-preview
go-importgithub.com/ndarray/ndarray git https://github.com/ndarray/ndarray.git
octolytics-dimension-user_id1451802
octolytics-dimension-user_loginndarray
octolytics-dimension-repository_id3487413
octolytics-dimension-repository_nwondarray/ndarray
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id3487413
octolytics-dimension-repository_network_root_nwondarray/ndarray
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseaeacfd55297f3de5395c83f200ac35d1f474115e
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/ndarray/ndarray/issues/57#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fndarray%2Fndarray%2Fissues%2F57
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fndarray%2Fndarray%2Fissues%2F57
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=ndarray%2Fndarray
Reloadhttps://patch-diff.githubusercontent.com/ndarray/ndarray/issues/57
Reloadhttps://patch-diff.githubusercontent.com/ndarray/ndarray/issues/57
Reloadhttps://patch-diff.githubusercontent.com/ndarray/ndarray/issues/57
ndarray https://patch-diff.githubusercontent.com/ndarray
ndarrayhttps://patch-diff.githubusercontent.com/ndarray/ndarray
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fndarray%2Fndarray
Fork 36 https://patch-diff.githubusercontent.com/login?return_to=%2Fndarray%2Fndarray
Star 163 https://patch-diff.githubusercontent.com/login?return_to=%2Fndarray%2Fndarray
Code https://patch-diff.githubusercontent.com/ndarray/ndarray
Issues 22 https://patch-diff.githubusercontent.com/ndarray/ndarray/issues
Pull requests 4 https://patch-diff.githubusercontent.com/ndarray/ndarray/pulls
Actions https://patch-diff.githubusercontent.com/ndarray/ndarray/actions
Projects 0 https://patch-diff.githubusercontent.com/ndarray/ndarray/projects
Wiki https://patch-diff.githubusercontent.com/ndarray/ndarray/wiki
Security Uh oh! There was an error while loading. Please reload this page. https://patch-diff.githubusercontent.com/ndarray/ndarray/security
Please reload this pagehttps://patch-diff.githubusercontent.com/ndarray/ndarray/issues/57
Insights https://patch-diff.githubusercontent.com/ndarray/ndarray/pulse
Code https://patch-diff.githubusercontent.com/ndarray/ndarray
Issues https://patch-diff.githubusercontent.com/ndarray/ndarray/issues
Pull requests https://patch-diff.githubusercontent.com/ndarray/ndarray/pulls
Actions https://patch-diff.githubusercontent.com/ndarray/ndarray/actions
Projects https://patch-diff.githubusercontent.com/ndarray/ndarray/projects
Wiki https://patch-diff.githubusercontent.com/ndarray/ndarray/wiki
Security https://patch-diff.githubusercontent.com/ndarray/ndarray/security
Insights https://patch-diff.githubusercontent.com/ndarray/ndarray/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/ndarray/ndarray/issues/57
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/ndarray/ndarray/issues/57
ostream::operator<< output shows wrong # of values for 2-d array if strides unusualhttps://patch-diff.githubusercontent.com/ndarray/ndarray/issues/57#top
https://github.com/r-owen
https://github.com/r-owen
r-owenhttps://github.com/r-owen
on Jul 5, 2017https://github.com/ndarray/ndarray/issues/57#issue-240768011
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.