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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:24:04+00:00 2026-06-05T17:24:04+00:00

Is it possible to ask for element (i,j) in CSparse cs object and get

  • 0

Is it possible to ask for element (i,j) in CSparse cs object and get its value or zero if it is not filled? Should I write this function by myself or there is a solution in CSparse?

Lack of documentation made me sad.

Here is the reference from code:

Timothy Davis,
Direct Methods for Sparse Linear Systems,
SIAM, Philadelphia, 2006.
Here is the source

  • 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-05T17:24:06+00:00Added an answer on June 5, 2026 at 5:24 pm

    You’re right. The documentation is poor. Let us see if we cannot generate some rough documentation of our own.

    Copying the directory http://www.cise.ufl.edu/research/sparse/CSparse/CSparse/Source/ to one’s own PC, entering the directory, and issuing the command sed '/^[^[:space:]#{}]/!d;/^\//!a\\' *.c yields

    /* C = alpha*A + beta*B */
    cs *cs_add (const cs *A, const cs *B, double alpha, double beta)
    
    /* clear w */
    static csi cs_wclear (csi mark, csi lemax, csi *w, csi n)
    
    /* keep off-diagonal entries; drop diagonal entries */
    static csi cs_diag (csi i, csi j, double aij, void *other) { return (i != j) ; }
    
    /* p = amd(A+A') if symmetric is true, or amd(A'A) otherwise */
    csi *cs_amd (csi order, const cs *A)  /* order 0:natural, 1:Chol, 2:LU, 3:QR */
    
    /* L = chol (A, [pinv parent cp]), pinv is optional */
    csn *cs_chol (const cs *A, const css *S)
    
    /* x=A\b where A is symmetric positive definite; b overwritten with solution */
    csi cs_cholsol (csi order, const cs *A, double *b)
    
    /* C = compressed-column form of a triplet matrix T */
    cs *cs_compress (const cs *T)
    
    /* column counts of LL'=A or LL'=A'A, given parent & post ordering */
    static void init_ata (cs *AT, const csi *post, csi *w, csi **head, csi **next)
    
    csi *cs_counts (const cs *A, const csi *parent, const csi *post, csi ata)
    
    /* p [0..n] = cumulative sum of c [0..n-1], and then copy p [0..n-1] into c */
    double cs_cumsum (csi *p, csi *c, csi n)
    
    /* depth-first-search of the graph of a matrix, starting at node j */
    csi cs_dfs (csi j, cs *G, csi top, csi *xi, csi *pstack, const csi *pinv)
    
    /* breadth-first search for coarse decomposition (C0,C1,R1 or R0,R3,C3) */
    static csi cs_bfs (const cs *A, csi n, csi *wi, csi *wj, csi *queue,
    
    /* collect matched rows and columns into p and q */
    static void cs_matched (csi n, const csi *wj, const csi *imatch, csi *p, csi *q,
    
    /* collect unmatched rows into the permutation vector p */
    static void cs_unmatched (csi m, const csi *wi, csi *p, csi *rr, csi set)
    
    /* return 1 if row i is in R2 */
    static csi cs_rprune (csi i, csi j, double aij, void *other)
    
    /* Given A, compute coarse and then fine dmperm */
    csd *cs_dmperm (const cs *A, csi seed)
    
    static csi cs_tol (csi i, csi j, double aij, void *tol)
    
    csi cs_droptol (cs *A, double tol)
    
    static csi cs_nonzero (csi i, csi j, double aij, void *other)
    
    csi cs_dropzeros (cs *A)
    
    /* remove duplicate entries from A */
    csi cs_dupl (cs *A)
    
    /* add an entry to a triplet matrix; return 1 if ok, 0 otherwise */
    csi cs_entry (cs *T, csi i, csi j, double x)
    
    /* find nonzero pattern of Cholesky L(k,1:k-1) using etree and triu(A(:,k)) */
    csi cs_ereach (const cs *A, csi k, const csi *parent, csi *s, csi *w)
    
    /* compute the etree of A (using triu(A), or A'A without forming A'A */
    csi *cs_etree (const cs *A, csi ata)
    
    /* drop entries for which fkeep(A(i,j)) is false; return nz if OK, else -1 */
    csi cs_fkeep (cs *A, csi (*fkeep) (csi, csi, double, void *), void *other)
    
    /* y = A*x+y */
    csi cs_gaxpy (const cs *A, const double *x, double *y)
    
    /* apply the ith Householder vector to x */
    csi cs_happly (const cs *V, csi i, double beta, double *x)
    
    /* create a Householder reflection [v,beta,s]=house(x), overwrite x with v,
    double cs_house (double *x, double *beta, csi n)
    
    /* x(p) = b, for dense vectors x and b; p=NULL denotes identity */
    csi cs_ipvec (const csi *p, const double *b, double *x, csi n)
    
    /* consider A(i,j), node j in ith row subtree and return lca(jprev,j) */
    csi cs_leaf (csi i, csi j, const csi *first, csi *maxfirst, csi *prevleaf,
    
    /* load a triplet matrix from a file */
    cs *cs_load (FILE *f)
    
    /* solve Lx=b where x and b are dense.  x=b on input, solution on output. */
    csi cs_lsolve (const cs *L, double *x)
    
    /* solve L'x=b where x and b are dense.  x=b on input, solution on output. */
    csi cs_ltsolve (const cs *L, double *x)
    
    /* [L,U,pinv]=lu(A, [q lnz unz]). lnz and unz can be guess */
    csn *cs_lu (const cs *A, const css *S, double tol)
    
    /* x=A\b where A is unsymmetric; b overwritten with solution */
    csi cs_lusol (csi order, const cs *A, double *b, double tol)
    
    /* wrapper for malloc */
    void *cs_malloc (csi n, size_t size)
    
    /* wrapper for calloc */
    void *cs_calloc (csi n, size_t size)
    
    /* wrapper for free */
    void *cs_free (void *p)
    
    /* wrapper for realloc */
    void *cs_realloc (void *p, csi n, size_t size, csi *ok)
    
    /* find an augmenting path starting at column k and extend the match if found */
    static void cs_augment (csi k, const cs *A, csi *jmatch, csi *cheap, csi *w,
    
    /* find a maximum transveral */
    csi *cs_maxtrans (const cs *A, csi seed)  /*[jmatch [0..m-1]; imatch [0..n-1]]*/
    
    /* C = A*B */
    cs *cs_multiply (const cs *A, const cs *B)
    
    /* 1-norm of a sparse matrix = max (sum (abs (A))), largest column sum */
    double cs_norm (const cs *A)
    
    /* C = A(p,q) where p and q are permutations of 0..m-1 and 0..n-1. */
    cs *cs_permute (const cs *A, const csi *pinv, const csi *q, csi values)
    
    /* pinv = p', or p = pinv' */
    csi *cs_pinv (csi const *p, csi n)
    
    /* post order a forest */
    csi *cs_post (const csi *parent, csi n)
    
    /* print a sparse matrix; use %g for integers to avoid differences with csi */
    csi cs_print (const cs *A, csi brief)
    
    /* x = b(p), for dense vectors x and b; p=NULL denotes identity */
    csi cs_pvec (const csi *p, const double *b, double *x, csi n)
    
    /* sparse QR factorization [V,beta,pinv,R] = qr (A) */
    csn *cs_qr (const cs *A, const css *S)
    
    /* x=A\b where A can be rectangular; b overwritten with solution */
    csi cs_qrsol (csi order, const cs *A, double *b)
    
    /* return a random permutation vector, the identity perm, or p = n-1:-1:0.
    csi *cs_randperm (csi n, csi seed)
    
    /* xi [top...n-1] = nodes reachable from graph of G*P' via nodes in B(:,k).
    csi cs_reach (cs *G, const cs *B, csi k, csi *xi, const csi *pinv)
    
    /* x = x + beta * A(:,j), where x is a dense vector and A(:,j) is sparse */
    csi cs_scatter (const cs *A, csi j, double beta, csi *w, double *x, csi mark,
    
    /* find the strongly connected components of a square matrix */
    csd *cs_scc (cs *A)     /* matrix A temporarily modified, then restored */
    
    /* ordering and symbolic analysis for a Cholesky factorization */
    css *cs_schol (csi order, const cs *A)
    
    /* solve Gx=b(:,k), where G is either upper (lo=0) or lower (lo=1) triangular */
    csi cs_spsolve (cs *G, const cs *B, csi k, csi *xi, double *x, const csi *pinv,
    
    /* compute nnz(V) = S->lnz, S->pinv, S->leftmost, S->m2 from A and S->parent */
    static csi cs_vcount (const cs *A, css *S)
    
    /* symbolic ordering and analysis for QR or LU */
    css *cs_sqr (csi order, const cs *A, csi qr)
    
    /* C = A(p,p) where A and C are symmetric the upper part stored; pinv not p */
    cs *cs_symperm (const cs *A, const csi *pinv, csi values)
    
    /* depth-first search and postorder of a tree rooted at node j */
    csi cs_tdfs (csi j, csi k, csi *head, const csi *next, csi *post, csi *stack)
    
    /* C = A' */
    cs *cs_transpose (const cs *A, csi values)
    
    /* sparse Cholesky update/downdate, L*L' + sigma*w*w' (sigma = +1 or -1) */
    csi cs_updown (cs *L, csi sigma, const cs *C, const csi *parent)
    
    /* solve Ux=b where x and b are dense.  x=b on input, solution on output. */
    csi cs_usolve (const cs *U, double *x)
    
    /* allocate a sparse matrix (triplet form or compressed-column form) */
    cs *cs_spalloc (csi m, csi n, csi nzmax, csi values, csi triplet)
    
    /* change the max # of entries sparse matrix */
    csi cs_sprealloc (cs *A, csi nzmax)
    
    /* free a sparse matrix */
    cs *cs_spfree (cs *A)
    
    /* free a numeric factorization */
    csn *cs_nfree (csn *N)
    
    /* free a symbolic factorization */
    css *cs_sfree (css *S)
    
    /* allocate a cs_dmperm or cs_scc result */
    csd *cs_dalloc (csi m, csi n)
    
    /* free a cs_dmperm or cs_scc result */
    csd *cs_dfree (csd *D)
    
    /* free workspace and return a sparse matrix result */
    cs *cs_done (cs *C, void *w, void *x, csi ok)
    
    /* free workspace and return csi array result */
    csi *cs_idone (csi *p, cs *C, void *w, csi ok)
    
    /* free workspace and return a numeric factorization (Cholesky, LU, or QR) */
    csn *cs_ndone (csn *N, cs *C, void *w, void *x, csi ok)
    
    /* free workspace and return a csd result */
    csd *cs_ddone (csd *D, cs *C, void *w, csi ok)
    
    /* solve U'x=b where x and b are dense.  x=b on input, solution on output. */
    csi cs_utsolve (const cs *U, double *x)
    

    Do you notice anything there that looks as though it would do what you want? I don’t. Based on the above, the function cs_print() seems a more likely candidate than most of the others. However, when I look at the cs_print() source, I don’t seem to see what you want. Instead I see a routine that seems to treat nonzero elements only.

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

Sidebar

Related Questions

I'm not sure if this is even possible, but I figured I'd ask before
Before I ask my question, let me get this straight... This is not a
is it possible to ask parent for its refered collection_name based on one of
The question Is it possible to ask SSIS to cast a value and return
Possible Duplicate: JavaScript: Why the anonymous function wrapper? I would like to ask you
This might not be possible but before I rewrite part of my application I
I wanted to ask whether it is possible to get the correct sizes of
I don't think this is possible but I am going to ask it nonetheless,
Not sure how to ask this question, but here goes. Say I have: var
Is it possible to ask SharePoint, what sites/folders a user has access to? In

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.