File: eig.m

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 (34 lines) | stat: -rw-r--r-- 882 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
function [V, varargout] = eig (G, varargin)
%EIG Eigenvalues and eigenvectors of a GraphBLAS matrix.
% See 'help eig' for details.
%
% See also eigs.

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

% NOTE: this is a high-level algorithm that uses GrB objects.

% convert G to a built-in matrix
if (isreal (G) && issymmetric (G))
    % G can be sparse if G is real and symmetric
    G = double (G) ;
else
    % otherwise, G must be full.
    G = full (double (G)) ;
end

% use the built-in eig
if (nargin == 1)
    [V, varargout{1:nargout-1}] = builtin ('eig', G) ;
else
    args = varargin ;
    for k = 1:length (args)
        argk = args {k} ;
        if (isobject (argk))
            args {k} = full (double (argk)) ;
        end
    end
    [V, varargout{1:nargout-1}] = builtin ('eig', G, args {:}) ;
end