File: gb_error.c

package info (click to toggle)
suitesparse-graphblas 7.4.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 67,112 kB
  • sloc: ansic: 1,072,243; cpp: 8,081; sh: 512; makefile: 503; asm: 369; python: 125; awk: 10
file content (52 lines) | stat: -rw-r--r-- 2,313 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
//------------------------------------------------------------------------------
// gb_error: return a string from a GraphBLAS GrB_info
//------------------------------------------------------------------------------

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

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

#include "gb_interface.h"

const char *gb_error        // return an error message from a GrB_Info value
(
    GrB_Info info
)
{
    switch (info)
    {

        case GrB_SUCCESS :              return ("success") ;

        //----------------------------------------------------------------------
        // informational codes, not an error:
        //----------------------------------------------------------------------

        case GrB_NO_VALUE :             return ("no entry present") ; 
        case GxB_EXHAUSTED :            return ("iterator is exhausted") ;

        //----------------------------------------------------------------------
        // errors:
        //----------------------------------------------------------------------

        case GrB_UNINITIALIZED_OBJECT : return ("uninitialized object") ;
        case GrB_NULL_POINTER :         return ("input pointer is NULL") ;
        case GrB_INVALID_VALUE :        return ("invalid value") ;
        case GrB_INVALID_INDEX :        return ("row or column index out of bounds") ;
        case GrB_DOMAIN_MISMATCH :      return ("object domains are not compatible") ;
        case GrB_DIMENSION_MISMATCH :   return ("matrix dimensions are invalid") ;
        case GrB_OUTPUT_NOT_EMPTY :     return ("output matrix already has values") ;
        case GrB_NOT_IMPLEMENTED :      return ("method not implemented") ;
        case GrB_OUT_OF_MEMORY :        return ("out of memory") ;
        case GrB_INSUFFICIENT_SPACE :   return ("output array not large enough") ;
        case GrB_INVALID_OBJECT :       return ("object is corrupted") ;
        case GrB_INDEX_OUT_OF_BOUNDS :  return ("row or column index out of bounds") ;
        case GrB_EMPTY_OBJECT :         return ("an object does not contain a value") ;
        default :
        case GrB_PANIC :                break ;
    }

    return ("unknown error") ;
}