File Comment by Comment
28 Nov 2014 Min/Max selection Search for k smallest or largest elements in the array Shamanth MK

20 Nov 2014 FFT-based convolution Discrete convolution using FFT method AP

This is what I experimented with the code.

>> tic,A = convnfft(rand(300,300,300), ones(5,5,5), 'same');toc
Elapsed time is 8.061082 seconds.

>> tic,A = convn(rand(300,300,300), ones(5,5,5), 'same');toc
Elapsed time is 2.085360 seconds.

>> 8.061082/2.085360
ans =
3.8656

04 Nov 2014 Free-knot spline approximation Least squares approximation of 1D data using free-knots spline fasfa

Thank you, any possible modification to make it work for k=1? if not, do you know any other method for constant piece wise approximation?

02 Nov 2014 Min/Max filter Multidimensional non-linear min/max filtering seongjin

So far, this is the fastest that I know. Thank you.

30 Oct 2014 Free-knot spline approximation Least squares approximation of 1D data using free-knots spline Bruno Luong

To Fasta:

Yes for k=1; the gradient wrt knots are dirac like, and the gradient method used by here cannot handle it correctly.

Yes, it's a major work to extend to 2D.

30 Oct 2014 Free-knot spline approximation Least squares approximation of 1D data using free-knots spline fasfa

Hello,
I think there is an error when you use piecewise constant (k=1). The results are not the expected. Is it ok?

Also I would like to know if it would be very difficult to modify it and use it for surfaces instead of lines (1D -> 2D).
Thanks!

29 Oct 2014 2D polygon interior detection Detect a whereas a point is interior or exterior to a 2D polygon Roger GALLOU

04 Oct 2014 N-dimensional histogram Compute n-dimensional histogram Brian Little

arnold and J:

I noticed the same issue with the flipping of dimensions. I fixed this by transposing the count ouput parameter (count') before using it in scatter or pcolor or any other plotting function. Hope this helps :)

17 Sep 2014 Sparse sub access This package allows to retrieve and assign values of sparse matrix in one shot. Christoforos Rekatsinas

Got it thx!!

17 Sep 2014 Sparse sub access This package allows to retrieve and assign values of sparse matrix in one shot. Christoforos Rekatsinas

Hi
Im trying to build a large FE model with this package but i dont get any advantage on the speed.

shuangou ren how exactly do u use it one FE assemblage

29 Aug 2014 FFT-based convolution Discrete convolution using FFT method Ian

I am running 2014a on a machine with 192Gb of RAM and 20 cores. I am trying to convolute two vectors, one with 3,060,663 elements, the other with 693. The built-in conv took 0.06 seconds. convnfft filled the memory and then crashed the machine.

29 Aug 2014 Consecutive vector spliter Partition an input vector into smaller series of subvectors of consecutive elements Xinyi Shen

This is a great function that I am looking for.
However, it would be more perfect if
1. the array can be unsorted.
2. the indices can be returned
For example, [s,i] = SplitVec([1 2 1 3 2 1])
where
s={[1 1 1],[2,2],[3]}
i={[1 3 6],[2,5],[4]}
I do not know if it is possible

29 Aug 2014 FFT-based convolution Discrete convolution using FFT method Maura Monville

I downloaded your code and tried to install launching the installation function from Matlab command line. I use a Mac running Maverick (10.9.4)
I got the following error that I am copying in the following.
I verified that clang is installed:
f4230:~ mauede\$ which clang
/usr/bin/clang
I would greatly appreciate your help.Thank you so much.
Regards,
Maura Monville

>> convnfft_install
-> mexopts.sh sourced from directory (DIR = \$MATLAB/bin)
FILE = /Applications/MATLAB_R2013b.app/bin/mexopts.sh
----------------------------------------------------------------
-> MATLAB = /Applications/MATLAB_R2013b.app
-> CC = xcrun -sdk macosx10.7 clang
-> CC flags:
CFLAGS = -fno-common -arch x86_64 -isysroot -mmacosx-version-min=10.7 -fexceptions
CDEBUGFLAGS = -g
COPTIMFLAGS = -O2 -DNDEBUG
CLIBS = -L/Applications/MATLAB_R2013b.app/bin/maci64 -lmx -lmex -lmat -lstdc++
arguments =
-> CXX = xcrun -sdk macosx10.7 clang++
-> CXX flags:
CXXFLAGS = -fno-common -fexceptions -arch x86_64 -isysroot -mmacosx-version-min=10.7
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O2 -DNDEBUG
CXXLIBS = -L/Applications/MATLAB_R2013b.app/bin/maci64 -lmx -lmex -lmat -lstdc++
arguments =
-> FC = gfortran
-> FC flags:
FFLAGS = -fexceptions -m64 -fbackslash
FDEBUGFLAGS = -g
FOPTIMFLAGS = -O
FLIBS = -L/Applications/MATLAB_R2013b.app/bin/maci64 -lmx -lmex -lmat -L -lgfortran -L -lgfortranbegin
arguments =
-> LD = xcrun -sdk macosx10.7 clang
LDFLAGS = -arch x86_64 -Wl,-syslibroot, -mmacosx-version-min=10.7 -bundle -Wl,-exported_symbols_list,/Applications/MATLAB_R2013b.app/extern/lib/maci64/mexFunction.map
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O
LDEXTENSION = .mexmaci64
arguments =
-> LDCXX =
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments =
----------------------------------------------------------------

-> xcrun -sdk macosx10.7 clang -c -I/Applications/MATLAB_R2013b.app/extern/include -I/Applications/MATLAB_R2013b.app/simulink/include -DMATLAB_MEX_FILE -fno-common -arch x86_64 -isysroot -mmacosx-version-min=10.7 -fexceptions -O2 -DNDEBUG "inplaceprod.c"

xcodebuild: error: SDK "macosx10.7" cannot be located.
xcrun: error: unable to find utility "clang", not a developer tool or in PATH

mex: compile of ' "inplaceprod.c"' failed.

Unable to complete successfully.

Error in convnfft_install (line 17)
mex(mexopts{:},'inplaceprod.c');

25 Jul 2014 Multiple-Colon multiple colon-intervals Jeffrey

The technical solution (1-4FLI96) linked in a previous comment is no longer available at that url. The solution was republished to MATLAB Central Answers here:

24 Jun 2014 Voronoi Sphere Compute voronoi's diagram of points on the 2-sphere Eric

This is great! Thank you

24 Jun 2014 Voronoi Sphere Compute voronoi's diagram of points on the 2-sphere Bruno Luong

To Eric: the output (K) _is_ sorted as the input seeds.

24 Jun 2014 Voronoi Sphere Compute voronoi's diagram of points on the 2-sphere Eric

This is great. Is it possible to re-sort the output so that it preserves the order of the input? I am trying to apply specific individual patch colors.

17 Jun 2014 Free-knot spline approximation Least squares approximation of 1D data using free-knots spline Chi-Fu

10 Jun 2014 Consecutive vector spliter Partition an input vector into smaller series of subvectors of consecutive elements Bruno Luong

Monotonic

SplitVec(a, @(v) [0; diff(v(1:end-1)).*diff(v(2:end))<0])

09 Jun 2014 Consecutive vector spliter Partition an input vector into smaller series of subvectors of consecutive elements Michal Kvasnicka

OK ... I add the 'decrease' and 'increase' functions by:
case {'increase'}
fun = @(v) diff(v(:,1))<0;
case {'decrease'}
fun = @(v) diff(v(:,1))>0;

But, how to add functions for 'positive' and 'negative' values vector spliting?

09 Jun 2014 Consecutive vector spliter Partition an input vector into smaller series of subvectors of consecutive elements Michal Kvasnicka

Will be possible to generalize this function to split vector on monotonical parts using ismonotinic function (http://www.mathworks.com/matlabcentral/fileexchange/11637-ismonotonic)?

05 Jun 2014 Vectorized FIND with 'FIRST' option Find the first non-zero element(s) along row/column - or any other dimension Bruno Luong

@Cullen, please ask Mac developer forum. It is odd that an integer 32 bits is not 4 bytes. Something must be very wrong,

04 Jun 2014 Vectorized FIND with 'FIRST' option Find the first non-zero element(s) along row/column - or any other dimension Joseph Cullen

I am getting the following error when trying to run this on a Mac use the compiler in Xcode. From the other comment about Linux, it seems that I have to change the typedef. Any ideas about what it should be for Mac?

Error using find1dmex
FIND1DMEX: incorrect int32 definition (modify MEX file is required)

Error in findfirst (line 106)
B = find1dmex(A, count);

Error in test_nonparam (line 80)
z=findfirst(d)

01 Jun 2014 Min/Max selection Search for k smallest or largest elements in the array Bruno Luong

@JUNBO please replace line #19 of minmax_install.m with this:

if ispc() && datenum(version('-date')) < datenum('January 11, 2014')

28 May 2014 Min/Max selection Search for k smallest or largest elements in the array JUNBO

Hi, Bruno

I am using Matlab 2014a 64x, after installing a SDK 7.1, it still doesn't work, and shows the following messages:
-----------------------------
>> mex -setup
MEX ==> 'Microsoft Windows SDK 7.1 (C)'
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the
-----------------------------
and then
testminmax
error getmexopts (line 36)
getmexopts [Bruno]: cannot open comopts.bat file

error minmax_install (line 20)
compiler = getmexopts('COMPILER');

error testminmax (line 11)
minmax_install();
----------------------
Could you help to solve this problem? Thanks!

Junbo

24 May 2014 Min/Max filter Multidimensional non-linear min/max filtering Wathsala Ranasinghe

22 May 2014 All Permutations of integers with sum criteria All Pernutations of integers with sum criteria Bruno Luong

@ Jang: the number of combination grows fast, like a factorial (i.e., more than a exponential). So it is not surprising that your computer (or any computer in fact) won't handle well large value.

16 May 2014 All Permutations of integers with sum criteria All Pernutations of integers with sum criteria Han Seung Jang

It is very useful function program.
I have a question.
I checked allVL1(64,1), allVL1(64,2), allVL1(64,3) and allVL1(64,4) worked.
However, for large number n and L1, for example, allVL1(64,5), it gives errors and sometimes computer stops.
MATLAB cannot support large numbers n and L1, for allVL1(n,L1)?

16 May 2014 All Permutations of integers with sum criteria All Pernutations of integers with sum criteria Han Seung Jang

07 May 2014 Voronoi Sphere Compute voronoi's diagram of points on the 2-sphere Alphan Sahin

04 Mar 2014 FFT-based convolution Discrete convolution using FFT method Matt Taylor

This function is indeed faster than CONV, but as soon as I attempted to use it on larger data sets, Matlab produced an 'out of memory' error, whereas CONV can cope just fine with the same datasets (albeit taking longer).

FYI if I run the 'memory' command my output is as follows:
Maximum possible array: 11862 MB (1.244e+10 bytes) *
Memory available for all arrays: 11862 MB (1.244e+10 bytes) *
Memory used by MATLAB: 820 MB (8.597e+08 bytes)
Physical Memory (RAM): 8011 MB (8.400e+09 bytes)

So the problem definitely isn't my hardware

12 Feb 2014 bsxops Force MATLAB operators to behave BSXFUN-like M I

should be default behaviour of matlab

04 Feb 2014 2D polygon interior detection Detect a whereas a point is interior or exterior to a 2D polygon Jeffrey Steward

22 Jan 2014 FFT-based convolution Discrete convolution using FFT method Massimo Ciacci

Excellent job! Nicely documented and elegant code and to the point!

Works much faster than conv2 for full case, and also faster than conv2 with option 'valid', which misteriously makes conv2 35x faster with a 500x500 matrix with a 400x400 one (makes me suspect that conv2 + 'valid' does not just extract the mid part but saves computations).

22 Jan 2014 bsxops Force MATLAB operators to behave BSXFUN-like Jared

An extremely useful set of functions.

29 Dec 2013 Multiple same-size linear solver Solve multiple systems of linear equations of the same size John Yang

Thanks for this file, shedding light to me on this kind of problems!

29 Dec 2013 Euclidian projection on ellipsoid and conic Projecting a point on ellipsoid or conic in n-dimensional space Cui

Excellent work. It solved my problem. Thanks very very much.

05 Dec 2013 Free-knot spline approximation Least squares approximation of 1D data using free-knots spline Markus

Hi,

I´m always getting the following warning message:

Warning: Options LargeScale = 'off' and Algorithm = 'trust-region-reflective'
conflict. Ignoring Algorithm and running active-set algorithm. To run
trust-region-reflective, set LargeScale = 'on'. To run active-set without this
warning, set Algorithm = 'active-set'.

What am I doing wrong?

02 Nov 2013 Merge sorted arrays Given two already sorted arrays, the function combines them in an unique sorted array Bruno Luong

Hi Paul, you are right this is a BUG. Submission including correction is pending.

01 Nov 2013 Vectorized FIND with 'FIRST' option Find the first non-zero element(s) along row/column - or any other dimension Francesco Pozzi

I have tried this:

M = 1000; N = 20000;
A = rand(M, N) < 0.5;
tic, B = findfirst(A, 1, M); toc
tic
C = zeros(M, N);
inds = zeros(N, 1);
for hh = 1:N
tmp = find(A(:,hh));
inds(hh) = numel(tmp);
C((hh - 1) * M + (1:inds(hh))) = tmp;
end
toc
all(B(:) == C(:))

Works fine.

01 Nov 2013 Merge sorted arrays Given two already sorted arrays, the function combines them in an unique sorted array Paul

Hi Bruno, thanks for a useful tool. It comes in handy for efficiently summing sparse tensors together. On my system there appears to be a bug when one of the two arrays is empty (see example case below). Is this a compilation problem on my system or a bug in the algorithm? Thanks!

>> [C idx]=mergesa([],[1 1 1; 3 1 1],'rows')

C =

1 1 1
3 1 1

idx =

-1
-2
-3

01 Nov 2013 Vectorized FIND with 'FIRST' option Find the first non-zero element(s) along row/column - or any other dimension Francesco Pozzi

25 Oct 2013 Min/Max selection Search for k smallest or largest elements in the array Mara

Bruno, which comments? I tried compiling the mex files by hand, but with no success. I get the following error.

No supported SDK or compiler was found on this computer.
For a list of supported compilers, see
http://www.mathworks.com/support/compilers/R2013a/win64.html

Error using mex (line 206)
Unable to complete successfully.

25 Oct 2013 FFT-based convolution Discrete convolution using FFT method Bruno Luong

Young, You must change the directory where convfft is installed (including the c code) to install it.

25 Oct 2013 FFT-based convolution Discrete convolution using FFT method Young Gyu

Hi Bruno,

First of all, thanks for the nice job. Unfortunately, I'm having problem with running it. When I try to run convnfft_install, it keeps saying
--------------------------------------
Error in convnfft_install (line 17)
mex(mexopts{:},'inplaceprod.c');
--------------------------------------

Do you have any suggestion?

Thanks,
YG

25 Oct 2013 Min/Max selection Search for k smallest or largest elements in the array Bruno Luong

Mara, see older comments for workaround.

24 Oct 2013 Min/Max selection Search for k smallest or largest elements in the array Mara

I am having trouble installing this package on R2013a. I run minmax_install and get the following output. Thank you for any suggestions.

Mara

-------------

Error using getmexopts (line 36)
getmexopts [Bruno]: cannot open comopts.bat file

Error in minmax_install (line 20)
compiler = getmexopts('COMPILER');

14 Oct 2013 Voronoi Sphere Compute voronoi's diagram of points on the 2-sphere Zejia

14 Oct 2013 All Permutations of integers with sum criteria All Pernutations of integers with sum criteria Andrew Jones

26 Sep 2013 Vectorized FIND with 'FIRST' option Find the first non-zero element(s) along row/column - or any other dimension Karel Lebeda

Your comment is incorrect, on the 7th line should be:
B=zeros(1,size(A,2));