« first day (2979 days earlier)      last day (1936 days later) » 

user301074
12:11 AM
I really made some confusions... what i mean't was X<Y and Y<X.
 
user301074
< is the symbol for "strictly causally precedes".
 
user301074
obs: X and Y are distinct event's in spacetime.
 
Yeah, still, there's no problem with that, as long as the spacetime geometry allows closed timelike curves.
 
user301074
Ok, thank's.
 
user301074
12:28 AM
Sorry for the horrible english... it's not my first language. if i said something wrong pls correct me.
 
user301074
At this time i perceive that mathematics expresses more this type of thinking than normal language.
 
3:51 PM
Glad I made it home before the snow storm
 
I wish we had a snow storm. It's 8°C and foggy as hell, worst conditions to watch fireworks ever
 
Well, strong wind is also not so good for fireworks.
 
Hm, true. Better no precipitation at all, then ;)
 
4:17 PM
@ACuriousMind just about the same here, though slightly warmer
 
wishes everyone a happy new year
 
Anonymous
Happy new year, everyone! :D
 
@Blue thank you
 
Anonymous
Returned home at the nick of time. Got to watch a snowfall for the first time in my life!
 
Anonymous
@ayc Went down to -2°C at night ;). And yes, it was shivering cold. Had to wear four to five layers of full shirts, woollens and jackets. Fun, nonetheless.
 
4:30 PM
@Blue i hadn't seen a snowfall in my life
 
Anonymous
@Akash.B It's beautiful (at least when you're not shivering). :)
 
@Blue indeed
@Blue ha ha
but its good
 
You can come and dig out my car in the morning if you like snow so much. ;-)
 
@Blue did you have to travel to see snow or did it snow where you are?
 
Anonymous
@Loong Heehee, I imagine that's messy. :P
 
4:44 PM
only if you have to do it while it's still snowing
 
Anonymous
@danielunderwood Yep, had to travel all the way to the foothills of the Himalayas --- an 18 hour drive from my home. ;)
 
Anonymous
It never snows in my city.
 
Sounds nice!
 
Anonymous
Man, the long drive was hectic though. Not enough restaurants and toilets on the way! :P
 
Yeah that sounds pretty rough. I'm not even a fan of the 2 hour drive between my hometown and college!
 
5:05 PM
Happy new years to those in the East
Still 15 hours away for me tho
 
it has been 1:06 am now from the east.
 
how's 2019 feeling?
 
5:22 PM
@enumaris I have an idea that's mildly related to rendering. Amazon has this AR "view in your room" thing. It would be really neat if you could do that with furniture from furniture stores. I think there's some stuff to do images to point cloud, but I wonder if you could transfer lighting between images
 
Yes...lots of applications...
:"D
 
But I want it now!
Because I'm furniture shopping
 
I'm still on chapter 4 of pbrt
so
u gonna have to wait a while lol
I got side tracked learning C++
 
Any chance you're planning on studying time travel in the future?
 
not sure...
I can only see the past
 
5:27 PM
You should
Then bring back great technology
(including furniture AR)
 
makes note to self
come back at 9:27 12/31/2018
I don't see myself
therefore, time travel is impossible
QED
 
That's not a good sign
Maybe they abolish time zones and our calendar in the future
 
but I would know what time 9:27 12/31/2018 refers to
 
I think raining is biggest hindrance for going outdoors. In the past new year's eves when it was only 12 C but there was no rain, there were still a lot of people going outdoors for new year, but it's raining persistently and though it's 15.9 C now, not many people go outdoors.
 
So, how's vectorization work in C++? In Python if you use numpy and stick with vectorized commands you get massive speed up compared to using a bunch of for-loops...is there any such phenomenon in C++...
or do you have to implement the underlying algorithms yourself
 
5:34 PM
I believe you work with cpu-specific stuff, but that's not something I'm familiar with. I suppose the compiler may do it in some places if you're lucky
 
I believe in Fortran there's a standard library to do linear algebra
 
Though that's for clang. I imagine it may be different for gcc/msvc
 
lapack or something
I would guess that such a thing would exist for C++
LAPACK (Linear Algebra Package) is a standard software library for numerical linear algebra. It provides routines for solving systems of linear equations and linear least squares, eigenvalue problems, and singular value decomposition. It also includes routines to implement the associated matrix factorizations such as LU, QR, Cholesky and Schur decomposition. LAPACK was originally written in FORTRAN 77, but moved to Fortran 90 in version 3.2 (2008). The routines handle both real and complex matrices in both single and double precision. LAPACK was designed as the successor to the linear equations...
apparently scipy is based on it...hmmm didn't know that
 
Yeah I think numpy calls to lapack too
I believe there's a C binding for it. I've used glm, but I don't know what most people use
 
Armadillo is a linear algebra software library for the C++ programming language. It aims to provide efficient and streamlined base calculations, while at the same time having a straightforward and easy-to-use interface. Its intended target users are scientists and engineers. It supports integer, floating point (single and double precision), complex numbers, and a subset of trigonometric and statistics functions. Various matrix decompositions are provided through optional integration with Linear Algebra PACKage (LAPACK) and Automatically Tuned Linear Algebra Software (ATLAS) libraries. Hig...
wikipedia seems to say amadillo
or LAPACK++
I used LAPACK to do eigenvalue decomposition of Hermitean matrices...
 
5:40 PM
The most sensible solution is to write your own interpreter and use numpy
 
uh...
but say I wanted to do something much simpler
like a = b*c where b and c are giant matrices
if I write a for-loop the naive way to assign values to a
can I get a speed up if I use something in LAPACK
...
 
It probably depends on how clever your compiler is
 
hmmm
I think in numpy you definitely want to just use "a=b*c"
rather than using some for loop over all the elements
sorry it's np.mult or something
np.dot
 
Well that's because numpy handles that behind the scenes. I'm assuming you have a loop that computes each element in C++
 
?
 
5:46 PM
I think kind of either. I think there's a difference between how mult and dot handles additional dimensions, but I'm not that familiar with it
 
cus writing matrix multiplication for me is basically like
 for i in range(rows):
      for j in range(col):
          sum=0
          for k in range(inner_dim):
              sum+=b[i,k]*c[k,j]
          a[i,j]=sum
oh I guess the formatting and everything doesn't work
don't know how to do multi block
anyways, even removing the inner k-loop and replacing that with a np.dot(b[i,:],c[:,j]) this code is taking forever to loop lol
 
Code blocks don't work here for whatever reason
Oh you're talking about vectorization in python?
 
np.dot(b,c) took about 10 seconds for [10000,3000],[3000,10000] matrices
well I know that in python np.dot works a hell of a lot faster than me writing a manual for loop
but I don't know for C++ what I should do
since I don't have numpy
 
Anonymous
@enumaris Use Ctrl+K to properly indent your code blocks in chat. Edited it, on your behalf. ;)
 
Well using a library in C++ will do it, but your compiler may do it as well
 
5:54 PM
when I worked in fortran...everything was manual for-loops except for the eigenvalue decomp problem
what do you mean by "your compiler may do it"?
like if I write out the loops, the compiler will optimize it to be much faster than the equivalent loop in python?
@Blue thanks :D
this python code still loopin
lol
 
It will most likely be a lot faster than the python loops, but not the python numpy implementation
 
hmmm
why's loops faster in C++ anyways, cus compiler optimization is easier than interpreter optimization?
I wonder what algorithm numpy uses to make the multiplication of large matrices so much faster...
hmmm
 
Actually it looks like my dumb loop implementation doesn't produce vectorized instructions
I don't know that interpreters really have optimization, but there's also additional overhead if you have numpy arrays in a loop. I think there's a decent answer about it on SO
 
what's your "dumb loop implementation"?
the loop implementation I posted above seems to be the most naive way to do things
Basic Linear Algebra Subprograms (BLAS) is a specification that prescribes a set of low-level routines for performing common linear algebra operations such as vector addition, scalar multiplication, dot products, linear combinations, and matrix multiplication. They are the de facto standard low-level routines for linear algebra libraries; the routines have bindings for both C and Fortran. Although the BLAS specification is general, BLAS implementations are often optimized for speed on a particular machine, so using them can bring substantial performance benefits. BLAS implementations will take...
looks like BLAS is the root...
this is all stuff I've never bothered to learn since it was just handled by numpy in the back end
 
Basically for(i...) for(j...) for(k...) ret[i][j] += a[i][k] * b[k][j];
 
6:06 PM
same as the one I had then if you just initialize the return array to 0's
how long does that take you for i,j=10,000, k=3000?
cus numpy took about 10 seconds, while I gave up running the loop
 
Also when people talk about vectorization in python and C++ is a bit different I think. Python means just doing something in one numpy operation (though their underlying implementations are probably the other type of vectorization). C++ vectorization corresponds to processor-dependent features (SSE maybe?)
hmmm let's see
 
reading this C++ tutorial makes me not want to use C++ lol
it feels like I just lose a ton of convenient stuff from Python...
like if I pass an array to a function I'm actually passing a pointer which doesn't know the size of the array so if I want to do len(array) inside the function I can't...
 
Yeah you have to either pass along the size or use a marker (strings are often char * ending with NUL)
 
did ur for-loop finish?
no response...guess the for-loop consumed you...rip
 
6:28 PM
I tried it on different optimization levels and cancelled each one after about 2 minutes
Looks like there weren't any vectorized instructions in the assembly either
Or at least nothing that I recognized as a vectorized instruction
 
so quite slow
time to break out a BLAS or LAPACK or armadillo or something...
he can't do that! shoot him! or...something!
 
@dmckee you corrected me a few days ago about the distinction between arrays and pointers, say int[][] vs int**. Aside from stack vs heap, will the difference in memory access make that difference slower for matrix operations (and perhaps break auto-vectorization)?
 
6:47 PM
You may be able to use jax's numpy/jit to speed it up. No idea how well that will work
 
complicated
 
my first hi of 2019
 
7:02 PM
Hello
 
Hello from 2018
 
I'm surprised my C++ 101 class didn't introduce pointers at all
it seems very important...
interestingly, apparently python never worries about any of this and it's all pushed into the backend
 
vzn
lol C++ without pointers... kinda like Java without NPEs :P
 
नया साल मुबारक हो
1 hour ago, by enumaris
when I worked in fortran...everything was manual for-loops except for the eigenvalue decomp problem
That's right these youngsters don't know nothing
 
7:18 PM
Eigenvalue problem used zheev package :D
I have since forgotten how all of that worked
hmmm
so why is the stack so small...1mb on a modern machine? what the dealio
 
7:37 PM
Rutherfordium (104Rf) is a synthetic element, and thus a standard atomic weight cannot be given. Like all synthetic elements, it has no stable isotopes. The first isotope to be synthesized was either 259Rf in 1966 or 257Rf in 1969. There are 16 known radioisotopes from 253Rf to 270Rf (3 of which, 266Rf, 268Rf, and 270Rf are unconfirmed) and 4 isomers. The longest-lived isotope is 267Rf with an estimated half-life of 5 hours. The longest directly measured half-life is 263Rf at 11 minutes, and the longest-lived isomer is 261mRf with a half-life of 81 seconds. == List of isotopes == === No...
what are the + and - signs in the "nuclear spin and parity" column?
parity?
ok apparently that's the convention for showing parity en.wikipedia.org/wiki/Parity_(physics)#Nuclei
 
7:55 PM
Yeah, that
@enumaris 1 MB should be plenty for normal cases - all it needs to do is store local variables and function call info so you're talking about a fraction of a kilobyte per typical stack frame
 
8:34 PM
hmmm...but then your arrays can't be big
your non-dynamic arrays
 
vzn
9:29 PM
@enumaris exactly. think pointers. what are you working on anyway? sounds like there might already be a library for it...?
 
not working on anything atm lol
just looking into C++ in general
ah looks like C++11 has a std::arrays class that makes everything more manageable lol
notably this was not available when I went to College so I could not have learned about this
reading this and all the caveats and special cases makes me not want to use C++ lol
is a std::vector always 1 dimensional?
 
9:51 PM
A std::vector isn't a math vector, it's a CS vector
Think of a vector as a python list
I suppose you could have a vector<vector...> if you wanted something higher-dimensional, but I don't believe people would generally use such
 
ah
so it's not naturally built to be multi-dimensional anyways
so like a list of lists rather than a 2-D numpy array
 
Yeah more or less
Oh yeah, regarding my char * ending with NUL earlier, that's more of C-style and you'd use a std::string in C++
 
the more I read the less I want to use it tho
 
:D
I think C/C++ gives a lot of understanding of what's happening, but it takes more time and thinking to write in
 
everything just seems like a pain
 
10:00 PM
Yeah I've been going back and tinkering with some C++ recently and I think python has spoiled me
 
user301074
Another random question... An quantum black-hole area is allowed to decrease over time because quantum mechanics allows violation of null-energy conditions?
 
@EmilioPisanty how do you get the wizard hat?
 
user301074
btw happy new year
 
tbf though I'm comparing C++ with Python+ext. libraries
so it's not really a fair comparison
is there a numPy for C++...a numC++...
 
Not quite.
 
10:05 PM
I know that pytorch was originally in C++ (or C not sure), so there's a Torch that's in C++ (or C)
 
53
Q: NumPy style arrays for C++?

LlamageddonAre there any C++ (or C) libs that have NumPy-like arrays with support for slicing, vectorized operations, adding and subtracting contents element-by-element, etc.?

 
but without a pip, it seems non-trivial to get and install
 
@enumaris isn't Torch lua?
Oh right. I have heard of both eigen and gsl
 
I thought it was in C/C++ ...
pretty sure at one point I traced back its source code to a C backend...
 
Yeah it has a C backend. I think it may be like the numpy of Lua?
 
10:11 PM
I don't know what Lua is
 
It's a language that's used a lot for game scripting and some ml people have picked it up. I'm not terribly familiar with it, but it looks like there's pretty close integration with C/C++
 
in any case...
seems like a pain
 
You could import the numpy backend code in C...
 
another thing I've never bothered to think about
say you import a ton of libraries to do something
when you actually want to create an executable from your source code and you want to be able to share it to be used on other computers/devices...
do all those libraries get...copies...into the executable or what...
 
oh boy. That's one of the things that gave me quite a stumble when I was learning
 
10:16 PM
right now the way things have been, I've just shared python source code
which means the machine that I'm sharing the code with better have all the libraries installed
or else you get a import error
but say I want to actually create a self-contained .exe file that can be installed and run on another computer...the...libraries...gotta be copied over right...
 
@enumaris Are you talking about Python or C++?
 
does that mean though that if I do import numpy as np the .exe file will have a whole copy of numpy in it somewhere...
 
Well you can compile code into a library and link it either statically or dynamically. My understanding is that static linking essentially copies the code into your binary while dynamic loads the library at runtime by searching for a dynamic library (in LD_PATH I think?). Then there's the concept of header-only libraries that contain all the code in the headers. That way, you compile the code in when #includeing
 
o.o
@DavidZ python atm, but same question applies for C++
just Python seems much more heavily external libraries based than C++ so it might affect it more
 
so how do we solve the paradox
 
10:19 PM
@danielunderwood yeah, sounds about right
 
@danielunderwood so it copies the entire library into the binary?
@danielunderwood does that mean I should only import specific functionalities of specific libraries if I don't want whole libraries to be copied into the binary and save size?
 
a free electron cannot emit a photon else either energy of momentum conservation is violated. but an accelerated particle emits radiation. and since we can accelerate a free electron, what the heck happens? does it emit or not
 
The typical case for Python is that programs are distributed as source code and the user will use pip to install your program along with its dependencies
 
say there's a linearalg library that is like 200gb in size cus it's implemented every linear algebra routine/algorithm/method/w/e known to man
 
user301074
Classical eletromagnetism
 
10:20 PM
i guess it does coz from the momentum there's an E field applied the electron isn't free anymore. and it's possible for it to emit/radiate
 
@tttt Well if you accelerate a free electron then it's no longer free
 
and I use only 1 algorithm from that library in my code
then...if I have import linearalg will my .exe that I produce (from static linking) be >200gb in size no matter how small the program I built is?
 
yeah right @DavidZ thanks, i just figured it out!
 
For a header-only library, it will only compile in what's been included in the #include chain. I'm not entirely sure what happens when linking statically. I imagine the linker may only include the called code, but really have no idea
 
@DavidZ right, I'm not talking about writing a library to be used in python, but producing an executable from python...like if I wrote a game in python and I want to produce a .exe file so that windows users can play my game without having access to python
 
10:23 PM
@enumaris Hm, well in that case it probably depends on how your Python "compiler" works. ("compiler" meaning the thing that converts your program to an executable file)
 
yeah there's different ones it seems
 
Don't many of them essentially just stick an interpreter in there?
 
user301074
And this conversation is giving me curiosity
 
That's always been my assumption of how they work at least
 
user301074
Where i can find good material about that?
 
10:23 PM
@danielunderwood Yeah it needs to include at least a Python runtime environment of some kind.
 
I have only ever messed around with creating an executable once
 
@enumaris If it's fairly smart, it might be able to pick out the parts of the library that are actually used, or might be used, and only include those. I'm not sure if these programs actually do that though.
 
and I have since forgotten all about it
hmmm
 
FWIW in C++, with static linking, the linker is usually smart enough to pick out only the functions and variables that are actually referenced, so even if you had a 200 GB static library (hypothetically :P), it wouldn't all get included in the final executable.
 
that's cool
 
10:30 PM
But the situation is different in Python because you can't actually tell what parts of the code are referenced without running it (with all possible inputs!)... so I guess in that case it probably would have to include the entire 200 GB library to be safe.
 
that's not cool
 
I could imagine that in practice the "compiler" might use some heuristics to try to strip out unused pieces of code, but there's always a chance that it would remove something which is actually needed.
 
And if I had to build an exe from python code manually, I would certainly just dump all the python environment to a file and have the exe load that
Also you'd have a problem if you had a 200gb library. I'm pretty sure programs are typically fully loaded into memory
 
right...
 
So you'd basically have to load the library as necessary
And I believe you've written an interpreter at that point
 
10:36 PM
@DanielSank I can't remember
it's unfortunate that the hats period coincides with weeks in which I have rather little time to spend on SE.
 
sounds legit
 
194
Q: Winter Bash 2018 Hat list

DavidHere we go again, the Winter Bash is here and the hats are listed below. The list has the same format as always, there are only two answers: one for the secret hats, and one for the regular hats. The secret hat list will be updated as we learn them. Only edit the secret hat answer with definiti...

 
@danielunderwood have you used any linear algebra packages in C++
like armadillo
 
> Earn an Enlightened badge
apparently
 
@danielunderwood For Python code (if that's what you meant), I don't know about that - from the perspective of compilers/linkers/the operating system/"real programs", Python files are effectively data files that get read in and processed, but not necessarily stored.
With a proper executable, I believe the exe itself may be memory-mapped, so the whole thing might not necessarily be loaded into RAM.
 
10:54 PM
man...probably a week after I've finished reading all this C++ tutorial stuff I'm gonna forget it all lol
 
@enumaris the only thing I've used is glm. That's geared towards graphics though, so I don't know that it has things like decompositions and eigenvalue solvers
 
but i has stuff like matrix multiplication and stuff?
 
user301074
Having intermediary knowleadges of boolean algebra and functions help to learn programming?
 
cus eigenvalue solvers and decomps are not in numpy either iirc
those are in scipy
 
It does, but it has a lot of things specifically for world and view transformations and such glm.g-truc.net/0.9.8/index.html
It's probably not the most ideal if you're trying to do general linear algebra
 
11:04 PM
I see
 
@Zober it certainly wouldn't hurt. I believe relational databases are loosely related to boolean algebra and there are functional languages which I have heard are closer to math. I don't have any experience with those though and they aren't terribly common in practice from what I've seen
Really programming is more about constantly resolving your errors rather than preemptively learning something from my experience though
 
I'm currently preemptively learning
cus I got some time...
 
Well that part was more directed at Zober. I think preemptive learning can be useful once you've gotten your feet a bit wet
I suppose that could also just be my mode of learning though
 
11:25 PM
are there keyword parameters/arguments in C++
 
11:42 PM
one interesting difference between python classes and C++ classes
python classes afaik have no private or protected variables/functions
hmmm
maybe the underscore names count, I dunno
 
@DavidZ (or whoever handled my flag here) - non-mod protection of posts is only possible after 48 hours of posting (admittedly a two-hour margin from my flag), and (for some reason) not on the mobile view.
 
Underscore is convention for protected and double underscore is convention for private, but that doesn't get checked unless you use a linter. I suppose you may be able to put a check in, but afaik there's no way to get the caller unless it's a parameter
You can set argument defaults, but I'm not entirely sure how ordering is handled
 
@EmilioPisanty ah, wasn't me, but thanks for the note. (I always forget that 20k(?) can protect posts)
 
@DavidZ (I was hoping you'd ping whoever it was, either here or on a mod-only channel)
@DavidZ threshold is 15k
 
Yeah I'll copy it in our mod room.
 
11:47 PM
:-)
 
...and done
 
too many issues in programming
I should do something else...
sips coffee
 
@enumaris nope, not unless it's been added to some recent version of the language that I haven't been following. When I want something akin to keyword arguments what I usually do is pass an instance of a struct and have the "arguments" as member variables.
 
@danielunderwood I thought single underscore was meant to suggest that a variable is for class-internal use only, so more akin to private in C++/Java, whereas double-underscore indicates the same usage convention (internal-only) but also invokes name mangling
 

« first day (2979 days earlier)      last day (1936 days later) »