Matlab's blockproc vs for loop Speed [closed] - performance

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I need to perform computations for each pixels in an image. I currently have code with a double for-loop that takes a long time. Would converting this to "blockproc(I,[1 1],fun)" give any kind of speed up?
Thanks!

If you have access to the Parallel Computing Toolbox and R2012a or later, you can use blockproc with the 'parallel'-option. Alternatively, you can parfor the outer loop. While it's possible blockproc is still faster, you should definitely profile the two options side-by-side.
Alternatively, you may be able to achieve important speed gains by changing your algorithm - for example, break down a 2D filter into 2 1D filters, etc.
/aside: The big advantage blockproc can have over nested-loop solutions is that it can work on images that are too big to fit in RAM, i.e. it takes care of loading sub-images for you.

Related

Hyper LogLog algorithm in R [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Is there is any implementation for hyper LogLog algorithm in R?. I found a javascript implementation :
LogLog and HyperLogLog algorithms for counting of large cardinalities
which way is better to implement the algorithm ? for example, converting the javascript implementation would be good? or should I start from scratch.
Any suggestions ?
I am not aware of an already existing implementation, although that absolutely does not mean that there none. In regard to writing the code yourself, I would not literally translate the code form the javascript code. The style I would choose in R is very different (more apply loops and vectorisation), probably the code will be shorter.
In stead of literally translating the code, I would write down the steps of the algorithm in pseude code, and then implement the R code from that pseudo code. That way you can more easily write a solution in a real R style, and you have a good opportunity to learn exactly how the algorithm works.

what is the latest and best face recognition algorithm? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
am doing my final project that includes face recognition and am trying to implement it on matlab. can anybody help me on getting some resources on each algorithms and their pro's and cons. plus if i get their matlab implementation i would be glad.
i've tried PCA(Eigenfaces) but in some resources it says it not a good algorithm anymore. so am looking for an alternative.
The Viola Jones Face Detector is nice but of course it is just detection:
http://www.cs.ubc.ca/~lowe/425/slides/13-ViolaJones.pdf
if you want the best results you can try fusion by employing multiple methods at once and recogintion rate can increase considerably if performance is not an issue
One may use Gabor wavelets
face recognition in opencv
a matlab code uses Gabor feature

Cutting rectangular pieces of a rectangular paper and minimizing the wastage. [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
A rectangular piece of paper is given of W*H(widht * height). One is supposed to cut rectangular pieces out of it. The list (having 'k' elements) of size of the pieces is given. The size of the pieces is given by w*h. All the numbers are integers.
The cut must go from one end to the other.
There could be any number of pieces of the listed sizes(including no piece).
The aim is to use as much paper as possible, i.e minimize wastage.
Can anyone suggest me how to approach this problem.
this is your typical knapsack problem. i will spare you the details here but you can get more info and ideas on how to approach it here
http://en.wikipedia.org/wiki/Knapsack_problem

Kahan summation and relative errors; or real life war stories of "getting the wrong result instead of the correct one" [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am interested in "war stories" like this one:
I wrote a program involving the sum of floating point numbers but I did not use the Kahan summation.
The sum was bad_sum and the program gave me a wrong result.
A colleague of mine, more versed than me in numerical analysis, had a look at the code and suggested me to use the Kahan summation, the sum is now good_sum and the program gives me the correct result.
I am interested in real-life production-code, not in code samples "artificially" created in order to explain the Kahan summation algorithm.
In particular what was the relative error (bad_sum-good_sum)/good_sum for your application?
Up to now I have no similar story to tell. Maybe I will make some tests (running my program on an input data set, logging the program results and the sums with and without Kahan, estimate the relative error).

How and where are GPUs used in scientific simulations? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
How and where are GPUs used in scientific simulations (esp. in astrophysics/cosmology)?
Take a look at NVIDIA CUDA showcase. First two applications mentioned are astronomy/astrophysics.
Astrophysics tag on GPGPU.org
It's quite a new field, but I've seen an application in astrophysics once.
Generally GPUs can be used for parallelizable calculations (per pixel or per event), with simple C-compatible (not object oriented) routines, e.g. fourier trafo, histograms, etc
The simulation in Physics usually needs to consider thousands/millions of particles in cosmology and astrophysics, in Electromagnetic (e.g. in the light propagation g-search "+fdtd +gpu") and fluid simulations, in biological contexts, atmosphere, etc. The GPU can harness the parallelism that is present in the universe. The hardware and the software are ready (g-search Open-CL, CUDA). You can have a supercomputer in your desk. In almost all simulations we can use parallel reasoning: define how to model the response of one component and apply to all components propagating the interactions in time steps.
see my PSE-answer here to see a nice picture where my GPU(300 processors) was used to simulate gravitacional interactions using direct N-Body code.

Resources