1 //------------------------------------------------------------------------------
2 // GB_mx_mxArray_to_Vector
3 //------------------------------------------------------------------------------
4
5 // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
6 // SPDX-License-Identifier: Apache-2.0
7
8 //------------------------------------------------------------------------------
9
10 #include "GB_mex.h"
11
GB_mx_mxArray_to_Vector(const mxArray * V_matlab,const char * name,const bool deep_copy,const bool empty)12 GrB_Vector GB_mx_mxArray_to_Vector // returns GraphBLAS version of V
13 (
14 const mxArray *V_matlab, // MATLAB version of V
15 const char *name, // name of the argument
16 const bool deep_copy, // if true, return a deep copy
17 const bool empty // if false, 0-by-0 matrices are returned as NULL.
18 // if true, a 0-by-0 matrix is returned.
19 )
20 {
21
22 GrB_Matrix V = GB_mx_mxArray_to_Matrix (V_matlab, name, deep_copy, empty) ;
23 if (V != NULL && !GB_VECTOR_OK (V))
24 {
25 mexWarnMsgIdAndTxt ("GB:warn", "must be a column vector") ;
26 GrB_Matrix_free_(&V) ;
27 return (NULL) ;
28 }
29 return ((GrB_Vector) V) ;
30 }
31
32