Rank: 1697 based on 74 downloads (last 30 days) and 7 files submitted
photo

David Holdaway

E-mail

Personal Profile:

 

Watch this Author's files

 

Files Posted by David Holdaway View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
11 Jun 2012 Screenshot Integer partition generator Generates a table of all integer partitions of integers from 0 to N. Author: David Holdaway mathematics, physics, statistics, chemistry, number theory, partition problem 17 12
  • 4.5
4.5 | 2 ratings
26 Apr 2012 block diagonal multiplication Used for multiplying large block diagonal matrices with matrices / vectors. Author: David Holdaway matrix, block diagonal, blkdiag 5 0
11 Apr 2012 block diagonal representation Converts a matrix into a cell array of different sized matrices that make up the blocks. Author: David Holdaway mathematics, matrix multiplication, block diagonal, linear algebra 5 0
28 Mar 2012 Gauss Laguerre Quadrature Generates points and weights for Gauss Laguerre Quadrature, to a tolerance, tested for N < 300 Author: David Holdaway mathematics, numerical analysis 30 0
14 Mar 2012 Gauss Hermite quadrature rule generates zeros of a Hermite polynomial of degree n to tolerance "tol" and their associated weights. Author: David Holdaway mathematics, numerical integration, quadrature 11 2
  • 4.0
4.0 | 1 rating
Comments and Ratings by David Holdaway View all
Updated File Comments Rating
11 Jul 2012 NUPerms Next Unique Permutation of an integer vector Author: Alessandro Colombo

Can't say I'm convinced this is quicker than just generating all the permutations with perms and post selecting, calling very quick functions recursively in Matlab is not efficient at all really.
If you just want just ONE permutation it is obviously faster and not having to store them in memory is probably nice.

There is one thing I am however confused about, which is why you have made this work only for integers, there is nothing in the logic that would mean it shouldn't work fine for double precision numbers why not let the function use the same class as the input?

08 Jun 2012 Integer partition generator Generates a table of all integer partitions of integers from 0 to N. Author: David Holdaway

The "screen shot" is a set of Young diagrams which are a graphical representations of the sets the program calculates. The image is not generated by the program, it is a publicly available file on the Wikipedia commons, it's just a lot more interesting than pasting a screen shot of a table of numbers.

I will edit the file so the help is displayed as suggested, personally I never use help and just open any file and read the comments but if other people do it seems sensible to change that.

22 May 2012 Integer partition generator Generates a table of all integer partitions of integers from 0 to N. Author: David Holdaway

There seems to be a lot of other good code written by people to solve similar problems which it is quite helpful to collate on one page!

However it seems I should clarify what this code does and why I bothered to write it rather than use the current programs on the FEX.

The main reason for the program was to generate quantum numbers for 1D many body harmonic oscillator states (of maxnum particles) below a cut off energy (N).

Say I wanted to generate all the partitions of the numbers 0-100, using at most 6 numbers. Of which there are 3574454 {calculated by
table = integerparttable(100);
>> sum(table(:,7)) }
This set would be given by
parts = intpartgen(100,6);
Which takes ~ 20 seconds to compute.

http://www.mathworks.com/matlabcentral/fileexchange/12009-partitions-of-an-integer recursively calls itself which really can slow things down or even crash if it does so too many times. http://www.mathworks.com/matlabcentral/fileexchange/33616-integer-partitions does not allow you to limit partition length which would again make the calculation impossible.

This program can be used to add on more partitions given a smaller set (by passing this set as a 3rd input), but does not call itself when running.

08 May 2012 MULTINOMIAL Multinomial coefficients. Author: Mukhtar Ullah

The input checking and explanation are very nice, I almost feel bad that I would almost certainly just inline the one line of calculation
"c = floor(exp(gammaln(n+1) - sum(gammaln(k+1),dim)) + .5); "
whenever I use it though!

01 May 2012 Integer partition generator Generates a table of all integer partitions of integers from 0 to N. Author: David Holdaway

Ah I see you were referring to the table file, while you may be correct this is such a trivial amount of time anyway (it is only calculated once) there doesn't seem to be much point in changing it, I will bear it in mind though.

Comments and Ratings on David Holdaway's Files View all
Updated File Comment by Comments Rating
10 Mar 2013 Gauss Hermite quadrature rule generates zeros of a Hermite polynomial of degree n to tolerance "tol" and their associated weights. Author: David Holdaway mehrdad

is it possible to use it for probabilistic Hermite?I want to integrate f(x)*exp(-(x^2)/2)dx?

06 Jan 2013 Gauss Hermite quadrature rule generates zeros of a Hermite polynomial of degree n to tolerance "tol" and their associated weights. Author: David Holdaway afu2007 ??

there are two defects in this function
1, the syntax and description are not given
2, a example of this function is expected

08 Jun 2012 Integer partition generator Generates a table of all integer partitions of integers from 0 to N. Author: David Holdaway David Holdaway

The "screen shot" is a set of Young diagrams which are a graphical representations of the sets the program calculates. The image is not generated by the program, it is a publicly available file on the Wikipedia commons, it's just a lot more interesting than pasting a screen shot of a table of numbers.

I will edit the file so the help is displayed as suggested, personally I never use help and just open any file and read the comments but if other people do it seems sensible to change that.

08 Jun 2012 Integer partition generator Generates a table of all integer partitions of integers from 0 to N. Author: David Holdaway Ahsan Khan

I was wondering where did you acquire the screen shot? (of the tetris looking blocks)what is it displaying?

26 May 2012 Integer partition generator Generates a table of all integer partitions of integers from 0 to N. Author: David Holdaway John D'Errico

There is still a problem with the help here. While there is a fair amount of help, what happens when you try to access it?

>> help intpartgen
lists all partitions of all integers up to N

>>

Yes, that is all you see. But if you edit the code, you find there is much more to be learned.

function intlist = intpartgen(N,maxnum,intlist)
%lists all partitions of all integers up to N

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% i.e. all the possible ways to express N as a sum of independent integers
% e.g. 3 = {3,2+1,1+1+1}, 4={4,3+1,2+1+1,2+2,1+1+1+1}...
%stored as 1d cell array with each cell containing

... yada, yada, yada, ...

The problem is, David has left blank lines in the help block. MATLAB dumps out only the FIRST CONTIGUOUS block of comments in a file. When you leave a blank, empty line, with no % in the beginning, this is a signal to the help utility to end the help.

So the only way to learn how to use these tools is to edit the code, or type it to the command window. Enticing the user to edit your code is a bad idea, as what if they accidentally modify it?

The point is, make it easy for help to work. Instead of a blank line between paragraphs, put in a blank comment line instead. The effort you spent on writing the help is wasted otherwise, as only you know it is there.

Contact us