Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6002467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:58:57+00:00 2026-05-23T00:58:57+00:00

I want all pairwise comparisons for all rows in the matrix, obviously double for

  • 0

I want all pairwise comparisons for all rows in the matrix, obviously double for loop will work but extremely expensive for large dataset.

I looked up implicit loop like apply(), etc. but have no a clue how to avoid the inner loop.

How can it be achieved?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:58:58+00:00Added an answer on May 23, 2026 at 12:58 am

    I’m assuming you’re trying do some type of comparison across all row-pairs of a matrix.
    You could use outer() to run through all pairs of row-indices, and apply a vectorized
    comparison function to each row-pair. E.g. you could calculate the squared Euclidean distance among all row-pairs as follows:

    m <- matrix(1:12,4,3)     
    > outer(1:4,1:4, FUN = Vectorize( function(i,j) sum((m[i,]-m[j,])^2 )) )
         [,1] [,2] [,3] [,4]
    [1,]    0    3   12   27
    [2,]    3    0    3   12
    [3,]   12    3    0    3
    [4,]   27   12    3    0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want all the lines with assert_equal and without amazon. I tried following but
I want to select distinct product_series, but I want all the other columns too.
I want all the functionality of Dictionary<TKey,TValue> but I want it as Foo<TKey,TValue> .
If I want all the lines with the text 'ruby' but not 'myruby' then
I want to style some forms in Plone3+collective.xdv but I don't want all forms
Given a.b.c.d.e I want to obtain all subtrees, efficiently, e.g. b.c.d.e and c.d.e, but
Almost all the examples I see are done with IB but I don't want
I want all the features of file.renameTo in java but without the source file
I want: all links which not contained filename (not .html, .jpg, .png, .css) redirect
I want all labels inside a detail view to be bold. I created a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.