I have a line of code as follows
nrma2 = full(abs(sum(A.*A',1)));
but sum(...,1)
is a row. abs()
returns only a row with absolute numbers
So, what will full()
do?
full()
will make a full matrix out of a sparse one. A sparse matrix can be a row vector, that's just a 1 -by- N matrix. The code you posted presumably has A
as a sparse matrix, or includes the full()
in case it is not a full matrix already to ensure it becomes a full vector.
A = sparse([1,0;1,0])
A =
(1,1) 1
(2,1) 1
nrma2 = full(abs(sum(A.*A',1))) % Full row-matrix
nrma2 =
1 0
abs(sum(A.*A',1)) % Sparse row-matrix
ans =
(1,1) 1
Specifically, from the documentation on full()
:
full
Convert sparse matrix to full storage(...)
S
— Sparse matrix to convert
Sparse matrix to convert, specified as a matrix. IfS
is already a full matrix, thenA
is identical toS
.