mirror of https://github.com/davisking/dlib.git
Slightly simplified the code
This commit is contained in:
parent
50a2113f17
commit
d6c1081841
|
@ -566,14 +566,12 @@ namespace dlib
|
||||||
f = matrix_cast<double>(reshape(rowm(m, range(idx, idx+size-1)), nr, nc));
|
f = matrix_cast<double>(reshape(rowm(m, range(idx, idx+size-1)), nr, nc));
|
||||||
svd3(f, u,w,v);
|
svd3(f, u,w,v);
|
||||||
|
|
||||||
w = round_zeros(w, std::max(1e-9,max(w)*1e-7));
|
|
||||||
|
|
||||||
const double norm = sum(w);
|
const double norm = sum(w);
|
||||||
obj += strength*norm;
|
obj += strength*norm;
|
||||||
nuclear_norm_part += strength*norm/C;
|
nuclear_norm_part += strength*norm/C;
|
||||||
|
|
||||||
w = w>0;
|
f = u*trans(v);
|
||||||
f = u*diagm(w)*trans(v);
|
|
||||||
|
|
||||||
set_rowm(grad, range(idx, idx+size-1)) = matrix_cast<double>(strength*reshape_to_column_vector(f));
|
set_rowm(grad, range(idx, idx+size-1)) = matrix_cast<double>(strength*reshape_to_column_vector(f));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue