From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Help on Matrix search
Date: Thu, 3 Jun 2010 04:45:22 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 16
Message-ID: <hu7c12$t2b$>
References: <hu6ae4$kgm$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1275540322 29771 (3 Jun 2010 04:45:22 GMT)
NNTP-Posting-Date: Thu, 3 Jun 2010 04:45:22 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:641720

"Dany " <> wrote in message <hu6ae4$kgm$>...
> I have used the below technique that I get help on it in previous post to generate the matrix P[m*6] and is so efficient, and have used the generated values to compute another function recursively A[m*100]. What I need now is to use the all possible values and the computed function in real simulation, to do this I need an efficient method to search fast within the all possible values ( which is a huge matrix i.e m is very big) to match real time values with some approximation boundaries and when I get the nearest match I just want to know the index of the match so I can get the other value A(m*100), in this case i need the index m ( row) . For example lets say that I am searching for [ 0.1122 0.2345 0.5876 0. 8977 0.3674 0.3756] and the the nearest value in matrix P is [0.111 0.232 0.588 0.889 0.368 0.376] , when match is done I can get the index to get value of A, remember the P 
> is very large i.e m=15625000000. Any 
> suggestions I would be appreciated and I would like to explain any matter that is not clear in this post. Thanks
- - - - - - - -
  I assume that by "nearest" you mean the least sum of the squares of the differences between the six components.  Let x = [a,b,c,d,e] be the vector to be thus "best" matched.

 [t,p] = min( (P(:,1)-a).^2+(P(:,2)-b).^2+(P(:,3)-c).^2 ...
             +(P(:,4)-d).^2+(P(:,5)-e).^2 );

p is the desired index into rows of A.

  I would like to point out that, with the size of m you quoted, A would have to have 1,562,500,000,000 floating point numbers in it.  That's over ten terabytes.  Are you sure your computer has that much memory?

Roger Stafford