Monday, June 10, 2019

Digest for comp.lang.c++@googlegroups.com - 13 updates in 7 topics

Horizon68 <horizon@horizon.com>: Jun 10 02:41PM -0700

Hello...
 
Read this:
 
 
Here is a very interesting good news especially for Artificial intelligence:
 
Optalysys Claims AI Breakthrough Using Optical Processing Technology
 
Read more here:
 
https://www.top500.org/news/optalysys-claims-ai-breakthrough-using-optical-processing-technology/
 
Optalysys optical processing systems will "turbo-charge" existing
computers by performing processor-intensive tasks at much faster rates
and with a significant reduction in energy consumption. The prototype is
portable and has a footprint similar to a desktop computer. The
technology has the potential to achieve Exascale processing levels by 2020.
 
Optalysys Chairman, James Duez, said "Following that we plan to pursue
the design of larger systems capable of achieving multiple exaFLOPs by
2020."
 
Investors begin to see the light – Optalysys
 
Today Boston-based Lightmatter announced an investment of $22million led
by Google's Alphabet, providing further proof that the world is
embracing optical processing technology – using light rather than
silicon to perform the mathematical calculations used in AI models.
 
Read more here:
 
http://edenrockcm.com/updates/investors-begin-see-light-optalysys/
 
 
Thank you,
Amine Moulay Ramdane.
Juha Nieminen <nospam@thanks.invalid>: Jun 10 05:51AM

> std::transform rather than with explicit for-loops and it does indeed make
> it a one liner in which use of a lambda would be appropriate if std::xor
> didn't exist.
 
I see absolutely no reason to not use a for-loop. It's not harder to
understand.
 
Using a for-loop may also allow for more speed optimizations.
std::transform might or might not perform speed optimizations itself,
but it's of course not guaranteed.
"Öö Tiib" <ootiib@hot.ee>: Jun 10 12:13AM -0700

On Friday, 7 June 2019 16:54:17 UTC+3, Mr Flibble wrote:
> > (including definition of main).
 
> Why only for non-void functions? If your primary concern is consistency
> then be fucking consistent.
 
Because "function" that returns nothing is different kind of
citizen ("procedure", "subroutine") than "function" in lot
of programming languages for reason.
Therefore "constexpr auto" - pure function, "auto" - impure
function or "void" - procedure at start of declaration would
add that clarity.
"Öö Tiib" <ootiib@hot.ee>: Jun 10 12:47AM -0700

On Monday, 10 June 2019 08:52:08 UTC+3, Juha Nieminen wrote:
 
> Using a for-loop may also allow for more speed optimizations.
> std::transform might or might not perform speed optimizations itself,
> but it's of course not guaranteed.
 
So usage of std::transform might result with extra speed optimizations
and/or usage of for loop might result with extra speed optimizations
but neither is guaranteed.
 
Therefore if we think that efficiency may be different then we have
to profile both. We have to profile in context of actual usage,
compiled with actual production compiler/flags and ran on actual
target hardware. Doing it in some toy benchmark or newsgroup
post shows nothing.
Juha Nieminen <nospam@thanks.invalid>: Jun 10 09:58AM


> So usage of std::transform might result with extra speed optimizations
> and/or usage of for loop might result with extra speed optimizations
> but neither is guaranteed.
 
What I meant is that the for-loop may allow for "manual" speed
optimization by the programmer (such as using #pragma omp).
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Jun 10 12:17PM +0100

On Mon, 10 Jun 2019 00:47:50 -0700 (PDT)
> compiled with actual production compiler/flags and ran on actual
> target hardware. Doing it in some toy benchmark or newsgroup
> post shows nothing.
 
I agree with what you say except that since std::transform is a
template function the compiler is going to have pretty much the same
optimization opportunities as with a well-written hand-written loop.
 
Using the C++ algorithms where relevant such as std::transform (map),
std::accumulate (fold/reduce), std::adjacent_difference (differentiate),
std::partial_sum (integrate), std::rotate, std::stable_partition and
std::partial_sort makes code significantly easier to understand, and it
generally annoys me when people try to do exactly the same by hand (and
usually less well and obscurely). People often seem to do this through
ignorance.
jameskuyper@alumni.caltech.edu: Jun 10 08:01AM -0700

On Thursday, June 6, 2019 at 9:15:36 AM UTC-4, Jorgen Grahn wrote:
 
> > I think this can be done with a lambda function? and a mapping function
> > on the vectors but don't immediately know the procedure I would use.
 
> The function would be xor(a, b) -- is there a std::xor already?
 
As far as I can tell, no. If such a thing could exist (see below) I'd expect it to be described in section 23.14.9, and it's not there. However, std::bit_xor does exist, and std::bit_xor(a,b) is defined as a^b.
 
There's a good reason why std::xor() can't exist: xor is defined as an alternative token (5.5p2), and therefore cannot be used as an identifier.
 
> begin(vector2),
> begin(dest),
> xor);
 
Because xor is an alternative token, that results in the following messages when I try to compile it:
 
error: expected primary-expression before 'xor' token
xor);
^~~
error: expected primary-expression before ')' token
xor);
^
Jorgen Grahn <grahn+nntp@snipabacken.se>: Jun 10 02:01PM

On Sun, 2019-06-09, G G wrote:
> int y;
> } position; // a structure variable
 
> when would something where the tag is omitted be useful?
 
Sometimes, if I have a struct or class with too many members,
I can group some of them in such a struct.
 
class Foo {
// lots of stuff
 
std::function<void()> foo_callback;
std::function<void()> bar_callback;
std::function<void()> baz_callback;
};
 
class Foo {
// lots of stuff
 
struct {
std::function<void()> foo;
std::function<void()> bar;
std::function<void()> baz;
} callback;
};
 
Works better if foo, bar and baz are default-constructed,
so callbacks are perhaps not a good example ... a better
one would be a bunch of statistics counters.
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
unidef <jon@unidef-systems.com>: Jun 10 05:52AM -0500


> Designing new programming languages will be quick and easy with neos the
> universal compiler that can compile any programming language! :D
 
> /Flibble
 
You're into making programming languages? I tried to make a network
scripting language but someone took the source and sold it to apple :(
 
But, try putting your compiler in qemu, link it to the host, and use
multidimensional arrays to create a nexal cluster (I think that's the right
word)
 
--
"There is nothing certain in this world, aside from Death or Taxes" -
Benjamin Franklin
unidef <jon@unidef-systems.com>: Jun 10 05:46AM -0500

How plausible is it in the real world? Fast cpu, plenty of ram, fast
internet, the 600$ works
 
Let's say we have class kernel, we can do (with our custom compiler)
 
CVAR main(/* args */)
{
Kernel *SYSTEM[MATRIX][MATRIX]; // to as many dimensions
(..)
Revolving_dma(system mutex, "message") etc
Timing_thread(timed to messages and all that junk)
And while we're at it
System->ai.collect("think")
}
 
Does this sound like an adequate, logical, useful method of making a Unix
operating system? I have code at https://unidef.net/quantum.source I will
slowly port to c++ in order to get encapsulation, inheritance, and full
multidimensional smart pointers and templates working unless someone else
wants to jump in
 
I don't know about the posix compliance thing, I just want to get a c
compiler running on it and pray to portGod()->mercy;
 
--
"There is nothing certain in this world, aside from Death or Taxes" -
Benjamin Franklin
Juha Nieminen <nospam@thanks.invalid>: Jun 10 05:57AM

>> guaranteed to contain any specific values.
 
> A slip of the keyboard: I think you meant that non-static arrays of
> basic types are not initialized (static ones are zero initialized).
 
I'm using the term "static array" to mean a C-style array allocated
on the stack with a compile-time size. I'm not using it to mean
"an array that uses the keyword 'static'."
 
In other words "static array" is in contrast with "dynamic array",
which is an array that has been dynamically allocated (eg. with 'new').
In this case, "static" is the opposite of "dynamic". It's completely
unrelated to the 'static' keyword.
 
What is the correct term for C-style arrays, if not static array?
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Jun 10 11:07AM +0100

On Mon, 10 Jun 2019 05:57:10 -0000 (UTC)
> which is an array that has been dynamically allocated (eg. with 'new').
> In this case, "static" is the opposite of "dynamic". It's completely
> unrelated to the 'static' keyword.
 
I would use the expression "stack-allocated array" or more accurately
"array with automatic storage duration" for those. However, that is
irrelevant to whether the array elements are initialized or not: if the
array elements are of built-in type, they will be uninitialized whether
the array is allocated by new (dynamically allocated) or it is a local
stack-allocated array.
 
"static array" has a particular meaning in C++ and it is best to stick
to it. Arrays with static storage duration, whether in function scope
or in namespace scope, _are_ statically initialized and therefore are
either constant initialized or if not zero initialized.
 
> What is the correct term for C-style arrays, if not static array?
 
Definitely not "static array". I would use "C-style array", or more
simply do what the C++ standard does and refer to them as an "array":
the standard uses the the word "array" as signifying a C-style array
unless the word is used in the context of class template array
(std::array). But as I say, this is orthogonal to the issue of whether
array elements are zero initialized or not.
"Öö Tiib" <ootiib@hot.ee>: Jun 10 12:24AM -0700

On Friday, 7 June 2019 21:56:49 UTC+3, Christian Gollwitzer wrote:
> standard defines bit-exact addition, subtraction, multiplication and
> square root. So even across architecture, with the same IEEE flags set
> (rounding etc.) simple computations give bit-identical results.
 
See the elaboration of that example (quoted from paper):
 
int main() {
double q;
q = 3.0/7.0;
if (q == 3.0/7.0) printf("Equal\n");
else printf("Not Equal\n");
return 0;
}
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: