« first day (42 days earlier)      last day (3171 days later) » 
13:00 - 20:0020:00 - 00:00

1:05 PM
room topic changed to MATLAB and Octave: Room to discuss MATLAB and Octave related topics - "The only thing better than magic numbers is multiplying magic numbers...element-wise" - beaker [matlab] [octave]
 
:D lol
 
 
1 hour later…
2:12 PM
hi
 
hi there
 
3:02 PM
@Daniel Maybe it was an attempt to write a wildcard for year number ? 0_o
 
@rayryeng Very nice that topic against magic numbers
I hate it so much when people use magic numbers in their code. It's so untidy and confusing
Even more than using .' when they mean '
:-D
 
@LuisMendo hehe, I believe I even saw it in your SO profile
I think you meant, "' when they mean .'"
 
Yeah. My #1 Matlab pet peeve. But magic numbers come pretty close
Opps. Yes, it's the other way around, as you say
 
LOL @rayryeng I made it onto the room topic! woohoo!
 
Now you know how I felt :)
Anybody cares to place a bet? I will be receiving one of the following rep bonuses for a bounty soon: 150 / 75 / 0 .... What's it gonna be? :)
 
3:14 PM
@LuisMendo That was in response to Daniel's code review above
@Dev-iL rng says 28, unfortunately
 
Hum..... hopefully not 0!
 
@beaker Yes, I read through that. Very funny (maybe nor so much for him, LOL)
 
Hello
 
unicode paths uhm
 
3:16 PM
has anyone done some programming in opencv?
 
yeah some of us
 
sure, i think a few of us have
 
have they changed the cv in opencv 3.0
like cvpoint cvscalar etc
i giving error
 
what language?
 
c++
 
3:18 PM
cvpoint -> C . cv::point -> C++
If I dont remember wrongly
 
yup... that happened waaaay before 3.0
if you're trying to use the C api, DON'T
couldn't remember what the python wrapper name was
 
Beaker is right. use the cv:: syntax
basically everything is cv::something instead of cvsomething
 
whats cv_AA
 
CV_AA? like as an argument for line()?
 
No ofense, but I think actually you may have more chances in the openCV chat (if there is one)
 
3:22 PM
there is none
LOL
 
hm
 
nope
XD
 
@AnderBiguri Do you know what the typical size of texture memory is on a CUDA card?
 
it depedns
 
...on nVidia's vague compute-ability number?
 
3:23 PM
depedns on 1)cuda card 2)dimension of texture wanted to be used
 
how is it a function of 2) ?
 
@Dev-iL: No, the number was correct. He wanted to write "2%" (two percent). The code was correct.
 
The max texture memory is a value
but then you have max dimensions
max dimension size*
and (MATLAB code) sum(size(maxdim))!=maxmemory
 
@Daniel Alright :) I was not really serious in that comment :)
 
Guys, check this. The answers are really funny
84
A: How addicted to Stack Overflow are you?

mmyersI'm on Meta. On a Saturday morning. Need I say more?

 
3:26 PM
@AnderBiguri - I am just trying to get a sense, are we talking like 40% of the total graphical memory or is it like a few MB...?
(btw, grtz @ rep 7k)
 
Tesla K40c: Max texture dim: 1D:65536. 2D:65536,65536. 3D:4096,4096,4096.
then all the constant memory is texture memory I think
There is no "texture memory" as independent memory, but its "GPU has texture memory capability" thing
 
Error: missing function '_ZN2cv4SURFC1Ediibb'
 
and thanks ;) 7007 rep :D
 
hey whats this
 
Look like someone's Py code golfing attempt
 
3:29 PM
Hhahaha
 
@user3371423 got no clue :)
 
Seriously though, note the cv4SURFC
 
To end up with the texture memory example (yeah I will shut up :P), my Tesla GPU has 4096Mb of global memory==texture memory
the Gforce 4 times less
 
Roger that, thanks!
 
still having crazy problems with it XD
Crazy as crazy=absolutely no sense
th etexture memory fetch gives me each time the value+rand
 
3:35 PM
lol
 
wich is very very werird
 
I read something about texture memory today... Let me find it...
 
so I insert all 1s in the memory and I get 1+-0.3
 
Oh yeah I read that one. a bit outdated i think (the code)
I use other functions
anyway im leaving. Have fun Matlabing!
 
3:40 PM
Have a nice evening!
 
later Ander
 
3:54 PM
omg that screen shot of the guy's desktop lol
@user3371423 - Please appease the OpenCV gods and DON'T USE the C API.
Please stick with the cv::Mat interface, as well as using C++ STL containers.
cvPoint and its related kin were part of the C API and are officially deprecated.
@beaker - yup :) It's a worthy thing to be aware about... don't use magic numbers.
@user3371423 - cv_AA could mean anti-aliasing... when you're drawing a line or a shape.
@user3371423 - You also have more of a chance going to the OpenCV forums. answers.opencv.org/questions
@user3371423 - Most likely a linker error. You need to make sure you link to the OpenCV libs before compiling.
 
I have a neat trick to share! It's about making life easier when working with equations found on the internet (read: wikipedia etc.)
Essentially it's a way to turn a wikipedia equation to {almost entirely} valid MATLAB code
 
4:11 PM
is that right? Please share.
 
(I'm writing it now, it's taking a bit longer than I thought)
The required tools are: 1) A browser, 2) MathType, 3) Maple, 4) MATLAB
Here are the steps:
1. Find an equation that you don't feel like typing. ([example](https://upload.wikimedia.org/math/3/9/7/397992126dac0621a978966396809c66.png))
2. Go to the edit page for the article where the equation was found ([example](https://en.wikipedia.org/w/index.php?title=Propagation_of_uncertainty&action=edit&section=6))
3. Copy & Paste the LaTeX (or TeX?) code ( \sigma_f \approx \left| f \right| \sqrt{ \left( \frac{B}{A}\sigma_A \right)^2 +\left( \ln(A)\sigma_B \right)^2 + 2 \frac{B \ln(A)}{A} \sigma_{AB} }
^ It's missing a few * and the |()| needs to be replaced with abs(), but other than that it's a good place to start imho
^ Obviously, the source can be any type of notation that MathType is able to parse...
 
That's a lot of work lol.
By the time you do all that, I could have typed out the equations in MATLAB manually.
but for more complex equations, yeah I can see the benefit.
 
4:27 PM
The more typing you do, the higher the likeliness of introducing errors... So if this is not a good enough reason in itself, let me assure you that once you do it once or twice, it's very fast :)
 
I'll have to get used to it yes :)
BTW, yay Maple!
That software is Canadian :D
 
Now that you mention it, the giant maple leaf on the logo makes more sense :P
 
haha yes :)
Maple was created by Mathematicians at the University of Waterloo.
Basically, it was their version of Mathematica... but it didn't gain as much popularity.
 
I think that Maple is more approachable....
...even though I have regrettably never used it for anything more than deriving symbolic integrals and derivatives.
 
Mathematica is on my bucket list.
I'd like to learn and use it someday.
 
4:57 PM
hi
@rayryeng why is ur code not wrking in binary images
 
5:13 PM
What code?
You have to be specific. I've answered over 1000 questions.
 
the link that u send me
eigen vectors
pca
10
A: What does selecting the largest eigenvalues and eigenvectors in the covariance matrix mean in data analysis?

rayryengI'm assuming you determined the eigenvectors from the eig function. What I would recommend to you in the future is to use the eigs function. This not only computes the eigenvalues and eigenvectors for you, but it will compute the k largest eigenvalues with their associated eigenvectors for you....

the matlab code
at the last
 
That's because eig only works on double matrices.
You need to convert your images to double before you use eig.
Read the documentation of eig for more details
 
but i am reading my image as a double
its there in the code
 
ok... why don't you do me a favour and tell me what the error is?
As much as I love thinking that I'm a magical worker, I can't read minds.
That's on the bucket list for skills to acquire.
 
output is tolaly black
 
5:20 PM
@_o
 
Then it could be your image.
Also... the covariance matrix that is calculated will probably not do well with binary images.
 
for all k
 
there wouldn't be enough variance in the intensities to give you appreciable output.
 
ohh
 
Did you try with any other image instead of yours?
What about pout.tif, or cameraman.tif?
 
5:21 PM
perfect
with all that
but not with binary
 
That's probably due to the covariance matrix calculation.
there isn't a large distribution of intensities, and so that's perhaps where it's failing.
I'm gonna investigate with a purely random binary image
oh I figured out why
I cast the images to uint8 at the end of the code.
Because your images are binary, you only get intensities of [0,1], and so if you cast to uint8, they don't appear in the output.
remove uint8, and try the code again. I put uint8 there for displaying the images.
 
its tolally white
LOL
 
imshow(out,[])
If that doesn't work, then it's your image.
 
ohh sry i didnt do it with binary but pout
 
that shouldn't matter.
do imshow(out,[])
that'll work regardless of the data type.
and it's white because double images with imshow are expected to be within [0,1], but it isn't in this case.
 
5:27 PM
perfect
whoho
but tell me whats []
 
When you specify a second parameter to imshow, it tells you how to scale the minimum and maximum intensities in the image.
so for example, you can do imshow(im,[128,200]); which means that you map 128 to 0 and 200 to 255.
doing [] defaults to taking the minimum and maximum of the image intensities.
bear in mind that this is only for display. No scaling is done on the image itself.
 
its dim the image
i mean brightness
whn u do that []
 
That could be because there are now negative values in the decomposition.
you can always try doing: imshow(im2uint8(out)); too
 
and by the way pls tell me whther u r doing compression using pca
?
here in the code
 
You do that by choosing the k principal components.
You are representing features from a higher dimensional space to a lower dimensional space.
 
5:31 PM
so basically u have classified the image into no of PC
thats is k
 
Yes.
 
and we choose the min
 
k is the number of PCs you want to retain.
 
valus of k
that classify my image
 
yeah, a rule of thumb is to figure out how many PCs decompose 90% of the energy explained in the dataset.
 
5:32 PM
so that i can get the enitre data from a few k
 
yes.
 
is there a formula
?
 
I gave that to you earlier.
 
Assuming you're using SVD for the PCA.... you would do: total = sum(diag(S).^2);
then to figure out how many you want to keep, do toKeep = find(cumsum(diag(S).^2) >= 0.9*total, 1);
toKeep will tell you how many PCs you want to keep.
 
http://chat.stackoverflow.com/transcript/message/25026935#25026935
http://chat.stackoverflow.com/transcript/message/25026943#25026943
http://chat.stackoverflow.com/transcript/message/25026951#25026951
http://chat.stackoverflow.com/transcript/message/25026957#25026957
 
5:33 PM
this?
 
yup
 
but this is for SVM
 
you can also just use the eigenvalues.
 
u said
 
You can also use the eigenvalues. The relationship between eigenvalues and singular values is by a square root
btw that's SVD, not SVM. SVM is a machine learning tool.
 
5:34 PM
whats that
actually i was confussed
i thought u wrt it wrng
wrote*
 
SVD stands for Singular Value Decomposition
If you read my post, you would see that I mentioned it.
I'm assuming you didn't and skipped straight to the code :)
which is acceptable.
 
i will read it today
i wanted to see the result
 
haha don't worry about it.
 
i dont have patience
 
no comment.
but you can replace S with D in the above code I wrote.
D would be the diagonal matrix of eigenvalues.
 
5:40 PM
whr shud i put this code in the loop
 
hmm on second though
6
Q: How many principal components to take?

Abhishek ShivkumarI know that principal component analysis does a SVD on a matrix and then generates an eigen value matrix. To select the principal components we have to take only the first few eigen values. Now, how do we decide on the number of eigen values that we should take from the eigen value matrix?

It makes sense for lower dimensionality data... but for higher dimensionality, it's all experimentation.
 
and one more thing
have u reduced the resolution
?
 
nope.
I used the full resolution of the image... as you can see in the code.
 
then
why r they appearing small
 
To fit the window?
 
5:46 PM
yes
 
That's the answer. To fit the window
There are only so many images you can cram into a single window.
If you want, replace subplot with figure so you can spawn each image in a separate window.
Back to work. Have fun!
 
for k = [3 11 15 25 45 65 125 155]
%// Extract out highest k eigenvectors
Aq = Asort(:,1:k);

%// Project back onto original domain
out = bsxfun(@plus, Bproject(:,1:k)*Aq.', mean(B, 1));

total = sum(diag(D).^2);
toKeep = find(cumsum(diag(D).^2) >= 0.9*total, 1);
%// Place projection onto right slot and show the image
subplot(4, 2, counter);
counter = counter + 1;
% imshow(out,[]);
imshow(im2uint8(out));
title(['k = ' num2str(k)]);
end
its showing 486
 
As I said above, that heuristic doesn't work for higher dimensionality data.
 
hmm
 
We're assuming here that each row is a single sample with each column as a feature
 
5:50 PM
then it just assumption
 
You'll have to figure it out by experimentation.
I don't have an answer for you.
 
hmm ok thanks for your valuable help
 
6:07 PM
@rayryeng does the no of pixels get reduced
with diff value of k
beacuse of compression
 
6:33 PM
posted on August 12, 2015 by Yair Altman

Java inner classes and enumerations can be used in Matlab with a bit of tweaking. Related posts:Java class access pitfalls There are several potential pitfalls when accessing Matlab classes from Matlab. ...Extending a Java class with UDD Java classes can easily be extended in Matlab, using pure Matlab code. ...Performance: accessing handle properties Handle object property access (get/set) perf

 
6:50 PM
@horchler - nice seeing you here!
@LuisMendo - Hola el doctor :D
 
¡buenas tardes!
días there :-)
Or afternoon. Whatever :-D
 
yes certainly :D lol
well it's quite sunny, so either días or tardes could work :)
 
Lot of activity recently on this chat! It's good you created it
 
oh thank you :D
I hope it stays around. The last one got deleted due to inactivity
 
This code golf can definitely be given a very short Matlab answer! I'm going for it!
3
Q: Counting Pages of a Book

SirParselotYour Task Given the page of a book P on stdin, count the number of times 0-9 appears in the range 1 to P. There is no page zero and your program should handle any number less than 1,000,000,000. Your program is not allowed to loop through all the numbers and extract single digits from the number...

 
7:03 PM
ohhh :) interesting problem.
I'll take a stab at it. Would like to see if we come up with similar byte counts
 
It's not clear from the question what can be used and what, not, though. I guess that's why it hasn't got many upvotes
 
yeah I've been reading through it a few times... it's not very clear.
Ohhhh this is an interesting one
28
Q: Two Makes All The Difference - Cops

Beta DecayChallenge Write a valid program which, when just two characters in the program are changed, removed or added, completely changes the output. The changed output must have a Levenshtein Distance of 15 or more from your original output. The output must be non empty and finite. Your program theref...

Write a program where if you change two characters of the program, the output looks completely different.
Hashing and PRNG changes aren't allowed.
 
@LuisMendo "Your program is not allowed to loop through all the numbers..."
 
technically he isn't. It's vectorized ;)
 
we'll see soon enough now that Luis has updated his answer
 
7:17 PM
Yes. Do Matlab's internal loops count?
@beaker I just provided some explanations
 
yeah, I saw
that seems to me to fall into "extracting single digits"
 
Pity that bsxfun took more bytes!
 
:D
hahaha
noooo! bsxfun always wins!
 
I always say that :-D
But... it took more bytes!
Perhaps the spirit of that challenge is to avoid tallying the digits and instead compute the result, which can probably be done using log and mod
 
Manage to crack one :D
 
7:22 PM
it's an exponential function, but the beginning/end range is tricky
 
1
A: Two Makes All The Difference - Cops

Stewie GriffinMATLAB / OCTAVE, 28 bytes Code: f=@(x)x^.7;g=@(x)7/f(x);g(7) Original output: ans = 1.7928 Changed output ans = -0.3011 - 0.4144i

Answer
0
A: Two Makes All The Difference - Robbers

rayryengMATLAB / Octave by Stewie Griffin Description This required negating the input into the anonymous function g, as well as changing the scaling factor of the g function to 2 instead of 7: Code >> f=@(x)x^.7;g=@(x)2/f(x);g(-7) ans = -0.3011 - 0.4144i

 
fortunately the start of the range is 0 for this one
@rayryeng If it was Matlab I'm sure it was ' vs .'
 
almost lol.
negating a number, and changing the scale of another.
the imaginary number gave it away. Because the first anonymous function took a power < 1, doing that with a negative number immediately gives an imaginary number.
 
@rayryeng Good job!!
 
so is the goal on this one obfuscation?
 
7:25 PM
This Cops and Robbers thing is fun!
Basically yes.
 
More or less obfuscation, yes
 
You can only change two characters in the code and the output must have a difference of at least 15 characters or more.
 
So that you don't get cracked
 
yes, whoever's code doesn't get cracked wins.
random generation functions and hashing is not allowed.
 
ah
okay, i get it
 
7:26 PM
It's a nice challenge indeed. I'll try to think of something
 
I've been trying that out too Luis!
Something evil involving Linear Algebra.
 
I initially thought of gallery. But of course rit's not obfuscated at all
 
I think I have something.
 
Hm. Don't give away too much or I'll crack it :-D
 
I'll post it for you to see :)
 
7:30 PM
it involves...
a matrix
 
Hey @StewieGriffin!
 
it's the code golf crew ;)
 
hi! :)
 
so, @rayryeng's working on his super-secret cops 'n' robbers answer
 
Crap!
 
7:32 PM
Hi Stewie! Thanks for stopping by!
 
Trial and error @rayryeng?
 
initially.
the imaginary units gave it away
so the input into g had to be negative.
 
@StewieGriffin You'll have to explain why you wanted to stay away from SO. Is it that addictive? :-P
 
I just made 7 negative, then fooled around with the scaling factor in g until I got it to match
 
7:33 PM
It's impossible to get a difference of >15 without imaginary numbers...
 
I know!
 
Gotta go now! I'll take a look at your solution later, @rayryeng!
 
I had many different options: ...x^.7i... for one... Would result in imaginary numbers too.
 
later Luis
 
@LuisMendo - Later!
@StewieGriffin - Try this one
0
A: Two Makes All The Difference - Cops

rayryengMATLAB / Octave, 33 bytes Code eig(cov(reshape(sin(1:60),5,12))) Original Output ans = -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 0.0000 0.0000 0.0000 0.0000 2.4410 4.5766 Changed Output ans = 0.0064 0.0000 0.0000 -0.0000 ...

 
7:36 PM
@rayryeng you already gave it away
 
hey worth a try :)
@StewieGriffin - I haven't seen you around in a while. How're things?
 
but then i only saw it because you were talking about it recently ;)
 
@LuisMendo, because I found out I was answering questions when I should have been in bed... (There's a bit more to it f course, but that's the short version :P )
 
@beaker - lol. Well up to you if you'd like to take a stab at it :)
 
nah, i'll let someone else play
 
7:41 PM
ok :D
but you are correct. I exploited something we talked about earlier.
 
Hi @rayryeng, Haven't been here for a while... Refurbishing the house takes up a lot of time... And hanging around on SO at work is probably not too good :P
 
yes I hear you :D lol
ahh I see! How's that going?
 
Well, two spare bedrooms are fixed up... (Well, there's only on spare bedroom I guess... Cause in a few months: 1+1=3
 
oh no way! Congrats!
 
Thanks! =) It's absurd really!
 
7:47 PM
no kidding lol.
We gave birth to our first early May.
 
But I'm looking forward to it! But I guess I'll be on SO even less... :P
 
she is 3 months old. As soon as she is able to type, she will learn how to code.
 
O, congrats to you too then!
 
I'm able to answer questions while she's sleeping on me.... so no break... not yet :)
Thanks!
 
Hehe, as soon as mine is able to type... I'll throw him/her out the door with a ball (and join). :)
 
7:49 PM
oh yes that too :)
actually whatever she's comfortable with that's fine... but I'll jump for joy if she wants to code :D
 
Hehe :)
 
13:00 - 20:0020:00 - 00:00

« first day (42 days earlier)      last day (3171 days later) »