File: GrB_get_set_integers.tex

package info (click to toggle)
suitesparse 1%3A7.10.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 254,920 kB
  • sloc: ansic: 1,134,743; cpp: 46,133; makefile: 4,875; fortran: 2,087; java: 1,826; sh: 996; ruby: 725; python: 495; asm: 371; sed: 166; awk: 44
file content (68 lines) | stat: -rw-r--r-- 3,629 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

%-------------------------------------------------------------------------------
\subsection{Controlling the sizes of integers}
%-------------------------------------------------------------------------------
\label{integer_bits}

Different integers are used for different parts of the matrix/vector/scalar
data structure.  The decision as to which integers to use is determined by the
dimensions and number of entries in the matrix.  The decisions can also be
modified by \verb'GrB_set' and queried by \verb'GrB_get'.  A matrix can have up
to three different kinds of integers.  If a matrix is $m$-by-$n$ with $e$
entries, with default settings:

\begin{packed_itemize}
\item if $m > 2^{31}$: 64-bit integers must be used for the row indices of a
matrix; otherwise, 32-bit integers may be used.
\item if $n > 2^{31}$: 64-bit integers must be used for the column indices of a
matrix; otherwise, 32-bit integers may be used.
\item if $e > 2^{32}$: 64-bit integers must be used for the row/column offsets of
a matrix; otherwise 32-bit integers may be used.
\end{packed_itemize}

This gives up to 8 different matrix types when the matrix is hypersparse.
Sparse matrices use just two of these integer types (a sparse CSR matrix, held
by row, does not store any row indices).  example, if a matrix held in sparse
CSR format (\verb'GxB_SPARSE'), of size $m$-by-$n$ with $e$ entries, then the
value of $m$ does not affect the integers used to store the matrix.  Bitmap and
full matrices use no arrays of integers at all, and are not affected by these
settings.  For

These decisions can be revised on a global basis and a per matrix/vector basis.
Three fields can be used for \verb'GrB_get' and \verb'GrB_get', for the
\verb'GrB_GLOBAL', \verb'GrB_Matrix', \verb'GrB_Vector', and \verb'GrB_Scalar'
objects:

\begin{packed_itemize}
\item \verb'GxB_ROWINDEX_INTEGER_HINT': for the global setting, this can be
set to 32 (the default) or 64.  The default (32) means that 32-bit integers are
used if the number of rows of a matrix or length of a vector is not too
large ($>2^{31}$), and 64-bit integers are used otherwise.  On a per
matrix/vector basis, setting this hint changes the integers used for row
indices in the vector or matrix.  The setting of zero is the default for
individual matrices/vectors, which means the global setting is used.
\item \verb'GxB_COLINDEX_INTEGER_HINT':  the same as the row index hint above,
except for column indices.  This setting has little effect on a
\verb'GrB_Vector', since it is held internally by GraphBLAS as an $m$-by-1
matrix.
\item \verb'GxB_OFFSET_INTEGER_HINT':  Internally, a sparse or hypersparse
matrix or vector holds an offset array with the cumulative sum of the number of
entries in each row (if held by row) or column (if held by column).  A global
setting of 32 is the default, so that 32-bit integers are used if the matrix
has fewer than $2^{32}$ entries. If this setting is changed to 64, then 64-bit
integers are always used.
\end{packed_itemize}

Once an object is created, the sizes of its three integers can be
queried by \verb'GrB_get' with the following fields.  Each query returns the
result of 32 or 64, as an integer, to denote if 32-bit or 64-bit integers are
used for that component of the matrix/vector.  Bitmap and full matrices always
return 64.

\begin{packed_itemize}
\item \verb'GxB_ROWINDEX_INTEGER_BITS': query the number of bits in the row index integer.
\item \verb'GxB_COLINDEX_INTEGER_BITS': query the number of bits in the column index integer.
\item \verb'GxB_OFFSET_INTEGER_BITS': query the number of bits in the offset integer.
\end{packed_itemize}