Search Comments and Ratings

go

   
Date File Comment by Comment Rating
07 Sep 2011 Don't let that INV go past your eyes; to solve that system, FACTORIZE! A simple-to-use object-oriented method for solving linear systems and least-squares problems. Author: Tim Davis

Tim Davis (view profile)

Tim Davis

Tim Davis (view profile)

Comment from the author: I have addressed Ben's comment about uminus in this update (Sept 2011). You can now do -inverse(A)*b, or -2*inverse(A)*b, which you could not do in the previous version.

Comment only
22 Mar 2010 Don't let that INV go past your eyes; to solve that system, FACTORIZE! A simple-to-use object-oriented method for solving linear systems and least-squares problems. Author: Tim Davis

Tim Davis (view profile)

Tim Davis

Tim Davis (view profile)

-inverse(A)*b can also be done as -(inverse(A)*b), which is more natural than inverse(A)*(-b).

Comment only
12 Mar 2010 VIDEO TUTORIAL: Serial communication (TX and RX) using SERIAL Matlab function. VIDEO TUTORIAL: Serial communication (TX and RX) using SERIAL Matlab function.(Narration in Spanish) Author: Diego Barragán

Diego Barragán (view profile)

Tim Davis

Tim Davis (view profile)

Minor comment: the downloaded filename includes non-ascii characters. This causes the MATLAB "unzip" function to fail. A video in Spanish is fine (there should be more), but I suggest that you change the filename so that MATLAB can handle the file properly.

Comment only
12 Mar 2010 Tamper-proof digital files An example of a self-embedding scenario Author: Abbas Cheddad

Abbas Cheddad (view profile)

Tim Davis

Tim Davis (view profile)

"wanna" is not grammatically correct, and is not a good example for secondary students.

Comment only
12 Mar 2010 Complement Coding Complement Coding can be used to preprocess and normalize neural network input. Author: Massimiliano Versace Tim Davis

Tim Davis (view profile)

The "unzip" function in MATLAB cannot handle this file. It returns an error:

warning: ERROR: Error using ==> extractArchive>copyStreams at 174
Unable to write file "./complement_coding_icon_3_elaborated.pdf".
The entry may be password-protected or encrypted.

I was able to unzip it on my Mac, via the Unix "unzip" command. The MATLAB "unzip" fails.

Also, the zip file contains yet another copy of itself (complement.zip). That file includes still another copy of the code.

Please rezip the file and repost it. You should exclude the nested zip file.

Comment only
12 Mar 2010 Don't let that INV go past your eyes; to solve that system, FACTORIZE! A simple-to-use object-oriented method for solving linear systems and least-squares problems. Author: Tim Davis

Tim Davis (view profile)

Tim Davis

Tim Davis (view profile)

Comment from the author: implementing the uminus function would be rather painful. I would need to return an object that is unchanged from the previous one, except with a flag stating that the result of all other functions must negate their result. This would be rather ugly and would needlessly complicate the code, just to add a rather minor feature.

Thanks for the suggestion ... I agree that uminus "ought" to work. It seems simple from the perspective of an end-user. But implementing it is far more trouble than it's worth, in my opinion.

Comment only
12 Mar 2010 getversion Portable replacement for verLessThan on old MATLAB releases Author: Tim Davis

Tim Davis (view profile)

Tim Davis

Tim Davis (view profile)

Comment from the author:

Note that for MATLAB 7.10 (R2010a), this function returns "8". Version 7.10 follows after 7.9, but version 7.10 is not the same as 8.0. When I wrote this code, I assumed that the subversion number (the "y" in "x.y") would always be a single decimal digit.

getversion still returns a value that is monotonically increasing for all MATLAB versions, including 7.10. However, it will fail when MATLAB 8.0 actually comes out.

One fix would be to return a value equal to version+subversion/100, so that "7.1" becomes the number 7.01, "7.10" becomes the number 7.1, and "8.0" would then be 8.0. But this fix would look strange. Printing the version number would lead to confusion.

Maybe I should switch to hexadecimal ...

Comment only
12 Mar 2010 Patch for XTargets MUnit Patch for later versions of MATLAB Author: Sung Soo Kim

Sung Soo Kim (view profile)

Tim Davis

Tim Davis (view profile)

The zip file is corrupted. I can unzip it using the system "unzip" command on my Mac and on my Linux PC, but the MATLAB "unzip" function in MATLAB on both those platforms fails, reporting an invalid zip file. Please re-zip the file and repost.

Comment only
25 Jun 2009 SmartInv Large sparse matrix inversion. Returns block diagonal, tridiagonal or pentadiagonal elements. Author: Rouzaud Denis Tim Davis

Tim Davis (view profile)

There's still something wrong with this submission. I computed the exact inverse of this matrix:

http://www.cise.ufl.edu/research/sparse/matrices/HB/bcsstk28.html

and then extracted the tridiagonal entries of the inversion (entries on the diagonal, subdiagonal, and +1 diagonal).

I then computed S = smartinv(A,1,'tri'), excepting to get the same thing.

But I don't I get a matrix with zeros on the +1 and -1 diagonals, every 15 entries or so. So this revised submission is still not computing what it says it computes.

Comment only
24 Jun 2009 SmartInv Large sparse matrix inversion. Returns block diagonal, tridiagonal or pentadiagonal elements. Author: Rouzaud Denis Tim Davis

Tim Davis (view profile)

This function attempts to do the right thing when computing selected entries of the inverse, by solving a sequence of linear equations after doing an LU factorization. However, the implementation is flawed.

One suggestion: the statement [L,U,P]=lu(A) does not allow LU to permute A to improve sparsity. It would be better to use the 4-output LU, [L,U,P,Q]=lu(A), except in your case you'd need to use another name for Q since you have a Q variable already.

You would then need to use the column permutation Q in the forward/backsolve steps.

Including a "waitbar" in a function like this is not a good idea.

There seems to be a bug. The documentation says that s=smartinv(A) returns the diagonal of the inverse, but in fact I get the whole inverse back.

If I do s=smartinv(A,1), I get a diagonal matrix, but not the diagonal entries of the inverse, which is what the documentatioon said I would get. (I tried with this matrix, which is included in MATLAB):

load west0479
A=west0479;

With smartinv(A,1) or smartinv(A,1,'mono'), I should get the diagonal of inv(A) as the result, but I don't. SOmething else is returned.

Finally, the method is very slow. Computing the entire inverse takes 0.13 seconds using S=inv(A). Using S=smartinv(A) I get the same result, but it takes 15 seconds.

In the profiler, all the time is spent in this one line of code:

Q(q0+1:q0+w,q0+1:q0+w) = insblock;

that's a very bad idea. You should never use sparse submatrix assignment, if at all possible. A better approach is to build the matrix all at once, from the blocks, using the "sparse" command.

So there appears to be at least three serious bugs in the code:
(1) does not perform according to the documentation (smartinv(A) returns inv(A), not diag(inv(A))).
(2) very slow as compared with just "inv"
(3) cannot compute the diagonal of the inverse, in spite of the fact that the documentation says it can do so. Instead it returns something else altogether.

And 2 serious drawbacks:
(1) Not really a bug, but a serious performance issue: doesn't allow for pivoting to maintain sparsity, and is thus unsuitable for large matrices.
(2) Remove the waitbar. If your function is used within other codes, the end user isn't interested in the "Inverting matrix..." message.

2
11 Dec 2008 fpermute Derives a matrix of all possible permutations of natural numbers 1, 2, ... , N for a given N Author: Michal

Michal (view profile)

Tim Davis

Tim Davis (view profile)

A few suggestions. First and foremost, this code needs commenting. You have to look at the output matrix to figure out what matrix it's computing. This code has no comments at all. That's really the main reason I give it a rating of 3.

The second reason is that it needs to be redesigned. Wouldn't it make more sense to provide a function that returns each of the n! permutations one at a time? The matrix itself is huge. fpermute(10) returns a (10!)-by-10 matrix, about 3.6 million by 10. Surely an application doesn't need all 3.6 million permutations at the same time.

Something like:

k = 1
[p,k] = next_permutation(n,k)

which increments k. k=1 gives the first one (p=1:n), k=2 the next one, etc.

That would be a useful function. This one is limited by memory requirement to small values of n.

3
10 Dec 2008 Vandermonde matrix Creating matrix with terms of geometric progression in each row Author: Siqing Wu Tim Davis

Tim Davis (view profile)

You should clarify in your help information that the matrix produced has its columns listed in the opposite order of the vander.m function in MATLAB.

Also, providing the determinant is nice, but it would be better to return the log or log10 of the determinant. That way, you can deal with determinants that are very large and very small (it's quite easy for det(A) to underflow or overflow).

Otherwise, nice work, and nicely commented. (You should have a "see also vander" line, though).

Nice use of cumprod. I'm surpised that this function is slower than vander, though.

4
10 Dec 2008 compare text It comapares two diferent words, and the resilts is 1 or 0. That's it Author: iokinberistain Beristain Tim Davis

Tim Davis (view profile)

Sometimes a duplicate of an existing MATLAB function is useful, if it illustrates an algorithm for educational use, for example. This is particularly true for built-in functions like strcmp.

However, this function is so simple (and poorly commented even if you can read the language it's in), that it really serves no purpose at all. It doesn't illustrate anything useful, has fewer features than strcmp, and is slower as well. So why bother? I suggest that the author remove the file. It's really not any help, since it might mean that a MATLAB user would miss the real function (strcmp) and use this one instead.

1
31 Oct 2008 ftoc (v1.2) Creates a table of contents of functions contained in an m-file Author: Kenneth Eaton

Kenneth Eaton (view profile)

Tim Davis

Tim Davis (view profile)

5
31 Oct 2008 ISLANDS Finds all "islands" which are 4-connected components in a matrix. Author: Matt Fig

Matt Fig (view profile)

Tim Davis

Tim Davis (view profile)

Nice work!

5

Contact us