Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions @surfacefunv/imag.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function fi = imag(f)
%Imag Imaginary part of a SURFACEFUNV

fi = f;
fi.components{1} = imag(f.components{1});
fi.components{2} = imag(f.components{2});
fi.components{3} = imag(f.components{3});

end

2 changes: 1 addition & 1 deletion @surfacefunv/norm.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
end

fc = f.components;
normF = sqrt(fc{1}.^2 + fc{2}.^2 + fc{3}.^2);
normF = sqrt(abs(fc{1}).^2 + abs(fc{2}).^2 + abs(fc{3}).^2);

end
10 changes: 10 additions & 0 deletions @surfacefunv/real.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function fr = real(f)
%REAL Real part of a SURFACEFUNV

fr = f;
fr.components{1} = real(f.components{1});
fr.components{2} = real(f.components{2});
fr.components{3} = real(f.components{3});

end

63 changes: 63 additions & 0 deletions @surfacefunv/times.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
function h = times(f, g)
%.* Pointwise multiply for SURFACEFUN(V).
% F.*G divides F by G, where F and G may be SURFACEFUN(V) objects or
% scalars.

% Empty check:
h = surfacefunv;
if ( isempty(f) || isempty(g) )
return
end

if ( isa(f, 'surfacefunv') && isa(g, 'surfacefunv') )
% Multiply two SURFACEFUNVs:
h.components{1} = f.components{1} .* g.components{1};
h.components{2} = f.components{2} .* g.components{2};
h.components{3} = f.components{3} .* g.components{3};
elseif ( isa(f, 'surfacefunv') && isa(g, 'surfacefun') )
% Multiply SURFACEFUNV F by SURFACEFUN G:
h.components{1} = f.components{1} .* g;
h.components{2} = f.components{2} .* g;
h.components{3} = f.components{3} .* g;
elseif ( isa(f, 'surfacefun') && isa(g, 'surfacefunv') )
% Multiply SURFACEFUN F by SURFACEFUNV G:
h.components{1} = f .* g.components{1};
h.components{2} = f .* g.components{2};
h.components{3} = f .* g.components{3};
elseif ( isa(f, 'surfacefunv') && isnumeric(g) )
if ( isscalar(g) )
% Multiply SURFACEFUNV F by scalar G:
h.components{1} = f.components{1} .* g;
h.components{2} = f.components{2} .* g;
h.components{3} = f.components{3} .* g;
elseif ( numel(g) == 3 )
% Multiply SURFACEFUNV F by vector G:
h.components{1} = f.components{1} .* g(1);
h.components{2} = f.components{2} .* g(2);
h.components{3} = f.components{3} .* g(3);
else
error('SURFACEFUNV:times:invalid', ...
'F and G must be surfacefunv objects, scalars, or constant vectors.');
end
elseif ( isnumeric(f) && isa(g, 'surfacefunv') )
if ( isscalar(f) )
% Multiply scalar F by SURFACEFUNV G:
h.components{1} = f .* g.components{1};
h.components{2} = f .* g.components{2};
h.components{3} = f .* g.components{3};
elseif ( numel(f) == 3 )
% Multiply vector F by SURFACEFUNV G:
h.components{1} = f(1) .* g.components{1};
h.components{2} = f(2) .* g.components{2};
h.components{3} = f(3) .* g.components{3};
else
error('SURFACEFUNV:times:invalid', ...
'F and G must be surfacefunv objects, scalars, or constant vectors.');
end
else
error('SURFACEFUNV:times:invalid', ...
'F and G must be surfacefunv objects, scalars, or constant vectors.');
end

end