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 7948351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:41:59+00:00 2026-06-04T01:41:59+00:00

I am working with sparse matrices stored in a general sparse format (compressed row).

  • 0

I am working with sparse matrices stored in a general sparse format (compressed row). I.e. I store the matrix:

0 x y 0
0 0 0 0 
z 0 0 0

in the form of:

  • Matrix dimensions: [3,4]
  • The offset of each row: [0,2,2,3]
  • The column of each nonzero entry: [1,2,0]
  • Nonzero elements: [x,y,z]

I am looking for hash function which would allow me to “cache” the sparsity patterns (i.e. the first three vectors with integers above). For that I suppose that I need a good hash function that I can supply to the hash map implementation I was planning to use, namely C++’s std::unordered_map.

Does anyone have some tips on how to find a good hash function for a problem like this?

  • 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-04T01:42:00+00:00Added an answer on June 4, 2026 at 1:42 am

    If your CSR representation is unique per matrix, i.e. the nonzero elements appear in left-to-right, top-to-bottom order, then you can hash all the vectors and combine the hashes using boost::hash_combine (if you don’t want a dependency on Boost, just copy-paste it, it’s very short).

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

Sidebar

Related Questions

I am currently working on a C++ sparse matrix/math/iterative solver library, for a simulation
I am working on some software that does a sparse matrix-vector multiply. The matrix
I'm working with a big matrix (not sparse), it contains about 10^10 double. Of
I'm working on a sparse matrix class that needs to use an array of
I'm working with R. I have a matrix structure but stored in three lists
I've been working with large sparse files on openSUSE 11.2 x86_64. When I try
I'm working with an array in AS3, which is sparse by default. I make
I am working on a project that requires the manipulation of enormous matrices, specifically
Working on a bunch of forms at the moment and I'm finding that I
Working on a website that has Employee and Branch entities, using a database table

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.