« first day (1190 days earlier)      last day (2045 days later) » 

6:00 AM
I bought new shoes :D
@dmckee thanks for this information, I'll check with the prof where my allowance is
 
 
1 hour later…
7:20 AM
@Adriaan Ah, so you're the one they're making these items for...!
 
7:42 AM
@AnderBiguri you there?
 
8:22 AM
@Dev-iL I am
 
I have a general question about parfor..
Is data stored in global / persistent / appdata variables shared between workers, if these are defined inside the parfor? (I hope not)
 
hum
a global as in nothign to do with parfor, just a global variable?
 
I'm writing a question about this
@AnderBiguri yeah
 
I assume in theory yes, but perhaps proper JIT avoids it
 
My reasoning is that a parpool creates a bunch of processes, and each one has its own global workspace
 
8:32 AM
ah could be
this is a bit specific to the way MATLAB paralelizes stuff, and I don't have that much experience on it, havent been following how it has evolved in detail
so I can not answer you with confidence
 
Ok, thanks
 
@Dev-iL as far as I know parfor, each has its own local workspace, and stuff is presumably broadcasted to all workers; i.e. if you define A before the loop, it gets broadcasted as a whole, unless you slice it before.
 
@Adriaan those are some weird shoes my dude
 
However, creating variables inside your parfor loop are not shared, but setting them global and have a high potential of breaking stuff, I encountered this last year when trying to optimise someone else's code; see this answer of mine
@AnderBiguri lovely aren't they
 
I am too confused by them to decide if I like them or not :D
Note: I do fundamentally understand nothing about fashion, so dont listen to me XD
 
8:42 AM
@Adriaan This is a scenario where you have some "external side-effect" (i.e. a log file being created). I specifically avoid those
 
@AnderBiguri I'm an eccentric, according to the missus, but my last name is Visser which literally means fisherman. So shoes with fish on them are fitting for me I thought
 
hahaha that is fair :D
 
@Dev-iL yes, but the core reason is the file identifier being shared among workers due to the explicit global call. My experience otherwise is that stuff that's created on a worker is not shared among other workers, unless explicitly stated
I used a write-to-file and load-from-disk to process a large data set back when I started here on SO; tmp=load('sprintf('file%d.m',ii)) is what loaded the actual variable and there was no problem with shared variables
 
@Adriaan so in conclusion: probably not shared, yes?
Did any of you ever hear about this?
 
nop
LEts hope Edric answers you :P
considering he wrote part of the parallel toolbox, he may know this stuff
 
9:30 AM
@Dev-iL that's the conclusion indeed
@Dev-iL Nop, never heared of it, sorry.
Edric is the one to talk to indeed
 
I've added an answer in case any of you wants to check it out
 
@Dev-iL added an answer where?
 
1
Q: Is appdata shared between workers in a parallel pool?

Dev-iLI'm working on a complicated function that calls several subfunctions (within the same file). To pass data around, the setappdata/getappdata mechanism is used occasionally. Moreover, some subfunctions contain persistent variables (initialized once in order to save computations later). I've been ...

 
FinalIter = find(any(normR),1,'last')-1;
figure;
semilogy(normR.','*-')
ylabel '||r_{new}||^2/||r_{0}||^2'
xlabel 'CG iteration [-]'
xticks(0:FinalIter)
legend(legendstr)
This should give xticks on 0 1 and 2
However, it just gives 1 and 2 and leaves the third empty?
plotting semilogy(0:FinalIter,normR.','*-') doesn't work, since not all arrays have the same length, which would require me to use a loop. Not impossible, but why don't the ticks get set as I want them?
 
Are you re-starting r_0?
i.e. are you using a different one in each IRLS?
I think it would make more sense to use onyl the first one, from IRLS0
as its a relative change, but you are interested in seing global convergence
clearly (because that is how the algorithm is defined) it will converge slower, thus have bigger value in your plot, the later it is
 
9:46 AM
@AnderBiguri No, r_0 is always the same, i.e. the first residual set
then everything else is updated according to Somersalo's CGNE, and once that converges/maxes its iterations the IRLS sets a new z_old and a new Cp, which is the minimiser
 
but the first residual set of each iteration of IRLS? or the single one from IRLS 0?
 
@AnderBiguri the single one from IRLS 0
 
thast weird
because you get to an absurdly small residual , and tren with a small change, you get a massive residual again?
 
Apparently
I'll keep digging into the algorithm
and especially my implementation
 
you checked the quality of the final result? is it good?
 
9:49 AM
@AnderBiguri jup
I added 0.1*rand(size(data)) to the left, and it gets removed nicely
probably in the first iteration
 
whats the error %?
If you know the original image, its also nice to plot ||rec-orig||/||orig||
so you can see how the relative error changes
 
@AnderBiguri how do you mean?
 
and with a bit of bad luck you can also seee semiconvergence
semiconvergence, or i.e. the residual reducing does not mean the error is reduced, at some point the error will increase while the residual is being reduced
@Adriaan ||rec-orig||/||orig||
 
norm(data_xt(:))/norm(data_back(:))

ans =

1.1144
oh whoops, inverted
0.8973
 
no, you want norm(data_back(:)-data_xt(:))/norm(data_xt(:))
and you can also see that per iteration
as a residual is a mathematical tool to see how much it fits your model, but the error is the real one
if your model is crap and you fit a bad model, the residual will nicely decrease anyway
not that this is a problem for you (likely), but its a nice plot to show
Sidenote, 3~5 iterations of CGLS like you are getting is the rigth amount for CGLS, 101 as you where getting was very weird, not it makes more sense. For a very ill-posed problem with size(x)~=10^8 I generally never iterate more than 8
thats why CGLS is cooler than Gradient descend :D
 
9:59 AM
I think I'm plenty cool now. Doing CGLS/CGNE inside a IRLS
although I might just get rid of the IRLS as a whole :P
Interesting, I used a less-sparse constrained on the same data set now (a=0.5 instead of a=2, so l1-2 norm instead of Geman-McClure)
So A) my first iteration is off, and B) my iterations oscilate, hmm
 
Again, are you 100% sure you are not updating r_0 in those plots?
 
@Adriaan It doesn't work because you're setting the tick labels, and not the viewport extents.. So the tick exists, but off screen (pan it and see; notice also how you're missing a tick label at 3). Set xlim.
AFAIK, xticks sets labels assuming that positions and labels match. If you want to set the text separately (i.e. show the value 1 where x is 0 etc.), you should set xticklabel.
 
10:21 AM
/ dupehammer, same as previous question (linked in my comment)
-1
Q: Plot with different line width in each point in matlab

Fateme Nematienter image description hereI have some signals, I want to plot mean of signals with different line width because of different standard deviation of each point. In other word, my mean matrix is (nx1) and my std matrix is also (nx1) and I want to plot mean matrix with different line width accordin...

 
10:38 AM
@Dev-iL Yea, I basically want instead of 1:4 displayed with 0.25 interval 0:3 with an interval off 1
@Dev-iL Wants to place check mark there This worked, Köszönöm!
 
@Adriaan you mean תודה
 
@Adriaan Varsågod
@AnderBiguri It doesn't really matter, he could've written it in ancient Egyptian hieroglyphs for all I care :)
 
@AnderBiguri My Hebrew keyboard disappeared alas :P
 
I foudn this while googling:

https://www.wikihow.com/Say-Thank-You-in-Hebrew
 
10:50 AM
@AnderBiguri That's a guide to "how to say it while sounding like a tourist"
 
hahaha
its wikihow, what do you expect
 
Forvo is more reliable...
I like this one the most among the recordings of Hebrew "thank you <a lot>". (It's like in Spanish where you can say "thanks", or "many thanks")
 
Sam
Morning folk
 
'fternoon
 
11:17 AM
I don't have much to add to my "official comment" (!) - but anyway, all global, persistent, appdata stuff is not shared between Parallel Computing Toolbox worker processes. (Usually people wish it was.) — Edric 3 mins ago
 
@Dev-iL but then why did my code crash when writing log files? The problem was that they were all writing to the same log..
 
@Adriaan This is something else, you have a contested resource in your scenario
 
@Dev-iL but the reason it's contested is because the FID is a global as far as I could see
 
Well technically no, global implies that it is the exact same object/handle/reference (i.e. pointer to the same shared memory address, if you will), but in case of the FID, they were likely created separately on each worker, and happen to contain the same data (i.e. deep copies, or different pointer, but same contents)
 
11:36 AM
Sounds ... deep
Anyhow, the lass I tried this for has graduated by now, so I'm no longer concerned, and never use global myself anyway
 
Neither do I... But it's useful to know what you're dealing with...
 
12:40 PM
@AnderBiguri I just found out I made a couple of mistakes in my code (obviously), but it does work marvelously...
 
nice :D
 
Ludwig Zhou, Southampton, United Kingdom
361 3 17
 
mornin fellas
 
@AnderBiguri you can go over to his office telling him fitting bin centres sucks :P
 
hahaha :P
I saw
I wont :D
possibly he is in another campus even
 
12:54 PM
The result looks good, but the norm is ... weird
 
It can not go up
the entire mathematics are based on decreasing the residual
so either the plot is wront or the method is worng
if you are getting good results, possibly the plot is wrong
 
@AnderBiguri the method it is in that case
but my results are good :(
 
if you have good results is rare that its wrong then
as CGLS does crap very easily if its wrognly programmed
its way more sensitive than other methods
 
@AnderBiguri some solvers allow you to go outside of your domain if it helps you find a better solution overall.. Perhaps you can also increase the error momentarily if it helps you get out of a local minimum....
 
Not CGLS though
 
12:58 PM
I'm not familiar with that specific solver, I was talking in general
 
teh maths start by defining the residual, and from that you derive the steps to ensure the residual is reduced quadratically each iteration
So the residual has to be r ~ 1/X^2 in CGLS
 
alright
 
its a linear convex solver, so has to be. I know a lot of other sovlers donot need this, specially non-convex solvers
 
ok
 
1:26 PM
77
Q: What is Chirped Pulse Amplification, and why is it important enough to warrant a Nobel Prize?

Emilio PisantyThe 2018 Nobel Prize in Physics has just been announced, with half going to Arthur Ashkin for his work on optical tweezers and half going to Gérard Mourou and Donna Strickland for developing a technique called "Chirped Pulse Amplification". While normally the Wikipedia page is a reasonable place ...

Someone thought wikipedia lacking and wrote their own 100+ scoring Q/A
 
Have you read the entire error? It gives more information than what you shared, relevant information. Also we can not help as we do not have access to your computer to read the code. You should always provide a Minimal, Complete, and Verifiable exampleAnder Biguri 17 mins ago
@AnderBiguri ^ You've been moderate this time :-)
@Adriaan Wikipedia could benefit from a little gamification
 
@LuisMendo :D not sure, with the new CoC I may need to chill a bit
 
1:44 PM
@AnderBiguri this sucks, if I make my preconditioner all ones, the algorithm ensures it's based on (pwiggle^2+snr^2)^a. This resembles taup(data)^2+snr^2)^a almost exactly, so, when I try to feed the algorithm the latter as initial preconditioner (as my theory says it should) my data goes POOF in a single iteration :s
My brain is weird, as is my code since it stems from there
 
I have no idea what that means :/
 
Me neither :D
Basically: my code works, although it doesn't follow theory and I have no idea why it works
 
hahaha :P
 
My brain stopped for the day. I guess I'll go purchase groceries and eat in time for practise...
 
2:03 PM
@AnderBiguri Relevant:
150
Q: The Code of Conduct is a "no moderation" pass? Not on our watch! What can we do?

E_net4I am concerned about how the code of conduct is being pointed out in practice. In its short time of existence (close to 2 months), I have seen multiple occurrences of comments claiming to report a violation of the code of conduct in response to downvotes, close votes, edits for clarity, and even ...

 
yeah I read that
 
2:13 PM
> I've been looking for solutions for several days now
for reading a CSV and saving it as mat
sometimes I want to answer bad things in SO
 
 
1 hour later…
3:48 PM
0
Q: How do you call a function that takes in a MAT file, manipulate the data in that file, and create a new textfile with that same MAT file name?

Steve ChoThe filename in question is a MAT file that contains elements in the form of "a - bi" where 'i' signifies an imaginary number. The objective is to separate the real, a, and imaginary, b, parts of these elements and put them into two arrays. Afterwards, a text file with the same name as the MAT fi...

sometimes its hard to know if someone is trolling or really really really lost
you need to avoid the documentation and at the same time make massive guesswork to get to the code OP has here
 
 
3 hours later…
6:51 PM
Someone made a file mean.m, then couldn't use the mean function. Is there a dupe target for that? I voted to close as "typo". stackoverflow.com/questions/52594176/…
 
@CrisLuengo probably somewhere
 
7:45 PM
@CrisLuengo Not sure if there's a dupe target for that. There are a few for when you shadow a built-in with a variable, but shadowing with another function tends to give different sorts of error messages.
 
8:17 PM
Since this is where all the clever people hang out, I'm advertising my question here:
0
Q: Casting complex to real without data copy in MATLAB R2018a and newer

Cris LuengoSince MATLAB R2018a, complex-valued matrices are stored internally as a single data block, with the real and imaginary component of each matrix element stored next to each other -- they call this "interleaved complex". (Previously such matrices had two data blocks, one for all real components, on...

 
8:31 PM
@CrisLuengo why does typecast not work? is the data not contiguous?
 
@beaker typecast gives an error message if the input is complex.
 
well that's just not nice
 
@CrisLuengo Have you confirmed that an array of N complex values takes up the exact same amount of memory as an array of 2N real values?
 
8:52 PM
@gnovice Yes, if you run the M-file code in the question to generate matrices A and B, and then do whos, you'll see they take up the same space. The C-MEX interface documentation also clearly describes how the data is stored.
@beaker I really feel that typecast should be able to cast complex to real. Maybe I'll submit a bug report... :)
 
It does seem a bit arbitrary, unless they're doing something weird to store the imaginary part. :/
 
@beaker typecast is an old function, and 8 months ago complex arrays were still stored in separate real and imaginary data blocks. So I'm not surprised that they didn't think of updating this function for the new possibilities. Also, MATLAB still doesn't have a separate type for "double complex". class still returns double for a complex array.
 
9:09 PM
@CrisLuengo Can we trust whos and class to give us the right answers, or are they giving us the answers we expect, when in reality there are differences behind the scene?
 
@gnovice The new C++ MEX API has different types for real and complex numbers: mathworks.com/help/matlab/apiref/matlab.data.arraytype.html
But I imagine the array headers in MATLAB still have a separate "complex" flag, like they used to before.
What they call "class" hasn't changed with this internal change. You can't tell from within MATLAB that they changed how complex values are stored. So logically a complex array is still of class "double", because that is what it used to be before the change.
But the changes to the C MEX API are pretty broad, everything related to complex values has changed there. For example, the value of "element size" is now double what it used to be for complex arrays: mathworks.com/help/matlab/apiref/mxgetelementsize.html
 
9:29 PM
@Cris is it legal to set prhs[0] to NULL? And if yes, does that help?
I imagine there should be a way to do this safely because this is similar to how "don't copy if necessary" functions could be implemented under the hood
 
@AndrasDeak You are not supposed to change the inputs, so modifying any of the prhs is "illegal".
 
shame
 
10:09 PM
@ballBreaker you'll love this
When you're overqualified for the job https://t.co/saGvom7OOS
2
 

« first day (1190 days earlier)      last day (2045 days later) »