Code covered by the BSD License  

Highlights from
Pointers and subscript pointers

Pointers and subscript pointers

by

 

29 Jan 2011 (Updated )

Pointers implemented in Matlab

hnum
% The hnum class creates a handle for a data class (double, int8, etc)
% Using an hnum class to store data allows you to keep one instance of your
% data, and pass pointers to it. Some operations use less memory, but some
% use more that operating on value classes.
% Here's an example:
% x = hnum(1:3);   % Returns [1 2 3]
% y = x;           % Creates a pointer to x, but doesn't copy it
% x+1;             % No need for "x = x+1" since there is only one x.            
% y                % Returns [2 3 4], since it points to x.
%
% The hnum Class has two modes for subscripting. Change the mode using:
% subtype(x,'pointer')   % default type is 'normal'
% Now subscripting returns a subscripthandle class
% x = hnum(2:6,'pointer');  % [2 3 4 5 6]
% a = x(3:4);               % [4 5]
% a(:) = 100;               % changes all elements of 'x' that 'a' points to.
% x                         % [2 3 100 100 6]
%
% Use let(x,newval) to change the value of x, rather than x = newval.
%
% Pointer subscripting can cause problems if an hnum object is replaced without
% deleting it first. A subscript handle object will cause the hnum object
% to remain in memory, and will still point to it. So use delete(obj) before
% replacing it. Deleting a pointerhandle that points to a hidden hnum
% object will delete the hidden hnum object as long as no other pointerhandles
% point to it.
%
% subscripthandle objects behave similarly to hnum objects, but return value
% objects rather than handle objects.
% subscripthandle objects can be further subscripted and return a new 
% subscripthandle by using newsub = sub(subh, d1, d2, d3).
% ex: newsub = sub(subh, ':','1:end-1') is the same as x(:,1:end-1).
% subscripting subscripthandle objects using logical arrays is not available.
% 
% Most functions(100+) were overloaded from the double type. These were
% generated using a limited macro that only used functions with one or two
% inputs and one output. This prevents using extra inputs in those functions
% and didn't catch all of them. See the comments at the bottom of the function
% for a list of what wasn't implemented.


classdef hnum < handle
  properties
    val    %this is the actual data
    stype  %type of subscripting used on this object
  end
  methods
    %% constructor and display
    function obj = hnum(newval,type)
      if nargin > 0
        if iscell(newval)
          error('??? Use a cell of hnum objects, not an hnum object of a cell.')
        elseif isstruct(newval)
          error('??? Use a struct of hnum objects, not an hnum object of a struct.')
        else
          obj.val = newval; %store the value
        end
      else
        obj.val = []; %default to a double
      end
      if nargin == 2
        if strcmp(type,'pointer')
          obj.stype = 'pointer'; %pointer subscripting
        else
          obj.stype = 'normal'; %pointer subscripting
        end
      end
    end
    % DISP
    function disp(obj)
      disp(obj.val)
    end
    %% Special operations specifically for hnum classes
    function x = subtype(obj,type)
      % subtype(obj,type)  %changes type
      % x = subtype()      %returns a string
      % changes the type of subscripting the object uses
      % can be either 'normal' or 'pointer'
      % normal subscripting returns a portion of the obj.val that the subscription points to.
      % pointer subscripting returns a subscripthandle class which points to part of the object
      if nargin < 2 % 0 or 1
        % display type or return it
        if nargout == 0
          disp(obj.stype)
        else
          x = obj.stype;
        end
      elseif nargin == 2
        if strcmp(type,'normal')
          obj.stype = 'normal';
        if nargout == 1
          x = obj.stype;
        end
        elseif strcmp(type,'pointer')
        if nargout == 1
          x = obj.stype;
        end
          obj.stype = 'pointer';
        else
          disp('Invalid type. Must be ''pointer'' or ''normal''.')
        end
      end
    end
    function obj = let(obj,newval)
      obj.val = newval;
    end
    %% Type Conversions
    function str = char(obj)
      str = num2str(obj.val);
    end
    function obj = double(obj)
      obj.val = double(obj.val);
    end
    function obj = single(obj)
      obj.val = single(obj.val);
    end
    function obj = uint8(obj)
      obj.val = uint8(obj.val);
    end
    function obj = uint16(obj)
      obj.val = uint16(obj.val);
    end
    function obj = uint32(obj)
      obj.val = uint32(obj.val);
    end
    function obj = uint64(obj)
      obj.val = uint64(obj.val);
    end
    function obj = int8(obj)
      obj.val = int8(obj.val);
    end
    function obj = int16(obj)
      obj.val = uint16(obj.val);
    end
    function obj = int32(obj)
      obj.val = int32(obj.val);
    end
    function obj = int64(obj)
      obj.val = uint64(obj.val);
    end
    %% Concatenations
    function obj = horzcat(obj,obj2)
      if strcmp(class(obj2),'hnum') %obj2 is also an hnum
        obj.val = builtin('horzcat',obj.val, obj2.val);
      else
        obj.val = builtin('horzcat',obj.val, obj2);
      end
    end
    function obj = vertcat(obj,obj2)
      if strcmp(class(obj2),'hnum') %obj2 is also an hnum
        obj.val = builtin('vertcat',obj.val, obj2.val);
      else
        obj.val = builtin('vertcat',obj.val, obj2);
      end
    end
    %% Regular Operations
    %Plus  (y+x)
    function obj = plus(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('plus',obj.val, obj2.val);
      else
        obj.val = builtin('plus',obj.val, obj2);
      end
    end
    %Minus   (y-x)
    function obj = minus(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('minus',obj.val, obj2.val);
      else
        obj.val = builtin('minus',obj.val, obj2);
      end
    end
    %Unary Minus   (-x)
    function obj = uminus(obj)
      obj.val = builtin('uminus',obj.val);
    end
    %Unary Plus   (+x)
    function obj = uplus(obj)
      obj.val = builtin('uplus',obj.val);
    end
    %Times   (y.*x)
    function obj = times(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('times',obj.val, obj2.val);
      else
        obj.val = builtin('times',obj.val, obj2);
      end
    end
    %Mtimes   (y*x)
    function obj = mtimes(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('times',obj.val, obj2.val);
      else
        obj.val = builtin('times',obj.val, obj2);
      end
    end
    %Rdivide (x./y)
    function obj = rdivide(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('rdivide',obj.val, obj2.val);
      else
        obj.val = builtin('rdivide',obj.val, obj2);
      end
    end
    %Ldivide (x.\y)
    function obj = ldivide(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('ldivide',obj.val, obj2.val);
      else
        obj.val = builtin('ldivide',obj.val, obj2);
      end
    end
    %mrdivide (x/y)
    function obj = mrdivide(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('mrdivide',obj.val, obj2.val);
      else
        obj.val = builtin('mrdivide',obj.val, obj2);
      end
    end
    %mldivide (x\y)
    function obj = mldivide(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('mldivide',obj.val, obj2.val);
      else
        obj.val = builtin('mldivide',obj.val, obj2);
      end
    end
    %Power (x^y)
    function obj = power(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('power',obj.val, obj2.val);
      else
        obj.val = builtin('power',obj.val, obj2);
      end
    end
    %Mpower (x.^y)
    function obj = mpower(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('mpower',obj.val, obj2.val);
      else
        obj.val = builtin('mpower',obj.val, obj2);
      end
    end
    %Transpose
    function obj = transpose(obj)
      obj.val = builtin('transpose',obj.val);
    end
    %Ctranspose
    function obj = ctranspose(obj)
      obj.val = builtin('ctranspose',obj.val);
    end
    %% Compare  (x==y, x >=y, etc)
    % less than
    function obj = lt(obj1,obj2)
      if strcmp(class(obj2),'hnum')
        obj = builtin('lt',obj1.val, obj2.val);
      else
        obj = builtin('lt',obj1.val, obj2);
      end
    end
    % greater than
    function obj = gt(obj1,obj2)
      if strcmp(class(obj2),'hnum')
        obj = builtin('gt',obj1.val, obj2.val);
      else
        obj = builtin('gt',obj1.val, obj2);
      end
    end
    % less than or equal to
    function obj = le(obj1,obj2)
      if strcmp(class(obj2),'hnum')
        obj = builtin('le',obj1.val, obj2.val);
      else
        obj = builtin('le',obj1.val, obj2);
      end
    end
    % greater than or equal to
    function obj = ge(obj1,obj2)
      if strcmp(class(obj2),'hnum')
        obj = builtin('ge',obj1.val, obj2.val);
      else
        obj = builtin('ge',obj1.val, obj2);
      end
    end
    % not equal
    function obj = ne(obj1,obj2)
      if strcmp(class(obj2),'hnum')
        obj = builtin('ne',obj1.val, obj2.val);
      else
        obj = builtin('ne',obj1.val, obj2);
      end
    end
    % equal to
    function obj = eq(obj1,obj2)
      if strcmp(class(obj2),'hnum')
        obj = builtin('eq',obj1.val, obj2.val);
      else
        obj = builtin('eq',obj1.val, obj2);
      end
    end
    % logical and
    function obj = and(obj1,obj2)
      if strcmp(class(obj2),'hnum')
        obj = builtin('and',obj1.val, obj2.val);
      else
        obj = builtin('and',obj1.val, obj2);
      end
    end
    % logical or
    function obj = or(obj1,obj2)
      if strcmp(class(obj2),'hnum')
        obj = builtin('or',obj1.val, obj2.val);
      else
        obj = builtin('or',obj1.val, obj2);
      end
    end
    % logical not
    function obj = not(obj1)
      obj = builtin('not',obj1.val);
    end
    %% Subscripts, reshape
    function obj = subsref(obj1,s,x) %#ok<INUSD>
      if strcmp(s.type,'()')
        %this case handles using a(x) where a is a matrix and x is an hnum
        if strcmp(obj1.stype,'normal') %normal subscripting
          obj = builtin('subsref',obj1.val,s);
        else
          % creates a subscripthandle object which points to this part of the array
          if nargin == 3
            % subscripthandle class calls this with an extra input to
            % return the actual data instead of making an extra subscripthandle
            obj = builtin('subsref',obj1.val,s);
          else
            obj = subscripthandle(obj1,s);
          end
        end
      elseif strcmp(s.type,'.')
        %this case handles calling an hnum object as a struct x.val
        %should always return the data as a regular value class
        obj = obj1.val; %there is only one property
      else %calling it as a cell?
        obj = []; 
      end
    end    
    % subasgn  x(s) = y
    function obj = subsasgn(obj,s,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('subsasgn',obj.val, s, obj2.val);
      else
        obj.val = builtin('subsasgn',obj.val, s, obj2);
      end
    end
    
    % subsindex
    % this is called with A(x) where A is some matrix, and x is an hnum class
    function indx = subsindex(obj)
      indx = obj.val-1;
    end
    
    %end -- in the context of x(1:end)
    % copied from http://www.mathworks.com/help/techdoc/matlab_oop/br09eqz.html#br6r04f
    function ind = end(obj,k,n)
      szd = size(obj.val);
      if k < n
        ind = szd(k);
      else
        ind = prod(szd(k:end));
      end
    end
    function obj = reshape(obj,varargin)
      if numel(varargin) == 0
        %% no extra inputs
        obj.val = builtin('reshape',obj.val);
      elseif numel(varargin) == 1
        %% 1 extra input
        a = varargin{1};
        obj.val = builtin('reshape',obj.val,a);
      elseif numel(varargin) == 2
        %% two extra inputs
        [a b] = varargin{:};
        obj.val = builtin('reshape',obj.val,a,b);
      elseif numel(varargin) == 3
        %% three
        [a b c] = varargin{:};
        obj.val = builtin('reshape',obj.val,a,b,c);
      elseif numel(varargin) == 4
        %% four
        [a b c d] = varargin{:};
        obj.val = builtin('reshape',obj.val,a,b,c,d);
      elseif numel(varargin) == 5
        %% five
        [a b c d e] = varargin{:};
        obj.val = builtin('reshape',obj.val,a,b,c,d,e);
      elseif numel(varargin) == 6
        %% six
        [a b c d e f] = varargin{:};
        obj.val = {builtin('reshape',obj.val,a,b,c,d,e,f)};
      end
    end
    %% Size, numel, length
    function [x,y,z] = size(obj)
      if nargout == 0
        disp(size(obj.val))
      elseif nargout == 1
        x = size(obj.val);
      elseif nargout == 2
        [x y] = size(obj.val);
      elseif nargout == 3
        [x y z] = size(obj.val);
      end
    end
    function x = numel(obj)
      x = numel(obj.val);
    end
    function x = length(obj)
      x = length(obj.val);
    end
    %% Operations (min, max, sin, etc)  ---Auto Generated
    % the following was automatically generated using:
    % buildoverloadfcns(methods(double(1)),'obj','obj.val','obj2','obj2.val',methods(hnum))
    % does not handle multiple outputs
    
    %buildoverloadfcns(a,'obj.val','obj','obj.val','obj2','obj2.val',b)
    % abs(obj)
    function obj = abs(obj)
      obj.val = builtin('abs',obj.val);
    end
    % accumarray(obj,obj2)
    function obj = accumarray(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('accumarray',obj.val,obj2.val);
      else
        obj.val = builtin('accumarray',obj.val,obj2);
      end
    end
    % acos(obj)
    function obj = acos(obj)
      obj.val = builtin('acos',obj.val);
    end
    % acosd(obj)
    function obj = acosd(obj)
      obj.val = builtin('acosd',obj.val);
    end
    % acosh(obj)
    function obj = acosh(obj)
      obj.val = builtin('acosh',obj.val);
    end
    % acot(obj)
    function obj = acot(obj)
      obj.val = builtin('acot',obj.val);
    end
    % acotd(obj)
    function obj = acotd(obj)
      obj.val = builtin('acotd',obj.val);
    end
    % acoth(obj)
    function obj = acoth(obj)
      obj.val = builtin('acoth',obj.val);
    end
    % acsc(obj)
    function obj = acsc(obj)
      obj.val = builtin('acsc',obj.val);
    end
    % acscd(obj)
    function obj = acscd(obj)
      obj.val = builtin('acscd',obj.val);
    end
    % acsch(obj)
    function obj = acsch(obj)
      obj.val = builtin('acsch',obj.val);
    end
    % all(obj)
    function obj = all(obj)
      obj.val = builtin('all',obj.val);
    end
    % amd(obj)
    function obj = amd(obj)
      obj.val = builtin('amd',obj.val);
    end
    % any(obj)
    function obj = any(obj)
      obj.val = builtin('any',obj.val);
    end
    % asec(obj)
    function obj = asec(obj)
      obj.val = builtin('asec',obj.val);
    end
    % asecd(obj)
    function obj = asecd(obj)
      obj.val = builtin('asecd',obj.val);
    end
    % asech(obj)
    function obj = asech(obj)
      obj.val = builtin('asech',obj.val);
    end
    % asin(obj)
    function obj = asin(obj)
      obj.val = builtin('asin',obj.val);
    end
    % asind(obj)
    function obj = asind(obj)
      obj.val = builtin('asind',obj.val);
    end
    % asinh(obj)
    function obj = asinh(obj)
      obj.val = builtin('asinh',obj.val);
    end
    % atan(obj)
    function obj = atan(obj)
      obj.val = builtin('atan',obj.val);
    end
    % atan2(obj,obj2)
    function obj = atan2(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('atan2',obj.val,obj2.val);
      else
        obj.val = builtin('atan2',obj.val,obj2);
      end
    end
    % atand(obj)
    function obj = atand(obj)
      obj.val = builtin('atand',obj.val);
    end
    % atanh(obj)
    function obj = atanh(obj)
      obj.val = builtin('atanh',obj.val);
    end
    % balance(obj)
    function obj = balance(obj)
      obj.val = builtin('balance',obj.val);
    end
    % bitand(obj,obj2)
    function obj = bitand(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('bitand',obj.val,obj2.val);
      else
        obj.val = builtin('bitand',obj.val,obj2);
      end
    end
    % bitcmp(obj,obj2)
    function obj = bitcmp(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('bitcmp',obj.val,obj2.val);
      else
        obj.val = builtin('bitcmp',obj.val,obj2);
      end
    end
    % bitget(obj,obj2)
    function obj = bitget(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('bitget',obj.val,obj2.val);
      else
        obj.val = builtin('bitget',obj.val,obj2);
      end
    end
    % bitor(obj,obj2)
    function obj = bitor(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('bitor',obj.val,obj2.val);
      else
        obj.val = builtin('bitor',obj.val,obj2);
      end
    end
    % bitset(obj,obj2)
    function obj = bitset(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('bitset',obj.val,obj2.val);
      else
        obj.val = builtin('bitset',obj.val,obj2);
      end
    end
    % bitshift(obj,obj2)
    function obj = bitshift(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('bitshift',obj.val,obj2.val);
      else
        obj.val = builtin('bitshift',obj.val,obj2);
      end
    end
    % bitxor(obj,obj2)
    function obj = bitxor(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('bitxor',obj.val,obj2.val);
      else
        obj.val = builtin('bitxor',obj.val,obj2);
      end
    end
    % ceil(obj)
    function obj = ceil(obj)
      obj.val = builtin('ceil',obj.val);
    end
    % chol(obj)
    function obj = chol(obj)
      obj.val = builtin('chol',obj.val);
    end
    % cholupdate(obj,obj2)
    function obj = cholupdate(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('cholupdate',obj.val,obj2.val);
      else
        obj.val = builtin('cholupdate',obj.val,obj2);
      end
    end
    % colon(obj,obj2)
    function obj = colon(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('colon',obj.val,obj2.val);
      else
        obj.val = builtin('colon',obj.val,obj2);
      end
    end
    % conj(obj)
    function obj = conj(obj)
      obj.val = builtin('conj',obj.val);
    end
    % conv2(obj,obj2)
    function obj = conv2(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('conv2',obj.val,obj2.val);
      else
        obj.val = builtin('conv2',obj.val,obj2);
      end
    end
    % cos(obj)
    function obj = cos(obj)
      obj.val = builtin('cos',obj.val);
    end
    % cosd(obj)
    function obj = cosd(obj)
      obj.val = builtin('cosd',obj.val);
    end
    % cosh(obj)
    function obj = cosh(obj)
      obj.val = builtin('cosh',obj.val);
    end
    % cot(obj)
    function obj = cot(obj)
      obj.val = builtin('cot',obj.val);
    end
    % cotd(obj)
    function obj = cotd(obj)
      obj.val = builtin('cotd',obj.val);
    end
    % coth(obj)
    function obj = coth(obj)
      obj.val = builtin('coth',obj.val);
    end
    % csc(obj)
    function obj = csc(obj)
      obj.val = builtin('csc',obj.val);
    end
    % cscd(obj)
    function obj = cscd(obj)
      obj.val = builtin('cscd',obj.val);
    end
    % csch(obj)
    function obj = csch(obj)
      obj.val = builtin('csch',obj.val);
    end
    % cumprod(obj)
    function obj = cumprod(obj)
      obj.val = builtin('cumprod',obj.val);
    end
    % cumsum(obj)
    function obj = cumsum(obj)
      obj.val = builtin('cumsum',obj.val);
    end
    % det(obj)
    function obj = det(obj)
      obj.val = builtin('det',obj.val);
    end
    % diag(obj)
    function obj = diag(obj)
      obj.val = builtin('diag',obj.val);
    end
    % diff(obj)
    function obj = diff(obj)
      obj.val = builtin('diff',obj.val);
    end
    % dmperm(obj)
    function obj = dmperm(obj)
      obj.val = builtin('dmperm',obj.val);
    end
    % eig(obj)
    function obj = eig(obj)
      obj.val = builtin('eig',obj.val);
    end
    % eps(obj)
    function obj = eps(obj)
      obj.val = builtin('eps',obj.val);
    end
    % erf(obj)
    function obj = erf(obj)
      obj.val = builtin('erf',obj.val);
    end
    % erfc(obj)
    function obj = erfc(obj)
      obj.val = builtin('erfc',obj.val);
    end
    % erfcinv(obj)
    function obj = erfcinv(obj)
      obj.val = builtin('erfcinv',obj.val);
    end
    % erfcx(obj)
    function obj = erfcx(obj)
      obj.val = builtin('erfcx',obj.val);
    end
    % erfinv(obj)
    function obj = erfinv(obj)
      obj.val = builtin('erfinv',obj.val);
    end
    % exp(obj)
    function obj = exp(obj)
      obj.val = builtin('exp',obj.val);
    end
    % fft(obj)
    function obj = fft(obj)
      obj.val = builtin('fft',obj.val);
    end
    % fftn(obj)
    function obj = fftn(obj)
      obj.val = builtin('fftn',obj.val);
    end
    % find(obj)
    function obj = find(obj)
      obj.val = builtin('find',obj.val);
    end
    % fix(obj)
    function obj = fix(obj)
      obj.val = builtin('fix',obj.val);
    end
    % floor(obj)
    function obj = floor(obj)
      obj.val = builtin('floor',obj.val);
    end
    % full(obj)
    function obj = full(obj)
      obj.val = builtin('full',obj.val);
    end
    % gamma(obj)
    function obj = gamma(obj)
      obj.val = builtin('gamma',obj.val);
    end
    % gammainc(obj,obj2)
    function obj = gammainc(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('gammainc',obj.val,obj2.val);
      else
        obj.val = builtin('gammainc',obj.val,obj2);
      end
    end
    % gammaincinv(obj,obj2)
    function obj = gammaincinv(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('gammaincinv',obj.val,obj2.val);
      else
        obj.val = builtin('gammaincinv',obj.val,obj2);
      end
    end
    % gammaln(obj)
    function obj = gammaln(obj)
      obj.val = builtin('gammaln',obj.val);
    end
    % hess(obj)
    function obj = hess(obj)
      obj.val = builtin('hess',obj.val);
    end
    % hypot(obj,obj2)
    function obj = hypot(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('hypot',obj.val,obj2.val);
      else
        obj.val = builtin('hypot',obj.val,obj2);
      end
    end
    % ifft(obj)
    function obj = ifft(obj)
      obj.val = builtin('ifft',obj.val);
    end
    % ifftn(obj)
    function obj = ifftn(obj)
      obj.val = builtin('ifftn',obj.val);
    end
    % imag(obj)
    function obj = imag(obj)
      obj.val = builtin('imag',obj.val);
    end
    % inv(obj)
    function obj = inv(obj)
      obj.val = builtin('inv',obj.val);
    end
    % isfinite(obj)
    function obj = isfinite(obj)
      obj.val = builtin('isfinite',obj.val);
    end
    % isinf(obj)
    function obj = isinf(obj)
      obj.val = builtin('isinf',obj.val);
    end
    % isnan(obj)
    function obj = isnan(obj)
      obj.val = builtin('isnan',obj.val);
    end
    % issorted(obj)
    function obj = issorted(obj)
      obj.val = builtin('issorted',obj.val);
    end
    % jit_breakpoint(obj)
    function obj = jit_breakpoint(obj)
      obj.val = builtin('jit_breakpoint',obj.val);
    end
    % ldl(obj)
    function obj = ldl(obj)
      obj.val = builtin('ldl',obj.val);
    end
    % linsolve(obj,obj2)
    function obj = linsolve(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('linsolve',obj.val,obj2.val);
      else
        obj.val = builtin('linsolve',obj.val,obj2);
      end
    end
    % log(obj)
    function obj = log(obj)
      obj.val = builtin('log',obj.val);
    end
    % log2(obj)
    function obj = log2(obj)
      obj.val = builtin('log2',obj.val);
    end
    % lu(obj)
    function obj = lu(obj)
      obj.val = builtin('lu',obj.val);
    end
    % max(obj)
    function obj = max(obj)
      obj.val = builtin('max',obj.val);
    end
    % min(obj)
    function obj = min(obj)
      obj.val = builtin('min',obj.val);
    end
    % mod(obj,obj2)
    function obj = mod(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('mod',obj.val,obj2.val);
      else
        obj.val = builtin('mod',obj.val,obj2);
      end
    end
    % nnz(obj)
    function obj = nnz(obj)
      obj.val = builtin('nnz',obj.val);
    end
    % nonzeros(obj)
    function obj = nonzeros(obj)
      obj.val = builtin('nonzeros',obj.val);
    end
    % norm(obj)
    function obj = norm(obj)
      obj.val = builtin('norm',obj.val);
    end
    % nzmax(obj)
    function obj = nzmax(obj)
      obj.val = builtin('nzmax',obj.val);
    end
    % ordeig(obj)
    function obj = ordeig(obj)
      obj.val = builtin('ordeig',obj.val);
    end
    % pow2(obj)
    function obj = pow2(obj)
      obj.val = builtin('pow2',obj.val);
    end
    % prod(obj)
    function obj = prod(obj)
      obj.val = builtin('prod',obj.val);
    end
    % qr(obj)
    function obj = qr(obj)
      obj.val = builtin('qr',obj.val);
    end
    % qz(obj,obj2)
    function obj = qz(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('qz',obj.val,obj2.val);
      else
        obj.val = builtin('qz',obj.val,obj2);
      end
    end
    % rcond(obj)
    function obj = rcond(obj)
      obj.val = builtin('rcond',obj.val);
    end
    % real(obj)
    function obj = real(obj)
      obj.val = builtin('real',obj.val);
    end
    % reallog(obj)
    function obj = reallog(obj)
      obj.val = builtin('reallog',obj.val);
    end
    % realpow(obj,obj2)
    function obj = realpow(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('realpow',obj.val,obj2.val);
      else
        obj.val = builtin('realpow',obj.val,obj2);
      end
    end
    % realsqrt(obj)
    function obj = realsqrt(obj)
      obj.val = builtin('realsqrt',obj.val);
    end
    % rem(obj,obj2)
    function obj = rem(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('rem',obj.val,obj2.val);
      else
        obj.val = builtin('rem',obj.val,obj2);
      end
    end
    % round(obj)
    function obj = round(obj)
      obj.val = builtin('round',obj.val);
    end
    % schur(obj)
    function obj = schur(obj)
      obj.val = builtin('schur',obj.val);
    end
    % sec(obj)
    function obj = sec(obj)
      obj.val = builtin('sec',obj.val);
    end
    % secd(obj)
    function obj = secd(obj)
      obj.val = builtin('secd',obj.val);
    end
    % sech(obj)
    function obj = sech(obj)
      obj.val = builtin('sech',obj.val);
    end
    % sign(obj)
    function obj = sign(obj)
      obj.val = builtin('sign',obj.val);
    end
    % sin(obj)
    function obj = sin(obj)
      obj.val = builtin('sin',obj.val);
    end
    % sind(obj)
    function obj = sind(obj)
      obj.val = builtin('sind',obj.val);
    end
    % sinh(obj)
    function obj = sinh(obj)
      obj.val = builtin('sinh',obj.val);
    end
    % sort(obj)
    function obj = sort(obj)
      obj.val = builtin('sort',obj.val);
    end
    % sortrowsc(obj,obj2)
    function obj = sortrowsc(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('sortrowsc',obj.val,obj2.val);
      else
        obj.val = builtin('sortrowsc',obj.val,obj2);
      end
    end
    % sparse(obj)
    function obj = sparse(obj)
      obj.val = builtin('sparse',obj.val);
    end
    % speye(obj)
    function obj = speye(obj)
      obj.val = builtin('speye',obj.val);
    end
    % sqrt(obj)
    function obj = sqrt(obj)
      obj.val = builtin('sqrt',obj.val);
    end
    % sum(obj)
    function obj = sum(obj)
      obj.val = builtin('sum',obj.val);
    end
    % superiorfloat(obj)
    function obj = superiorfloat(obj)
      obj.val = builtin('superiorfloat',obj.val);
    end
    % svd(obj)
    function obj = svd(obj)
      obj.val = builtin('svd',obj.val);
    end
    % symrcm(obj)
    function obj = symrcm(obj)
      obj.val = builtin('symrcm',obj.val);
    end
    % tan(obj)
    function obj = tan(obj)
      obj.val = builtin('tan',obj.val);
    end
    % tand(obj)
    function obj = tand(obj)
      obj.val = builtin('tand',obj.val);
    end
    % tanh(obj)
    function obj = tanh(obj)
      obj.val = builtin('tanh',obj.val);
    end
    % tril(obj)
    function obj = tril(obj)
      obj.val = builtin('tril',obj.val);
    end
    % triu(obj)
    function obj = triu(obj)
      obj.val = builtin('triu',obj.val);
    end
    % xor(obj,obj2)
    function obj = xor(obj,obj2)
      if strcmp(class(obj2),'hnum')
        obj.val = builtin('xor',obj.val,obj2.val);
      else
        obj.val = builtin('xor',obj.val,obj2);
      end
    end
    % betainc  Is Unused
    % betaincinv  Is Unused
    % bsxfun  Is Unused
    % cholinc  Is Unused
    % display  Is Unused
    % exist  Is Unused
    % fftw  Is Unused
    % filter  Is Unused
    % ilu  Is Unused
    % ltitr  Is Unused
    % luinc  Is Unused
    % mimofr  Is Unused
    % ordqz  Is Unused
    % ordschur  Is Unused
    % permute  Is Unused
    % qrupdate  Is Unused
    % reshape  Is Unused
    % sparsfun  Is Unused
    % trmginput  Is Unused
    %% Testing
    % this function is wacky and i don't like it. It causes the workspace
    %browser to fail in strange ways.
%     function y = class(x)
%       assignin('caller', 'a', @MySubfun);
%       evalin('caller', 'a(who)')
%       function MySubfun(in)
%         disp(in)
%       end
%       y = builtin('class',x);
%     end


      
  end
end

Contact us