Fast way to search the table for two columns closest values

In summary, the person is looking for a mathematical way to quickly find the closest row in a table of 1000 rows with four columns, given certain measured values. They have used binary and linear search methods but are also considering creating a third column and using a minimum function. They also question the need for speed in a data set of only 1000 points.
  • #1
prayami
1
0
Hi,

I got one table of four columns.
e.g.
Temperature, Field, Vhall and Vdrive.

Table contains the 1000 rows.

I am given the Vhall_maesured and Vdrive_measured values.

I want to find out, which row in the table has the closest values
for Vhall and Vdrive to corresponding Vhall_maesured and Vdrive_measured.

Is there any mathematical way to find the closest row quickly.

If we can't then, we can divide this problem further:
We can have
Vhall_min and Vhall_max
Vdrive_min and Vdrive_max

And in the table we want to find any of the row( there can be more than one
but we are fine if we find any one) where Vhall and Vdrive fall between the above min and max
values.

I know computer programming and finally I want to use it in my program. Right now I am
checking each row sequencially. But I am looking the fatest to reach that point.

I have used one another method i.e. binary search and linear search combine but I am
thiking if there any way using maths of the matrix or vectro to find the row quickest.

Thanks,
 
Physics news on Phys.org
  • #2
Im not sure if you can do this because I don't program, but;

Make a third column which gives the values of the differences of the 2 other columns. Then use the (Third column)_min function.
 
  • #3
There is no faster way than O(n) to search an unordered list!

You mention you are using binary search, so maybe we can assume the data is sorted (e.g. the variables Vhall and Vdrive are monotonicall increasing)?

Without additional assumptions on the data, then linear search is the fastest method. Out of curiosity why is speed even a consideration when you are considering only a 1000 data points in the year 2008? We could have found the minimum of thousands of such data sets in the time you or I spent typing these messages!
 

1. What is the purpose of searching for two columns closest values in a table?

The purpose of searching for two columns closest values is to find the most relevant and accurate data points in a table that meet specific criteria. This type of search is commonly used in data analysis and can help identify patterns and trends in the data.

2. How do you determine which columns to search for closest values?

The columns to search for closest values are typically chosen based on the specific question or problem that needs to be addressed. For example, if the goal is to find the closest temperature to a specific date, the columns for temperature and date would be selected for the search.

3. What is the fastest way to search for two columns closest values in a table?

The fastest way to search for two columns closest values in a table is to use a binary search algorithm. This method involves dividing the table into smaller sections and quickly narrowing down the search to the closest values. It is more efficient than traditional linear search methods.

4. Can this type of search be performed on large datasets?

Yes, this type of search can be performed on large datasets. However, the speed of the search may depend on the size and complexity of the dataset. Using efficient algorithms and optimizing the search process can help improve the speed and performance of the search.

5. How can I ensure the accuracy of the search results?

The accuracy of the search results can be ensured by carefully selecting the columns to be searched, using a reliable and efficient search algorithm, and regularly testing and validating the results. It is also important to check for any potential errors or anomalies in the data that may affect the accuracy of the search.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
850
  • Precalculus Mathematics Homework Help
Replies
1
Views
502
  • Linear and Abstract Algebra
Replies
2
Views
912
  • Programming and Computer Science
Replies
21
Views
2K
  • Programming and Computer Science
Replies
3
Views
241
  • Set Theory, Logic, Probability, Statistics
Replies
32
Views
2K
  • Programming and Computer Science
Replies
8
Views
1K
  • Linear and Abstract Algebra
Replies
15
Views
4K
Back
Top