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

  • SEARCH
  • Home
  • 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 9271439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:37:10+00:00 2026-06-18T15:37:10+00:00

I have a very large two dimensional array and I need to compute vector

  • 0

I have a very large two dimensional array and I need to compute vector operations on this array. NTerms and NDocs are both very large integers.

var myMat = new double[NTerms, NDocs];

I need to to extract vector columns from this matrix. Currently, I’m using for loops.

            col = 100;
            for (int i = 0; i < NTerms; i++)
            {
                myVec[i] = myMat[i, col];
            }

This operation is very slow. In Matlab I can extract the vector without the need for iteration, like so:

myVec = myMat[:,col];

Is there any way to do this in C#?

  • 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-06-18T15:37:11+00:00Added an answer on June 18, 2026 at 3:37 pm

    There are no such constructs in C# that will allow you to work with arrays as in Matlab. With the code you already have you can speed up process of vector creation using Task Parallel Library that was introduced in .NET Framework 4.0.

    Parallel.For(0, NTerms, i => myVec[i] = myMat[i, col]);
    

    If your CPU has more than one core then you will get some improvement in performance otherwise there will be no effect.

    For more examples of how Task Parallel Library could be used with matrixes and arrays you can reffer to the MSDN article Matrix Decomposition.

    But I doubt that C# is a good choice when it comes to some serious math calculations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two very large data frames (50MM+ rows) and I need to run
I have two very large tables, Table1 and Table2. They look like this: Table1
I have two very large lists. They both were originally in excel, but the
I have two very large tables and I need to process a small resultset
I have a very large comma-seperated text-file. I need to display this in a
I have two very large List<List<int>> A and B. I need to find intersection
I have two very large matrices (60x25000) and I'd like to compute the correlation
I have two arrays, one is very large (more than million entries) and other
I have a very large UIView approx 3000x3000 in size. In this large view
I have a very large data file with around 60000 rows. I need to

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.