File: GxB_Iterator_get.c

package info (click to toggle)
suitesparse 1%3A7.11.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 258,172 kB
  • sloc: ansic: 1,153,566; cpp: 48,145; makefile: 4,997; fortran: 2,087; java: 1,826; sh: 1,113; ruby: 725; python: 676; asm: 371; sed: 166; awk: 44
file content (114 lines) | stat: -rw-r--r-- 3,120 bytes parent folder | download
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//------------------------------------------------------------------------------
// GxB_Iterator_get_TYPE: get value of the current entry for any iterator
//------------------------------------------------------------------------------

// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2025, All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

//------------------------------------------------------------------------------

#include "GB.h"

// On input, the prior call to GxB_*Iterator_*seek*, or GxB_*Iterator_*next*
// must have returned GrB_SUCCESS, indicating that the iterator is at a valid
// current entry for either a matrix or vector.

// Returns the value of the current entry at the position determined by the
// iterator.  No typecasting is permitted; the method name must match the
// type of the matrix or vector.

#undef GxB_Iterator_get_BOOL
#undef GxB_Iterator_get_INT8
#undef GxB_Iterator_get_INT16
#undef GxB_Iterator_get_INT32
#undef GxB_Iterator_get_INT64
#undef GxB_Iterator_get_UINT8
#undef GxB_Iterator_get_UINT16
#undef GxB_Iterator_get_UINT32
#undef GxB_Iterator_get_UINT64
#undef GxB_Iterator_get_FP32
#undef GxB_Iterator_get_FP64
#undef GxB_Iterator_get_FC32
#undef GxB_Iterator_get_FC64
#undef GxB_Iterator_get_UDT

#if !defined ( GBMATLAB )

// These methods are not tested by the GraphBLAS/Test or GraphBLAS/Tcov
// test coverage suite, because the conflict with libmwgraphblas.so inside
// MATLAB.

bool GxB_Iterator_get_BOOL (GxB_Iterator iterator)
{
    return (GB_Iterator_get (iterator, bool)) ;
}

int8_t GxB_Iterator_get_INT8 (GxB_Iterator iterator)
{
    return (GB_Iterator_get (iterator, int8_t)) ;
}

int16_t GxB_Iterator_get_INT16 (GxB_Iterator iterator)
{
    return (GB_Iterator_get (iterator, int16_t)) ;
}

int32_t GxB_Iterator_get_INT32 (GxB_Iterator iterator)
{
    return (GB_Iterator_get (iterator, int32_t)) ;
}

int64_t GxB_Iterator_get_INT64 (GxB_Iterator iterator)
{
    return (GB_Iterator_get (iterator, int64_t)) ;
}

uint8_t GxB_Iterator_get_UINT8 (GxB_Iterator iterator)
{
    return (GB_Iterator_get (iterator, uint8_t)) ;
}

uint16_t GxB_Iterator_get_UINT16 (GxB_Iterator iterator)
{
    return (GB_Iterator_get (iterator, uint16_t)) ;
}

uint32_t GxB_Iterator_get_UINT32 (GxB_Iterator iterator)
{
    return (GB_Iterator_get (iterator, uint32_t)) ;
}

uint64_t GxB_Iterator_get_UINT64 (GxB_Iterator iterator)
{
    return (GB_Iterator_get (iterator, uint64_t)) ;
}

float GxB_Iterator_get_FP32 (GxB_Iterator iterator)
{
    return (GB_Iterator_get (iterator, float)) ;
}

double GxB_Iterator_get_FP64 (GxB_Iterator iterator)
{
    return (GB_Iterator_get (iterator, double)) ;
}

GxB_FC32_t GxB_Iterator_get_FC32 (GxB_Iterator iterator)
{
    return (GB_Iterator_get (iterator, GxB_FC32_t)) ;
}

GxB_FC64_t GxB_Iterator_get_FC64 (GxB_Iterator iterator)
{
    return (GB_Iterator_get (iterator, GxB_FC64_t)) ;
}

void GxB_Iterator_get_UDT (GxB_Iterator iterator, void *value)
{
    memcpy (value, ((const uint8_t *) (iterator->Ax)) +
        (iterator->iso ? 0 : (iterator->type_size * iterator->p)),
        iterator->type_size) ;
}

#endif