Fast Auxiliary Space Preconditioning  1.8.4 Feb/15/2016
sparse_util.c
Go to the documentation of this file.
1 
21 #include <math.h>
22 #include <time.h>
23 
24 #include "fasp.h"
25 #include "fasp_functs.h"
26 
27 /*---------------------------------*/
28 /*-- Public Functions --*/
29 /*---------------------------------*/
54  INT *ja,
55  INT *ib,
56  INT *jb,
57  INT *nap,
58  INT *map,
59  INT *mbp,
60  INT *ic,
61  INT *jc)
62 {
63  /* FORM ic when jc is null and both when jc is not null for
64  the ic and jc are for c=a*b, a and b sparse */
65  /* na = number of rows of a */
66  /* mb = number of columns of b */
67  unsigned INT jcform=0;
68  INT na,mb,icpp,iastrt,ibstrt,iaend,ibend,i,j,k,jia,jib;
69  INT *icp;
70  if (jc) jcform=1;
71  na=*nap;
72  mb=*mbp;
73  icpp = 1;
74  icp=(INT *) calloc(mb,sizeof(INT));
75  for (i = 0; i < mb; ++i) icp[i] = 0;
76  for (i = 0; i < na; ++i) {
77  ic[i] = icpp;
78  iastrt = ia[i]-1;
79  iaend = ia[i+1]-1;
80  if (iaend > iastrt) {
81  for (jia = iastrt; jia < iaend; ++jia) {
82  j = ja[jia]-1;
83  ibstrt = ib[j]-1;
84  ibend = ib[j+1]-1;
85  if (ibend > ibstrt) {
86  for (jib = ibstrt; jib< ibend; ++jib) {
87  k = jb[jib]-1;
88  if (icp[k] != i+1) {
89  if (jcform) jc[icpp-1] = k+1;
90  ++icpp;
91  icp[k] = i+1;
92  } //if
93  } //for
94  } //if
95  } //for
96  } //if
97  } //for (i...
98  ic[na] = icpp;
99  if (icp) free(icp);
100  return;
101 }
102 
125  INT *ja,
126  REAL *a,
127  INT *ib,
128  INT *jb,
129  REAL *b,
130  INT *nap,
131  INT *map,
132  INT *mbp,
133  INT *ic,
134  INT *jc,
135  REAL *c)
136 {
137  INT na,mb,iastrt,ibstrt,iaend,ibend,icstrt,icend,i,j,k,ji,jia,jib;
138  REAL *x;
139  REAL x0;
140  /*
141  C--------------------------------------------------------------------
142  C... C = A*B
143  C--------------------------------------------------------------------
144  */
145  na=*nap;
146  mb=*mbp;
147  x=(REAL *)calloc(mb,sizeof(REAL));
148  for (i = 0; i < na; ++i) {
149  icstrt = ic[i]-1;
150  icend = ic[i+1]-1;
151  if (icend > icstrt) {
152  for (ji = icstrt;ji < icend;++ji) {
153  k=jc[ji]-1;
154  x[k] = 0e+0;
155  }
156  iastrt = ia[i]-1;
157  iaend = ia[i+1]-1;
158  if (iaend > iastrt) {
159  for (jia = iastrt; jia < iaend ; ++jia) {
160  j = ja[jia]-1;
161  x0 = a[jia];
162  ibstrt = ib[j]-1;
163  ibend = ib[j+1]-1;
164  if (ibend > ibstrt) {
165  for (jib = ibstrt; jib < ibend; ++jib) {
166  k = jb[jib]-1;
167  x[k] += x0*b[jib];
168  }
169  } // end if
170  } // end for
171  }
172  for (ji = icstrt; ji < icend; ++ji) {
173  k=jc[ji]-1;
174  c[ji]=x[k];
175  } // end for
176  } // end if
177  }//end do
178  if (x) free(x);
179  return;
180 }
181 
198  INT *ja,
199  INT *na,
200  INT *ma,
201  INT *iat,
202  INT *jat)
203 {
204  /*C====================================================================*/
205  INT i,j,jp,n,m,mh,nh,iaa,iab,k;
206  /*
207  C--------------------------------------------------------------------
208  C... Transposition of a graph (or the matrix) symbolically.
209  C...
210  C... Input:
211  C... IA, JA - given graph (or matrix).
212  C... N - number of rows of the matrix.
213  C... M - number of columns of the matrix.
214  C...
215  C... Output:
216  C... IAT, JAT - transposed graph (or matrix).
217  C...
218  C... Note:
219  C... N+1 is the dimension of IA.
220  C... M+1 is the dimension of IAT.
221  C--------------------------------------------------------------------
222  */
223  n=*na;
224  m=*ma;
225  mh = m + 1;
226  nh = n + 1;
227  for (i = 1; i < mh; ++i) {
228  iat[i] = 0;
229  }
230  iab = ia[nh-1] - 1;
231  for (i = 1; i <= iab; ++i) {
232  j = ja[i-1] + 2;
233  if (j <= mh)
234  iat[j-1] = iat[j-1] + 1;
235  }
236  iat[0] = 1;
237  iat[1] = 1;
238  if (m != 1) {
239  for (i= 2; i< mh; ++i) {
240  iat[i] = iat[i] + iat[i-1];
241  }
242  }
243  for (i = 1; i <= n; ++i) {
244  iaa = ia[i-1];
245  iab = ia[i] - 1;
246  if (iab >= iaa) {
247  for (jp = iaa; jp <= iab; ++jp) {
248  j = ja[jp-1] + 1;
249  k = iat[j-1];
250  jat[k-1] = i;
251  iat[j-1] = k + 1;
252  }
253  }
254  }
255  return;
256 }
257 
273  INT *ja,
274  REAL *a,
275  INT *na,
276  INT *ma,
277  INT *iat,
278  INT *jat,
279  REAL *at)
280 {
281  /*C====================================================================*/
282  INT i,j,jp,n,m,mh,nh,iaa,iab,k;
283  /*
284  C--------------------------------------------------------------------
285  C... Transposition of a matrix.
286  C...
287  C... Input:
288  C... IA, JA - given graph (or matrix).
289  C... N - number of rows of the matrix.
290  C... M - number of columns of the matrix.
291  C...
292  C... Output:
293  C... IAT, JAT, AT - transposed matrix
294  C...
295  C... Note:
296  C... N+1 is the dimension of IA.
297  C... M+1 is the dimension of IAT.
298  C--------------------------------------------------------------------
299  */
300  n=*na;
301  m=*ma;
302  mh = m + 1;
303  nh = n + 1;
304 
305  for (i = 1; i < mh; ++i) {
306  iat[i] = 0;
307  }
308  iab = ia[nh-1] - 1; /* Size of ja */
309  for (i = 1;i<=iab; ++i) {
310  j = ja[i-1] + 2;
311  if (j <= mh) {
312  iat[j-1] = iat[j-1] + 1;
313  }
314  }
315  iat[0] = 1;
316  iat[1] = 1;
317  if (m != 1) {
318  for (i= 2; i< mh; ++i) {
319  iat[i] = iat[i] + iat[i-1];
320  }
321  }
322 
323  for (i=1; i<=n; ++i) {
324  iaa = ia[i-1];
325  iab = ia[i] - 1;
326  if (iab >= iaa) {
327  for (jp = iaa; jp <= iab; ++jp) {
328  j = ja[jp-1] + 1;
329  k = iat[j-1];
330  jat[k-1] = i;
331  at[k-1] = a[jp-1];
332  iat[j-1] = k + 1;
333  }
334  }
335  }
336 
337  return;
338 }
339 
360  INT *ja,
361  INT *ib,
362  INT *jb,
363  INT *nab,
364  INT *mab,
365  INT *ic,
366  INT *jc)
367 {
368  unsigned INT jcform=0;
369  INT icpp,i1,i,j,jp,n,m,iastrt,iaend,ibstrt,ibend;
370  INT *icp;
371  /*
372  c... addition of two general sparse matricies (symbolic part) :
373  c= a + b.
374  */
375  if (jc) jcform=1;
376  n=*nab;
377  m=*mab;
378  icp=(INT *) calloc(m,sizeof(INT));
379  for (i=0; i< m; ++i) icp[i] = 0;
380  icpp = 1;
381  for (i=0; i< n; ++i) {
382  ic[i] = icpp;
383  i1=i+1;
384  iastrt = ia[i]-1;
385  iaend = ia[i1]-1;
386  if (iaend > iastrt) {
387  for (jp = iastrt; jp < iaend; ++jp) {
388  j = ja[jp];
389  if (jcform) jc[icpp-1] = j;
390  ++icpp;
391  icp[j-1] = i1;
392  }
393  }
394  ibstrt = ib[i] - 1;
395  ibend = ib[i1] - 1;
396  if (ibend > ibstrt) {
397  for (jp = ibstrt; jp < ibend; ++jp) {
398  j = jb[jp];
399  if (icp[j-1] != i1) {
400  if (jcform) jc[icpp-1] = j;
401  ++icpp;
402  }
403  }
404  }
405  } // // loop i=0; i< n
406  ic[n] = icpp;
407  if (icp) free(icp);
408  return;
409 }
410 
432  INT *ja,
433  REAL *a,
434  INT *ib,
435  INT *jb,
436  REAL *b,
437  INT *nab,
438  INT *mab,
439  INT *ic,
440  INT *jc,
441  REAL *c)
442 {
443  INT n,m,icpp,i1,i,j,iastrt,iaend,ibstrt,ibend,icstrt,icend;
444  REAL *x;
445  /*
446  c... addition of two general sparse matricies (numerical part) :
447  c= a + b
448  */
449  n=*nab;
450  m=*mab;
451  x=(REAL *)calloc(m,sizeof(REAL));
452  for (i=0;i<n;++i) {
453  i1=i+1;
454  icstrt = ic[i]-1;
455  icend = ic[i1]-1;
456  if (icend > icstrt) {
457  for (icpp = icstrt;icpp<icend;++icpp) {
458  j=jc[icpp]-1;
459  x[j] = 0e+00;
460  }
461  iastrt = ia[i]-1;
462  iaend = ia[i1]-1;
463  if (iaend > iastrt) {
464  for (icpp = iastrt;icpp<iaend;++icpp) {
465  j=ja[icpp]-1;
466  x[j] = a[icpp];
467  }
468  }
469  ibstrt = ib[i]-1;
470  ibend = ib[i1]-1;
471  if (ibend > ibstrt) {
472  for (icpp = ibstrt;icpp<ibend;++icpp) {
473  j = jb[icpp]-1;
474  x[j] = x[j] + b[icpp];
475  }
476  }
477  for (icpp = icstrt;icpp<icend;++icpp) {
478  j=jc[icpp]-1;
479  c[icpp] = x[j];
480  }
481  } // if (icstrt > icend)...
482  } // loop i=0; i< n
483  if (x) free(x);
484  return;
485 }
486 
515  INT *jr,
516  INT *ia,
517  INT *ja,
518  INT *ip,
519  INT *jp,
520  INT *nin,
521  INT *ncin,
522  INT *iac,
523  INT *jac,
524  INT *maxrout)
525 {
526  INT i,jk,jak,jpk,ic,jc,nc,icp1,ira,irb,ipa,ipb,maxri,maxr, \
527  iaa,iab,iacp,if1,jf1,jacform=0;
528  INT *ix;
529 
530  nc = *ncin;
531  ix=(INT *) calloc(nc,sizeof(INT));
532  if (jac) jacform=1;
533  maxr = 0;
534  for (i =0;i<nc; ++i) {
535  ix[i]=0;
536  ira=ir[i];
537  irb=ir[i+1];
538  maxri=irb-ira;
539  if (maxr < maxri) maxr=maxri;
540  }
541  iac[0] = 1;
542  iacp = iac[0]-1;
543  for (ic = 0;ic<nc;ic++) {
544  ira=ir[ic]-1;
545  icp1=ic+1;
546  irb=ir[icp1]-1;
547  for (jk = ira;jk<irb;jk++) {
548  if1 = jr[jk]-1;
549  iaa = ia[if1]-1;
550  iab = ia[if1+1]-1;
551  for (jak = iaa;jak < iab;jak++) {
552  jf1 = ja[jak]-1;
553  ipa = ip[jf1]-1;
554  ipb = ip[jf1+1]-1;
555  for (jpk = ipa;jpk < ipb;jpk++) {
556  jc = jp[jpk]-1;
557  if (ix[jc] != icp1) {
558  ix[jc]=icp1;
559  if (jacform) jac[iacp] = jc+1;
560  iacp++;
561  }
562  }
563  }
564  }
565  iac[icp1] = iacp+1;
566  }
567  *maxrout=maxr;
568  if (ix) free(ix);
569  return;
570 }
571 
596  INT *ia,
597  INT *ja,
598  INT *nwp,
599  INT *map,
600  INT *jv,
601  INT *nvp,
602  INT *icp)
603 {
604  INT nw,nv,iastrt,iaend,j,k,jiw,jia;
605  if (*nwp<=0) {*nvp=0; return;}
606  nw=*nwp;
607  nv = 0;
608  for (jiw = 0;jiw < nw; ++jiw) {
609  j = jw[jiw]-1;
610  iastrt = ia[j]-1;
611  iaend = ia[j+1]-1;
612  if (iaend > iastrt) {
613  for (jia = iastrt ;jia< iaend;jia++) {
614  k = ja[jia]-1;
615  if (!icp[k]) {
616  jv[nv] = k+1;
617  nv++;
618  icp[k] = nv;
619  }
620  }
621  }
622  }
623  *nvp=nv;
624  return;
625 }
626 
649  REAL *w,
650  INT *ia,
651  INT *ja,
652  REAL *a,
653  INT *nwp,
654  INT *map,
655  INT *jv,
656  REAL *v,
657  INT *nvp)
658 {
659  INT nw,nv,iastrt,iaend,j,k,ji,jiw,jia;
660  REAL v0;
661 
662  if (*nwp<=0) {*nvp=-1; return;}
663  nw=*nwp;
664  nv=*nvp;
665  for (ji = 0;ji < nv;++ji) {
666  k=jv[ji]-1;
667  v[k] = 0e+0;
668  }
669  for (jiw = 0;jiw<nw; ++jiw) {
670  j = jw[jiw]-1;
671  v0 = w[jiw];
672  iastrt = ia[j]-1;
673  iaend = ia[j+1]-1;
674  if (iaend > iastrt) {
675  for (jia = iastrt;jia < iaend;jia++) {
676  k = ja[jia]-1;
677  v[k] += v0*a[jia];
678  }
679  } // end if
680  } // end for
681  return;
682 }
683 
700  REAL *y,
701  INT *nyp,
702  REAL *x,
703  REAL *s)
704 {
705  INT i,ii;
706  *s=0e+00;
707  if (*nyp > 0) {
708  for (i = 0;i< *nyp; ++i) {
709  ii = jy[i]-1;
710  *s += y[i]*x[ii];
711  }
712  }
713  return;
714 }
715 
734  REAL *y,
735  INT *jx,
736  REAL *x,
737  INT *nyp,
738  INT *nxp,
739  INT *icp,
740  REAL *s)
741 {// not tested well
742  INT i,j,i0,ii;
743  *s=0e+00;
744  if ((*nyp > 0) && (*nxp > 0)) {
745  for (i = 0;i< *nyp; ++i) {
746  j = jy[i]-1;
747  i0=icp[j];
748  if (i0) {
749  ii=jx[i0]-1;
750  *s += y[i]*x[ii];
751  }
752  }
753  }
754  return;
755 }
789  INT *jr,
790  REAL *r,
791  INT *ia,
792  INT *ja,
793  REAL *a,
794  INT *ipt,
795  INT *jpt,
796  REAL *pt,
797  INT *nin,
798  INT *ncin,
799  INT *iac,
800  INT *jac,
801  REAL *ac,
802  INT *idummy)
803 {
804  INT i,j,k,n,nc,nv,nw,nptjc,iacst,iacen,ic,jc, \
805  is,js,jkc,iastrt,iaend,ji,jia;
806  REAL aij,v0;
807  INT *icp=NULL, *jv=NULL,*jris=NULL, *jptjs=NULL;
808  REAL *v=NULL, *ris=NULL, *ptjs=NULL;
809  n=*nin;
810  nc=*ncin;
811 
812  v = (REAL *) calloc(n,sizeof(REAL));
813  icp = (INT *) calloc(n,sizeof(INT));
814  jv = (INT *) calloc(n,sizeof(INT));
815  if (!(icp && v && jv)) {
816  fprintf(stderr,"### ERROR: Could not allocate local mem in rap\n");
817  exit(19);
818  }
819  for (i=0;i<n;++i) {
820  icp[i] = 0;
821  jv[i] = 0;
822  v[i]=0e+00;
823  }
824  for (ic = 0;ic<nc;ic++) {
825  nw = ir[ic+1]-ir[ic];
826  if (nw<=0) continue;
827  is = ir[ic]-1;
828  jris=jr+is;
829  // wtams_(jris,ia, ja, &nw,&n,jv, &nv, icp);
830  // void wtams_(INT *jw,INT *ia, INT *ja, INT *nwp,INT *map,
831  // INT *jv, INT *nvp, INT *icp)
832  // INT nw,ma,nv,iastrt,iaend,i,j,k,ji,jia;
833  nv = 0;
834  for (ji = 0;ji < nw; ++ji) {
835  j = *(jris+ji)-1;
836  iastrt = ia[j]-1;
837  iaend = ia[j+1]-1;
838  if (iaend > iastrt) {
839  for (jia = iastrt ;jia< iaend;jia++) {
840  k = ja[jia]-1;
841  if (!icp[k]) {
842  *(jv+nv) = k+1;
843  nv++;
844  icp[k] = nv;
845  } //end if
846  } //end for
847  } //end if
848  } //end for loop for forming the nonz struct of (r_i)^t*A
849  ris=r+is;
850  // wta_(jris, ris,ia, ja, a,&nw, &n, jv, v, &nv);
851  for (ji = 0;ji < nv;++ji) {
852  k=jv[ji]-1;
853  v[k] = 0e+0;
854  }
855  for (ji = 0;ji<nw ; ++ji) {
856  j = *(jris+ji)-1;
857  v0 = *(ris+ji);
858  iastrt = ia[j]-1;
859  iaend = ia[j+1]-1;
860  if (iaend > iastrt) {
861  for (jia = iastrt;jia < iaend;jia++) {
862  k = ja[jia]-1;
863  v[k] += v0*a[jia];
864  }
865  } // end if
866  } //end for loop for calculating the product (r_i)^t*A
867  iacst=iac[ic]-1;
868  iacen=iac[ic+1]-1;
869  for (jkc = iacst; jkc<iacen;jkc++) {
870  jc = jac[jkc]-1;
871  nptjc = ipt[jc+1]-ipt[jc];
872  js = ipt[jc]-1;
873  jptjs = jpt+js;
874  ptjs = pt+js;
875  // ytxbig_(jptjs,ptjs,&nptjc,v,&aij);
876  aij=0e+00;
877  if (nptjc > 0) {
878  for (i = 0;i< nptjc; ++i) {
879  j = *(jptjs+i)-1;
880  aij += (*(ptjs+i))*(*(v+j));
881  } //end for
882  } //end if
883  ac[jkc] = aij;
884  } //end for
885  // set nos the values of v and icp back to 0;
886  for (i=0; i < nv; ++i) {
887  j=jv[i]-1;
888  icp[j]=0;
889  v[j]=0e+00;
890  } //end for
891  } //end for
892 
893  if (v) free(v);
894  if (icp) free(icp);
895  if (jv) free(jv);
896 
897  return;
898 }
899 
910 {
911 
913  INT n = A->row;
914  INT *IA = A->IA;
915  INT *JA = A->JA;
916 
917  // local variables
918  INT i,j;
919  INT row_begin, row_end;
920  INT count=0;
921  INT *flag;
922  flag = (INT *)fasp_mem_calloc(n, sizeof(INT));
923  //for (i=0;i<n;i++) flag[i]=0;
924  memset(flag, 0, sizeof(INT)*n);
925 
927  //INT *work = (INT *)fasp_mem_calloc (n, sizeof(INT));
928  INT *work = (INT*)fasp_mem_calloc(n,sizeof(INT));
929 
931  ivector MIS;
932 
933  //main loop
934  for (i=0;i<n;i++) {
935  if (flag[i] == 0) {
936  flag[i] = 1;
937  row_begin = IA[i] - 1; row_end = IA[i+1] - 1;
938  //row_begin = IA[i]; row_end = IA[i+1];
939  for (j = row_begin; j<row_end; j++) {
940  if (flag[JA[j]-1] > 0) {
941  //if (flag[JA[j]] > 0) {
942  //if (flag[JA[j]-1] >= 0) {
943  flag[i] = -1;
944  break;
945  }
946  }
947  if (flag[i]) {
948  work[count] = i; count++;
949  for (j = row_begin; j<row_end; j++) {
950  flag[JA[j]-1] = -1;
951  //flag[JA[j]] = -1;
952  }
953  }
954  } // end if
955  }// end for
956 
957  // form MIS
958  MIS.row = count;
959  work = (INT *)fasp_mem_realloc(work, count*sizeof(INT));
960  MIS.val = work;
961 
962  // clean
963  fasp_mem_free (flag);
964 
965  //return
966  return MIS;
967 }
968 
969 
970 /*---------------------------------*/
971 /*-- End of File --*/
972 /*---------------------------------*/
INT * JA
integer array of column indexes, the size is nnz
Definition: fasp.h:163
#define REAL
Definition: fasp.h:67
Vector with n entries of INT type.
Definition: fasp.h:356
void fasp_sparse_aplbms_(INT *ia, INT *ja, INT *ib, INT *jb, INT *nab, INT *mab, INT *ic, INT *jc)
Addition of two sparse matrices: calculating the nonzero structure of the result if jc is not null...
Definition: sparse_util.c:359
void fasp_sparse_iit_(INT *ia, INT *ja, INT *na, INT *ma, INT *iat, INT *jat)
Transpose a boolean matrix (only given by ia, ja)
Definition: sparse_util.c:197
void fasp_sparse_rapms_(INT *ir, INT *jr, INT *ia, INT *ja, INT *ip, INT *jp, INT *nin, INT *ncin, INT *iac, INT *jac, INT *maxrout)
Calculates the nonzero structure of R*A*P, if jac is not null. If jac is null only finds num of nonze...
Definition: sparse_util.c:514
void * fasp_mem_calloc(LONGLONG size, INT type)
1M = 1024*1024
Definition: memory.c:60
void fasp_sparse_aat_(INT *ia, INT *ja, REAL *a, INT *na, INT *ma, INT *iat, INT *jat, REAL *at)
transpose a boolean matrix (only given by ia, ja)
Definition: sparse_util.c:272
#define INT
Definition: fasp.h:64
void fasp_mem_free(void *mem)
Free up previous allocated memory body.
Definition: memory.c:150
void fasp_sparse_aplusb_(INT *ia, INT *ja, REAL *a, INT *ib, INT *jb, REAL *b, INT *nab, INT *mab, INT *ic, INT *jc, REAL *c)
Addition of two sparse matrices: calculating the numerical values in the result.
Definition: sparse_util.c:431
Main header file for FASP.
void * fasp_mem_realloc(void *oldmem, LONGLONG tsize)
Reallocate, initiate, and check memory.
Definition: memory.c:110
void fasp_sparse_ytxbig_(INT *jy, REAL *y, INT *nyp, REAL *x, REAL *s)
Calculates s = y^t x. y-sparse, x - no.
Definition: sparse_util.c:699
void fasp_sparse_rapcmp_(INT *ir, INT *jr, REAL *r, INT *ia, INT *ja, REAL *a, INT *ipt, INT *jpt, REAL *pt, INT *nin, INT *ncin, INT *iac, INT *jac, REAL *ac, INT *idummy)
Calculates R*A*P after the nonzero structure of the result is known. iac,jac,ac have to be allocated ...
Definition: sparse_util.c:788
ivector fasp_sparse_MIS(dCSRmat *A)
get the maximal independet set of a CSR matrix
Definition: sparse_util.c:909
INT * val
actual vector entries
Definition: fasp.h:362
INT row
row number of matrix A, m
Definition: fasp.h:151
void fasp_sparse_wta_(INT *jw, REAL *w, INT *ia, INT *ja, REAL *a, INT *nwp, INT *map, INT *jv, REAL *v, INT *nvp)
Calculate v^t = w^t A, where w is a sparse vector and A is sparse matrix. v is an array of dimension ...
Definition: sparse_util.c:648
Sparse matrix of REAL type in CSR format.
Definition: fasp.h:148
void fasp_sparse_abyb_(INT *ia, INT *ja, REAL *a, INT *ib, INT *jb, REAL *b, INT *nap, INT *map, INT *mbp, INT *ic, INT *jc, REAL *c)
Multiplication of two sparse matrices: calculating the numerical values in the result.
Definition: sparse_util.c:124
INT count
INT row
number of rows
Definition: fasp.h:359
INT * IA
integer array of row pointers, the size is m+1
Definition: fasp.h:160
void fasp_sparse_ytx_(INT *jy, REAL *y, INT *jx, REAL *x, INT *nyp, INT *nxp, INT *icp, REAL *s)
Calculates s = y^t x. y is sparse, x is sparse.
Definition: sparse_util.c:733
void fasp_sparse_abybms_(INT *ia, INT *ja, INT *ib, INT *jb, INT *nap, INT *map, INT *mbp, INT *ic, INT *jc)
Multiplication of two sparse matrices: calculating the nonzero structure of the result if jc is not n...
Definition: sparse_util.c:53
void fasp_sparse_wtams_(INT *jw, INT *ia, INT *ja, INT *nwp, INT *map, INT *jv, INT *nvp, INT *icp)
Finds the nonzeroes in the result of v^t = w^t A, where w is a sparse vector and A is sparse matrix...
Definition: sparse_util.c:595