Search Comments and Ratings

go

Comments and Ratings

   
Date File Comment by Comment Rating
13 Oct 2009 ISMEMBERF Floating-point ISMEMBER (i.e., with round-off tolerance) Author: Bruno Luong Vargas Aguilera, Carlos Adrian

This is a nice function, thanks bruno for sharing it. You all may check out my NUMCMP function too.

http://www.mathworks.com/matlabcentral/fileexchange/21190-numcmp-m

Cheers, Carlos

13 Oct 2009 ISMEMBERF Floating-point ISMEMBER (i.e., with round-off tolerance) Author: Bruno Luong Simon, Jan

Beside the fact, that this is of practical use and works as expected, it helps to answer dozens of questions in the newsgroup: why does ANY((0:0.1:1) == 0.3) reply FALSE???
The help is complete and descriptive, contains author and date, exact and really useful comments. The H1-line is not helpful.
Minor bug in line 125: if ndims(A) ~= 2 || ndims(A) ~= 2. A simple [tf, loc] output might be more efficient than the VARARGOUT/Cell/DEAL/MIN/MAX/NARGOUT constructions.

10 Oct 2009 ISMEMBERF Floating-point ISMEMBER (i.e., with round-off tolerance) Author: Bruno Luong Luong, Bruno

Thank you David for pointing out the bug. I better workaround IMO is change the line #257 to:
dS = realmin(class(S));
while the new version of ISMEMBERF is submitted.

09 Oct 2009 ISMEMBERF Floating-point ISMEMBER (i.e., with round-off tolerance) Author: Bruno Luong David

PROBLEM: ismemberf([0 1 2], 0) will return [0 0 0]. It seems this is because line 263 will auto-configure tol to zero which causes unexpected results in ihi (line 274) that causes tf to be set incorrectly in line 276.

WORK-AROUND: This behavior can be avoided if 'tol' is explicitly set when calling ismemberf().

03 Oct 2009 Min/Max selection Search for k smallest or largest elements in the array Author: Bruno Luong Á, Rencheng

Thanks! It is very useful!

01 Oct 2009 Cubed sphere Generate a cubed-sphere geometry Author: Bruno Luong Fei, Tai

28 Sep 2009 Min/Max selection Search for k smallest or largest elements in the array Author: Bruno Luong Luong, Bruno

Marcello,

Do you have MEX setup? If not, type he following in command line:
>> mex -setup

If it's already installed you have to locate mexopts.bat file somewhere under the directory $MATLABROOT (where the Matlab is installed), then modify OPTPATH variable in line #8 and line #12 of GETMEXOPTS.

then try installation again.

Bruno

28 Sep 2009 Min/Max selection Search for k smallest or largest elements in the array Author: Bruno Luong Dude25

That's look interesting.
How can I compile it?
When i try to install it with "minmax_install" i get the following error: "getmexopts [Bruno]: cannot open comopts.bat file".
How does this file have to look like?

thx
marcello

21 Sep 2009 All Permutations of integers with sum criteria All Pernutations of integers with sum criteria Author: Bruno Luong Petschel, Ben

Nice program. Users might also be interested in a looped solution using the function "nextwhile" in the NextVector toolbox <pre class="link">http://www.mathworks.com/matlabcentral/fileexchange/24757&lt;/pre&gt;. If the entire matrix of combinations is needed then Bruno's version is faster (because row concatenation is slow) otherwise the looped solution is faster.

20 Sep 2009 Cubed sphere Generate a cubed-sphere geometry Author: Bruno Luong Giaccari, Luigi

Maybe we can merge your function and mine:

http://www.mathworks.com/matlabcentral/fileexchange/23959

This way the user can select if return triangular or quad patches... Let me know if you are interested

08 Sep 2009 MPS format exporting tool Convert linear programming problem (MATLAB matrices) to MPS format Author: Bruno Luong Trötscher, Thomas

Works nicely with ILOG CPLEX 11 at least

22 Aug 2009 Plot earth Plot earth in 3D Author: Bruno Luong Xianjun, Pan

01 Aug 2009 Sparse sub access This package allows to retreive and assign values of sparse matrix in one shot. Author: Bruno Luong Lamb, Anthony

Sorry about that.... I think that the following code does the trick
 
A_global = setspvalmex(A_global, Ic, Jr, X,@plus);

01 Aug 2009 Sparse sub access This package allows to retreive and assign values of sparse matrix in one shot. Author: Bruno Luong Lamb, Anthony

Very good!!!! It works well for building global stiffness matrices for finite element computations. While building my stiffness matrices I currently do the following
      val = getspvalmex(A_global, Ic, Jr);
      A_global = setspvalmex(A_global, Ic, Jr, val+X);

Bruno...Is there any other way your code can be used to get this done??

18 Jul 2009 kronecker Kronecker tensor product Author: Bruno Luong Shin, Minchul

17 Jul 2009 N-dimensional histogram Compute n-dimensional histogram Author: Bruno Luong Golden, Daniel

Works great! I'm using it to make a 2-dimensional histogram with an additional third dimension of "weights."

25 Jun 2009 kronecker Kronecker tensor product Author: Bruno Luong Mayowa

25 Jun 2009 kronecker Kronecker tensor product Author: Bruno Luong Fig, Matt

Fast, slick, well done.
Thanks for answering my question. I was waiting on that in order to give a rating, now I know it is my old (!, 2007b) version of MATLAB which is out of alignment.

25 Jun 2009 kronecker Kronecker tensor product Author: Bruno Luong Luong, Bruno

To Matt's comment #2: 2D error checking is introduced in KRON in recent Matlab version. KORNECKER is designed to replicate the same behavior (desirable?).

A workaround (beside delete the error checing line) is:

A = reshape(A,size(A,1),[]);
B = reshape(B,size(B,1),[]);
C = kronecker(A,B);

24 Jun 2009 kronecker Kronecker tensor product Author: Bruno Luong Fig, Matt

My only question is why the function errors out for non- 2D inputs? The stock MATLAB function does not error, and if I take the offending lines of code out of kronecker, the results match.

24 Jun 2009 kronecker Kronecker tensor product Author: Bruno Luong Fig, Matt

Mayowa,

Indeed that is faster for smaller A,B. However, for larger A and B, kronecker is several times faster.

23 Jun 2009 kronecker Kronecker tensor product Author: Bruno Luong Mayowa

Hi,

I found a faster implementaion here
http://ftp.icm.edu.pl/packages/octave/MAILING-LISTS/octave-sources/1999/77. I have translated it into matlab below

function c = kron2(a,b)
  [ra, ca]=size(a);
  [rb, cb]=size(b);
  c = a(ones(rb,1)*(1:ra), ones(cb,1)*(1:ca)).* b((1:rb)'*ones(1,ra), (1:cb)'*ones(1,ca));
  

31 May 2009 N-dimensional histogram Compute n-dimensional histogram Author: Bruno Luong Luong, Bruno

To Bin Zhang:

The way HISTCN is design: If user supply m-edges [e1, e2, ..., e_m] then there are m-1 bins:

bin1 : e1 <= X < x2
bin2: e2 <= X < x3
...
bin-{m-1}: e_m-1 <= X < e_m

The Bin #m does not exist, unless if there is point hitting the right border:

X == e_m

You can indeed force the number of output bins to m by changing the line #66. to

sz(d) = length(ed)-1

Thanks,

Bruno

29 May 2009 N-dimensional histogram Compute n-dimensional histogram Author: Bruno Luong zhang, bin

Hi, Bruno:

Your coding is really elegant and excellent. ;-)
I had one question on line 66 " sz(d) = length(ed)-1; ". So here, why sz(d) is not instead length(ed)?

Due to this, when I provide, .i.e, 3 edges of size mx1, for a 3d matrix, I would get *count* as a (m-1)^3 rather than m^3 matrix. Am I misunderstanding sth here, or there is some special reason for this?

Thanks,
Bin

18 May 2009 Set partition List all partitions a set n elements Author: Bruno Luong Fig, Matt

Very nice: smartly coded, fast, well implemented.

18 May 2009 Set partition List all partitions a set n elements Author: Bruno Luong Luong, Bruno

Darren, thank you for the suggestion. I'll add an example of usage. Functions with more efficient engine will be soon upgraded.

17 May 2009 Set partition List all partitions a set n elements Author: Bruno Luong Rowland, Darren

At last someone has implemented this functionality. Excellent!
I would only suggest that an example of usage and output could be helpful in the SetPartition file and that the first few lines of Bell and Stirling2nd could be rearranged to give meaningful H1 lines.

05 May 2009 Generalized orthogonalization Orthonormal basis of a set vectors with respect to a non-euclidian scalar product Author: Bruno Luong Rowland, Darren

Efficiently and concisely coded. Excellent

02 Mar 2009 workspace create and manipulate variable names in the target workspace by using strings Author: Bruno Luong Luong, Bruno

Originally the WORKSPACE was developed under Matlab 2008B.
I (the author) have upgraded and tested the new version of the package (27 Jan 2009) for backward compatible to 2006B (tested under 2006B, 2007A, 2008B, and 2009A-prerelease). The workspace used the object-oriented programming (OOP) introduced officially by The Mathworks since 2008A. The file uses undocumented OOP feature and Java hashing for backward compatible.
I will be graceful if users of this package can report any eventual incompatible issue with previous versions.

24 Feb 2009 find_idx Fractional binning Author: Bruno Luong Luong, Bruno

Hi John,

Thanks for your comment. Fair enough. histc is fater than interp1. I also discovered this fact recently (after I developed this code and benchmark various methods in fact), and this is something I did not expected.

24 Feb 2009 workspace create and manipulate variable names in the target workspace by using strings Author: Bruno Luong Luong, Bruno

Hi us,

Thank you for your comment. In depth, despite of your note, there are two advantages of the code and it is totally fair to compare WORKSPACE with EVAL IMHO:

First: Within the WORKSPACE methods evalin is used for the sole purpose of retrieving the value of variable(s) from the workspace. Never evalin is evaluated with the RHS (statement with '=' sign').

Second: From the user point of view, he/she does not to worry about building EVAL with full statement. Expressions are evaluated directly, and no longer through string (except for the variable name) as with EVAL.

Bruno

23 Feb 2009 workspace create and manipulate variable names in the target workspace by using strings Author: Bruno Luong us

bruno, not REALLY a third choice: this snippet simply uses EVALIN in its core engine...
hence, (admittedly a lot of good work for) something that should not be supported on first place...
us

22 Feb 2009 find_idx Fractional binning Author: Bruno Luong D'Errico, John

This would be useful to anyone implementing an interpolant in one dimension, or for those writing an interpolation in higher dimensions on a regular lattice. For example, a tensor product interpolant would benefit from this code as the first step, as would some other methods.

I won't offer a rating since I cannot test this without a c-compiler, and without the presence of the compiled version, it just calls interp1 as the engine. It looks well done to me from a quick read through of the code though. I won't make any claim about the c code, since I have no skills in that respect.

I'm not sure about the speed claim though, since if the author has based the claim of speed to a comparison to interp1, I can achieve a 55% reduction in time over interp1 just by a simple call to histc.

xgrid = (0:.1:10);
xi = rand(1,10000)*10;

tic,dx=diff(xgrid);[junk,B]=histc(xi,xgrid);B=B+(xi-xgrid(B))./dx(B);toc
Elapsed time is 0.010040 seconds.

tic,B = interp1(xgrid,(1:length(xgrid)), xi);toc
Elapsed time is 0.022428 seconds.

Both code fragments generate the same outputs, yet the histc one is considerably faster, and written in basic matlab. Any comparison of time should use this as the reference, not interp1.

05 Mar 2008 All Permutations of integers with sum criteria All Pernutations of integers with sum criteria Author: Bruno Luong von Winckel, Greg

Great stuff. I used your work in my code that I just submitted here, but forgot to give credit. I will fix that as soon as I can modify the entry. Thanks for your help!

13 Dec 2007 All Permutations of integers with sum criteria All Pernutations of integers with sum criteria Author: Bruno Luong D'Errico, John

A slick solution to this problem, that uses an elegant recursive code for its work.

Good help, error checks, defaults for arguments where they apply. One minor flaw that I'll hope the author fixes. There is no H1 line. An H1 line is the first line of help. It should be a descriptive line that the function lookfor keys on, including all reasonable keywords that you might search on.

Lookfor is useful when you need to find this function in a year. Will you remember the name "allVL1" next year? No, probably not. But lookfor will find this function for you, if you supply an H1 line.

 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com