matlab - How to write vectorization code for 2 matrix -
I have two metrics like this:
gt = [30 40 20 40] And D = [32 42 20 40; 34 12 20 40; 36 84 20 40] I want to calculate the overlap area between gt and 3 rows of de < / Code> respectively and overlap is computed by a function that I myself write. Then I get the result as a new column vector such as result = [result1; Result2; Result3]. Can you please tell me how to get this vector code?
Thank you!
Vecting can only be within the overlap function. The only thing you can do out of it is to repeat the vector GT using the repet or bsxfun. You do not understand how the overlap function works. I think that has to do with coordination, so I give an example for Eclidian distance that works in the same logic.
If you point gt = [1 2] and number = [5 6; 10 12; 0 -1] You will define
function result = dist (x, y) result = sum (sqrt ((x (:, 1) - y (:, 1)). ^ 2 <(0, 2) - y (:, 2)). ^ 2), 2) and you will call it a gt vector copy
Dist (de, repmat (gt, 3, 1)) Alternatively, you can use bsxfun instead of repmat, which is superior performance (based on various factors)
The key of vectoring is doing column-wise operations (in this specific case it can be further vectored, though I Areas am writing to emphasize the column-wise operations)
Comments
Post a Comment