From: "Steve Johnson" <scj@yaccman.com>
To: "Doug McIlroy" <doug@cs.dartmouth.edu>,
tuhs@tuhs.org, jnc@mercury.lcs.mit.edu
Subject: Re: [TUHS] block operations in editors, was My EuroBSDcon talk
Date: Tue, 17 Sep 2019 21:47:47 -0700 [thread overview]
Message-ID: <2af4396e3f1133dfb93c2a92722e6f0e850ade55@webmail.yaccman.com> (raw)
In-Reply-To: <201909171731.x8HHVq2L096688@tahoe.cs.Dartmouth.EDU>
[-- Attachment #1: Type: text/plain, Size: 1771 bytes --]
This is one of my pet peeves. "Random Access" memory is far from
random when you look at the time it takes to do the accesses. With
modern memories, accessing a column can be 20 to 40x slower than
accessing a row. This is particularly irritating when doing AI
training, where training reuses 4-d tensors transposed, a very painful
operation.
In FORTRAN days, I once used a vector package in which you described a
vector by giving the first element, the second element, and a count.
So you could describe rows, columns, a matrix diagonal, and even rows
and columns from back to front. Fortran passed arguments by address,
which made the whole thing easy and fast.
Steve
----- Original Message -----
From: "Doug McIlroy" <doug@cs.dartmouth.edu>
To:<tuhs@tuhs.org>, <jnc@mercury.lcs.mit.edu>
Cc:
Sent:Tue, 17 Sep 2019 13:31:52 -0400
Subject:Re: [TUHS] block operations in editors, was My EuroBSDcon talk
Noel Chiappa wrote:
> > From: Doug McIlroy
>
> > the absence of multidemensional arrays in C.
>
>?? From the 'C Reference Manual' (no date, but circa 'Typesetter
C'), pg. 11:
>
> "If the unadorned declarator D would specify an n-dimensional array
.. then
> the declarator D[in+1] yields an (n+1)-dimensional array"
>
>
>I'm not sure if I've _ever_ used one, but they are there.
Yes, C allows arrays of arrays, and I've used them aplenty.
However an "n-dimensional array" has one favored dimension,
out of which you can slice an array of lower dimension. For
example, you can pass a row of a 2D array to a function of a
1D variable, but you can't pass a column. That asymmetry
underlies my assertion. In Python, by contrast, n-dimensional
arrays can be sliced on any dimension.
Doug
[-- Attachment #2: Type: text/html, Size: 2564 bytes --]
next prev parent reply other threads:[~2019-09-18 4:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-17 17:31 Doug McIlroy
2019-09-18 4:47 ` Steve Johnson [this message]
2019-09-18 4:52 ` Jon Steinhart
-- strict thread matches above, loose matches on Subject: below --
2019-09-17 15:36 Noel Chiappa
2019-09-17 11:34 Thomas Paulsen
2019-09-17 0:20 Doug McIlroy
2019-09-17 0:42 ` G. Branden Robinson
2019-09-17 2:02 ` George Michaelson
2019-09-17 11:01 ` Thomas Paulsen
2019-09-17 1:25 ` Bakul Shah
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2af4396e3f1133dfb93c2a92722e6f0e850ade55@webmail.yaccman.com \
--to=scj@yaccman.com \
--cc=doug@cs.dartmouth.edu \
--cc=jnc@mercury.lcs.mit.edu \
--cc=tuhs@tuhs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).