Skip to content

Commit

Permalink
Allow linop_scale to do diagonal scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenbeckr committed Jul 20, 2016
1 parent eb46447 commit 98a031a
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions linop_scale.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
% Because this is simple scaling, the range will have the same size
% as the domain.
%
% July 2016, allowing OP(X) = scale .* X as well
%
% See also linop_compose

if ~isnumeric( scale ) && numel( scale ) ~= 1,
error( 'Argument must be a scalar.' );
if ~isnumeric( scale ) %&& numel( scale ) ~= 1,
error( 'Argument must be numeric.' );
elseif ~isreal( scale ),
error( 'Argument must be real.' );
end
Expand All @@ -36,7 +38,7 @@
error('bad type for size input');
end

if scale == 1,
if all(scale(:) == 1 ),
op = @linop_identity;
else
op = @(x,mode)linop_scale_impl( szCell, scale, x, mode );
Expand All @@ -46,16 +48,16 @@
if mode == 0,
y = sz;
else
y = scale * y;
y = scale .* y;
end

function OK = isSquare( sz )
OK = true;
for j = 1:length( sz{1} )
if sz{1}(j) ~= sz{2}(j)
OK = false; break;
end
end
% function OK = isSquare( sz )
% OK = true;
% for j = 1:length( sz{1} )
% if sz{1}(j) ~= sz{2}(j)
% OK = false; break;
% end
% end

% TFOCS v1.3 by Stephen Becker, Emmanuel Candes, and Michael Grant.
% Copyright 2013 California Institute of Technology and CVX Research.
Expand Down

0 comments on commit 98a031a

Please sign in to comment.