File: csr2full.m

package info (click to toggle)
rocsolver 6.4.3-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 17,876 kB
  • sloc: cpp: 151,850; python: 2,275; sh: 875; objc: 642; ansic: 402; makefile: 71; xml: 26
file content (38 lines) | stat: -rw-r--r-- 948 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
% ********************************************************************
% Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
% ********************************************************************

function A=csr2full(m,ptr,ind,val)

%{
-----------------------------------------------------------
  	This function takes a matrix in CSR format and returns a corresponding
  	full matrix with m rows.

  	A = csr2full(m, ptr, ind, val)

  	Inputs:
  	m  					The number of rows of the output matrix
  	ptr, ind, val 		The CSR format arrays

  	Outputs:
  	A  					The output matrix (a general 2D array)

  	(This script is for internal use only. It is not part of
	rocSOLVER library interface and could change or be removed
	without any notice)
-----------------------------------------------------------
%}


A=zeros(m,m);

for i = 1:m,
	k = ptr(i+1) - ptr(i);
	for j=1:k,
		A(i, ind(ptr(i)+j) + 1) = val(ptr(i)+j);
	end;
end;

end