« first day (1206 days earlier)      last day (2025 days later) » 

11:33 AM
@Andy did you verify that? It's a common misconception, especially since the new JIT came out with R2016a. Loops are no longer very slow, and often have so little difference in timing that the clarity of a loop structure can be preferred over an obfuscated oneliner. Please do share your motivation on this comment. — Adriaan 57 secs ago
just realised this was an Octave question; is the Loops are slow, loops are slow, loops are slow mantra still valid there?
 
I wouldn't be surprised
 
Derp. The dude whose code is obfuscated spaghetti send me a reply stating "Find the latest code in a python wrapper here!" Which does not answer my question about how to use it and doesn't help me, as I'm not going to transfer to Python a few weeks before I have to hand in my thesis
 
hehe
hmm, but a python wrapper is just a wrapper, perhaps the underlying MATLAB code is more up to date and readable?
 
@AndrasDeak wrapper to CUDA I'm afraid
 
11:45 AM
His Python example, which is the same as the MATLAB version, at least has a few comments. I'll check whether I can get it to work that way
 
pylab :/
 
Seeing that he made just a single commit, I suspect he transferred from MATLAB to Python after finishing his PhD, and since it's CUDA anyway he just had to rewrite a wrapper
The comments here, although in rubbish English, are helpful. Let's go check this!
Interestingly his name on the email he sent me is still in Russian, even though he's at a Swedish uni
 
I guess he's still Russian
 
Yea, sure, but having been in Sweden for 6 years it looks a bit odd to me
Russian as in: Cyrillic. Not the salutation on the bottom of the email, but the Name <email>, where the Name is in Cyrillic
 
Yeah, I get that, but that's how you write Russian names :P
the Swedish are advanced enough to handle unicode in names ;)
 
12:06 PM
@AndrasDeak how does the lambda function in that code work? As I understand it, lambda functions are similar to MATLAB's anonymous functions. But cent is not used within the function, so is it an argument? Also, when he calls the function (inside the double loop) it appears to have three arguments, so I presume the middle one is cent, but where's that called?
 
12:43 PM
ayo fella(s)
 
1:02 PM
posted on October 19, 2018 by Guest Picker

Greg’s pick this week is Nice sprintf syntax using \ (left divide) by Will Fox. A simple entry that exemplifies the extensibility of MATLAB. Create a formatted character array with the following syntax c = 'Hello %s, my favorite number is %.5f!'\{"Greg", pi} c = 'Hello Greg, my favorite number is 3.14159!' where the... read more >>

 
 
1 hour later…
2:18 PM
@Adriaan lambdas are like MATLAB's anon functions, with the exception that variables not explicitly passed (but rather taken from the global namespace) are bound late, i.e. if you have lambda x: 2*x+y then the value of y is taken during function call (rather than definition). Note that what you see in that notebook is bad practice: if you bind a lambda to a name (as in rickh = lambda ...) you should define a proper function instead.
2
and yes, the syntax is lambda arg1,arg2,arg3: return_value, so cent is the second argument but it isn't actually used in the lambda
and they could've easily skipped that double loop (that's a numpy-antipattern)
 
Wait, I don't understand the lambda x:2*x+y bit. Why don't you need to define y as input?
 
same as @(x) 2*x+y, except y in this case would be bound on definition
 
Que?
Sorry, I have honestly difficulties to grasp this syntax, that one can use inputs which are not defined
@AndrasDeak so in that case, in MATLAB, y would already be defined as some array/scalar/matrix/whatever right?
 
>> y = 2;
>> f = @(x) y;
>> f(1)
ans =
     2
>> y = 3;
>> f(1)
ans =
     2
MATLAB ^
>>> y = 2
>>> (lambda x: y)(1)
2
>>> y = 3
>>> (lambda x: y)(1)
3
python ^
 
ah, the MATLAB case makes sense to me
the Python case doesn't
luckily that part of the code is not relevant to me (it's just building the data, which I already have), but I just found it very odd syntax
 
2:24 PM
it's just different behaviour
I believe JS lambdas are similar
early binding does make more sense to more people
so anyway, the part which you found weird is just the lambda syntax. First the list of args, then colon, then the body of the function
It's less weird if you remember that all python blocks start with a colon, so the equivalent full function would be def foo(arg1, arg2, arg3): return return_value. Less weird now.
 
anyhow, this does not clear my amazement of this function, it just increases it. You demonstrated the case for 1 input, 2 variables, whereas here they use 3 inputs, but call just 2 variables. That looks to me like f=@(x,y,z)x+y
 
So? Nothing stops you from doing that in MATLAB either
 
but then the z would be utterly irrelevant
 
yes
but it's completely valid syntax
I'd only do that if I were using another function (such as a minimizer) that expected a 3-argument function which I don't happen to use myself. In the above situation it's completely needless complication.
 
Sure, as is [1;;;3++ + + +--+ + ++4,;;;,;], doesn't make is any more sensible. If Python behaves similar, it means that the last argument entered in the double loop is thus ignored?
 
2:30 PM
@Adriaan why would it? The function definition contains all 3 args, the function body doesn't
 
indeed, so the third should be ignored, like my MATLAB example
 
all 3 args are passed, including tl[l] -> cent. But the function chooses to ignore that entirely
@Adriaan the third in MATLAB, but in the above case the middle one is ignored
 
Sure, sure
 
then yeah, I just misunderstood what you were saying
 
but then why go through all this trouble setting up this middle argument
 
2:31 PM
yes
> In the above situation it's completely needless complication.
I'd expect that function to be sort of famous, and in the general case it could use the middle arg, but for his example it's not needed
I mean that's one case where it could make sense
 
Hm, that makes sense. I guess the Ricker Wavelet (I guess that's what they refer to) might have a certain definition, although why you'd then define such a difficult input is weird.
(Funnily enough the MATLAB function for the Ricker wavelet is mexihat)
As in: in MATLAB I'd go f(x,~z) in that case as function call. Don't bother inputting that argument
 
@AndrasDeak This is new to me, thanks for sharing! I thought that lambdas are closures by definition, but it seems that those two terms are not synonymous at all. I know C++ and MATLAB, both use lambdas that are closures. I guess it is good for me to be exposed to more languages. :)
 
yup
in python you can force early binding by making use of default keyword arguments (another infamous language quirk that sometimes trips up newbies)
lol, my previous example was all wrong, because I redefined the lambda
>>> y = 2
>>> f = lambda x: y
>>> f(1)
2
>>> y = 3
>>> f(1)
3
this is the proper proof, I just don't like naming lambdas so I messed up the original example ^ (the same behaviour is there)
so you can force early binding by defining keyword arguments
>>> y = 2
>>> g = lambda x,y=y: y
>>> g(1)
2
>>> y = 3
>>> g(1)
2
but this can be broken because g(1,3) will now work, passing 3 as y. You can prevent this by defining g = lambda x,*,y=y: y, but one would still be able to explicitly pass y=3 as a keyword argument...
 
2:50 PM
Is python not compiled?
I don't know enough about it
Or did they introduce lambdas into matlab
 
python is compiled and interpreted :P
technically it compiles to bytecode, but it's as interpreted as MATLAB
@ballBreaker MATLAB has always had lambdas but they're called anonymous functions and they are proper closures
 
Ahhhh
Sorry at first glance I thought you were still talking about python lambdas
or the equivalent
But then I saw your output there, and realized it was MATLAB and then just got confused all around
Makes sense though what you said
 
@AndrasDeak MATLAB has had lambdas since version 7 or so. Definitely not always. When I started using it they didn't exist. That was MATLAB 5.3, somewhere in 1998 or so.
Ah, here it is: "Anonymous functions have been introduced in R14 (Matlab 7.0, June 2004). Function handles are working since R12 (Matlab 6.0, Nov 2000), but until 7.0 feval was required for calling them."
Fuck I'm old. :(
I've been using MATLAB for 20 years...
 
@CrisLuengo "always" :P
@ballBreaker >> is matlab, >>> is python
 
AH OKAY
that clears that up
I knew it looked different but wasn't sure why. Okay, cool. Right. Awesome.
 
3:02 PM
@CrisLuengo huh, ancient history
 
6 mins ago, by Cris Luengo
Fuck I'm old. :(
 
Yeah I know, Pops. You forget you just said that :P
 
Back in those days there was no || and && either.
Nor nested functions.
Nor classdef
 
Heh
 
And we still wrote awesome code!
You kids are so spoiled... :p
 
3:06 PM
Nested function scopes are weird
 
They're kinda interesting, but I've never found a good use for them.
You can use them to create more complex closures than you can do with anonymous functions.
 
Yeah, to make the life of future maintainers difficult :P
 
 
4 hours later…
6:49 PM
@AnderBiguri the ETH got back to me; they have an open position into EM tomography of the Martian mantle: apply.refline.ch/845721/6565/pub/1/index.html
extraterrestrial "earth" sciences :D
 
so...no field work? :P
 
@AndrasDeak my blood pressure probably cannot cope with the G-forces during launch, so I guess not
Sounds cool. EM is not my strongest point, as I haven't done much past the basic courses, but tomography is apparently sort-of what I'm doing. Sounds fun, let's apply!
 
7:08 PM
@Adriaan lol I have a paper in Electrical Impedance tomography XD
 
"have a solid background and strong interest in mathematical (geo)physics" Of course geophysics is a solid background, you silly
 
its VERY mathematical
start gettig used to Hilbert spaced :P
 
Those quantum thingies in brakets?
I'll reply on Monday to them
 
no not those
those are not Hilbert Spaces, there are Hilbert somethingelse
 
Hilbert's paradox of the Grand Hotel (colloquial: Infinite Hotel Paradox or Hilbert's Hotel) is a thought experiment which illustrates a counterintuitive property of infinite sets. It is demonstrated that a fully occupied hotel with infinitely many rooms may still accommodate additional guests, even infinitely many of them, and this process may be repeated infinitely often. The idea was introduced by David Hilbert in a 1924 lecture "Über das Unendliche", reprinted in (Hilbert 2013, p.730), and was popularized through George Gamow's 1947 book One Two Three... Infinity. == The paradox == Consider...
Hilbert Hotel? :P
 
7:14 PM
hahah
nooooo
But yeah, its not bad. Needs a lot of modelling, and a lot of ugly maths, but its a fun field
 
@AnderBiguri no, |i> quantum eigenstates also span a Hilbert space
 
ahh could be
I understand nothing of that :D
but its basically infinite dimensional complex "euclidean" spaces no?
 
well, it's just that you have a scalar product and infinite dimensions => boom, Hilbert space
 
yeah
 
but eigenstates in QM famously live on a Hilbert space
 
7:17 PM
Sounds... infinitely interesting :D
@AndrasDeak is that one of the infinite spacious spaces in the Hilbert Hotel?
 
Most of the EM tomography is just mathematically defined in Hilbert spaces because EM is a complex number (permeability, impedance etc) and they are solved in FEM meshes, so they need to prove that it works for any amount of FE
 
@Adriaan that's neat
 
@AndrasDeak I was told this in high school when my maths teachers introduced the concept of infinity
I'm still rather stumped by it
 
meh, analytical continuations are a lie
 
7:24 PM
:P
 
String theory? Fantasy, right
 
aer you accepting the phD?
or uppsala? or just waiting?
 
Hold your horses, we're not there yet :P
I still have to formally apply to the ETH one, I haven't been offered it as such, just notified of it; and haven't heard back from Uppsala yet, although they should've :(
 
notified as how? just got a random email?
I mean, I got "unofficially" offered the PhD at some point, and then they told me to apply
but the applications was just a formality
 
I sent them an email last week with an open sollicitation
and this was, I think, a notification. They know nothing about me except my short email and my CV, so I guess this is nothing but a heads up
 
7:31 PM
fair
good luck with all!
 
@AnderBiguri No. Just no. I refuse :P
I'll have nightmares now, eskerrikasko
 
 
1 hour later…
8:41 PM
that's... highly specific in distances
 
@AndrasDeak Do you like Linzertorte?
@Adriaan have you tried to convert those back to km? :D
 
I'm not sure I've had any. Do they taste like linzers?
and I mean the cookies
 
@flawr 7.945km for the first;12.072 for the 2nd and 17.993 for the third :P
 
> Linzer sablés (German: Linzer Augen, "Linzer eyes") are a cookie-sized version [...]
in that case yeah, I do :)
 
@AndrasDeak they are similar, it is just a dough consisting of quite a bit of ground hazelnuts, and it is usally filled with raspberry marmelade
 
8:45 PM
sounds great :)
 
@flawr sounds like a good Saturday exercise
 
it is indeed :)
@Adriaan you should try it!
 
All I can produce from my oven thus far are Kanelbullar
 
@Adriaan that sounds delicious too, can you recommend any recipe?
@Adriaan make sure to add twice as much marmelade as they say in the recipes
 
@flawr yes; although I use self-raising flower as it's easier, and I sometimes add a bit of vanilla-sugar (comes in packages of 5g here) for interest
 
8:49 PM
great, and I think I understood pretty much all the igredients without looking them up, except for "kanel"
ah that is cinnamon, right?
 
D'oh :p
 
right XD
 
I always get confused that 'vetemjöl' is flower, whereas 'mjölk' is milk...
 
@Adriaan but how...? XD
@Adriaan they even include timers in their website, how neat is that! :D
 
It's similar in Dutch: 'meel' is flower, and sounds a lot like 'mjöl', and 'melk' is milk, which sounds similar to 'mjölk'. The 'vete' part is probably defining the grain or something
 
8:53 PM
How close is swedish to dutch?
I feel like you'd have an easy time learning swiss german
 
@AnderBiguri so I just found out that the overview page of the Earth Science department over at ETH does not list this position, but it is officially open apparently, since there's a formal application form...
@flawr English, Dutch, German in a blender, add dots, and out comes Swedish. OK, not entirely, but close enough. My GF didn't know any Swedish when moving the Finland (which is bilingual) and after half a year still read better Swedish than Finnish, even though she had lessons in the latter
 
@flawr It is so close that I thought I'd learn the language without studying... but that didn't happen. :)
@Adriaan 'vete' is wheat.
 
@CrisLuengo which one odo you speak?
 
@flawr I speak Dutch (natively) and Swedish. I lived in Sweden for 7+ years. Ended up taking lessons because everybody was speaking English with me and not letting me practice.
 
if you wanna try some swiss german let me know :)
 
9:13 PM
@flawr An uncle of mine was married to Swiss lady, her german was very different from what I had learned. It's an interesting language.
 
@CrisLuengo btw: after stalking your profile I just found your blog and read about the rgb2ind, and really enjoyed it!
 
9:29 PM
@flawr Thanks!
For stalking me I mean. :D
 
 
2 hours later…
11:32 PM
@Adriaan academic pages are shite, I am still as a PhD student in the one in bath
they rely on academics to update them
 

« first day (1206 days earlier)      last day (2025 days later) »