MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / Complex_init

Function Complex_init

deps/GraphBLAS/Demo/Source/usercomplex.c:667–934  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

665#define B (GxB_binary_function)
666
667GrB_Info Complex_init (bool builtin_complex)
668{
669
670 GrB_Info info ;
671
672 //--------------------------------------------------------------------------
673 // create the Complex type, or set to GxB_FC64
674 //--------------------------------------------------------------------------
675
676 if (builtin_complex)
677 {
678 // use the built-in type
679 Complex = GxB_FC64 ;
680 }
681 else
682 {
683 // create the user-defined type
684 // Normally, the typename should be "GxB_FC64_t",
685 // but the C type GxB_FC64_t is already defined.
686 OK (GxB_Type_new (&Complex, sizeof (GxB_FC64_t), "mycomplex",
687 "typedef struct { double xreal ; double ximag ; } mycomplex ;" )) ;
688 }
689
690 //--------------------------------------------------------------------------
691 // create the Complex binary operators, CxC->Complex
692 //--------------------------------------------------------------------------
693
694 if (builtin_complex)
695 {
696 // use the built-in versions
697 Complex_first = GxB_FIRST_FC64 ;
698 Complex_second = GxB_SECOND_FC64 ;
699 Complex_pair = GxB_PAIR_FC64 ;
700 Complex_plus = GxB_PLUS_FC64 ;
701 Complex_minus = GxB_MINUS_FC64 ;
702 Complex_rminus = GxB_RMINUS_FC64 ;
703 Complex_times = GxB_TIMES_FC64 ;
704 Complex_div = GxB_DIV_FC64 ;
705 Complex_rdiv = GxB_RDIV_FC64 ;
706 }
707 else
708 {
709 // create user-defined versions
710 OK (GxB_BinaryOp_new (&Complex_first , B complex_first ,
711 Complex, Complex, Complex, "complex_first", COMPLEX_FIRST)) ;
712
713 // FUTURE C API suggestion:
714// OK (GrB_BinaryOp_new (&Complex_first , B complex_first ,
715// Complex, Complex, Complex)) ;
716// GrB_set (Complex_first, GRB_NAME, "complex_first") ;
717// GrB_set (Complex_first, GRB_DEFN, COMPLEX_FIRST) ;
718
719 OK (GxB_BinaryOp_new (&Complex_second , B complex_second ,
720 Complex, Complex, Complex, "complex_second", COMPLEX_SECOND)) ;
721 OK (GxB_BinaryOp_new (&Complex_pair , B complex_pair ,
722 Complex, Complex, Complex, "complex_pair", COMPLEX_PAIR)) ;
723 OK (GxB_BinaryOp_new (&Complex_plus , B complex_plus ,
724 Complex, Complex, Complex, "complex_plus", COMPLEX_PLUS)) ;

Callers 3

mainFunction · 0.85
GB_mx_get_globalFunction · 0.85
mexFunctionFunction · 0.85

Calls 5

GxB_Type_newFunction · 0.85
GxB_BinaryOp_newFunction · 0.85
GxB_UnaryOp_newFunction · 0.85
GrB_Monoid_new_UDTFunction · 0.85
GrB_Semiring_newFunction · 0.85

Tested by

no test coverage detected