%%
%%dspsvd.tlc-GenerateutilityfunctionforSignalProcessingBlocksetSVDblock
%%
%%Copyright1995-2014TheMathWorks,Inc.
%%
 
%if EXISTS("_DSPSVDLIB_") == 0
%assign _DSPSVDLIB_ = 1
 
%if !EXISTS("dspSvdUtils")
  %createrecord dspSvdUtils { ...
  NothingMacro 1}
%endif
 
%include FEVAL("matlabroot")+"/rtw/c/tlc/lib/dspendian.tlc"
%include FEVAL("matlabroot")+"/rtw/c/tlc/lib/dspisfinite.tlc"
%include FEVAL("matlabroot")+"/rtw/c/tlc/lib/dspgivensrot.tlc"
%include FEVAL("matlabroot")+"/rtw/c/tlc/lib/dspsvdrot.tlc"
                    
%function dspSvd(dTypeIdentifier, xptr, n, p, sptr, eptr, workptr, uptr, vptr, wantv) Output
  %%
  %if (dTypeIdentifier == "D")
    %assign utilityName = "DSP_SVD_D"
    %assign ptrLabel = "real_T*"
    %assign valLabel = "real_T"
  %elseif (dTypeIdentifier == "Z")
    %assign utilityName = "DSP_SVD_Z"
    %assign ptrLabel = "creal_T*"
    %assign valLabel = "creal_T"
  %elseif (dTypeIdentifier == "R")
    %assign utilityName = "DSP_SVD_R"
    %assign ptrLabel = "real32_T*"
    %assign valLabel = "real32_T"
  %elseif (dTypeIdentifier == "C")
    %assign utilityName = "DSP_SVD_C"
    %assign ptrLabel = "creal32_T*"
    %assign valLabel = "creal32_T"
  %else
    %exit Simulink Coder Fatal: Invalid SVD data type string.
  %endif
   
  %% Register utility name in the Shared Code Manager
  %if SLibInBlockScope()
    %assign block = SLibGetCurrentBlock()
  %else
    %assign block = ""
  %endif
  %assign utilityName = SLibRegisterSharedUtility(block, utilityName)
   
  %<FcnTrackSharedUtilHeaderFileUsage(utilityName + ".h", TLC_FALSE)>
  %<utilityName>(%<xptr>, %<n>, %<p>, %<sptr>, %<eptr>, %<workptr>, %<uptr>, %<vptr>, %<wantv>)
  %%
  %if !(ISFIELD(dspSvdUtils, utilityName))
    %%
    %<LibPushEmptyStackSharedUtils()>/
    %%
    %% register utility
    %%
    %assign tmpRet = SETFIELD(dspSvdUtils,utilityName,1)
    %%
    %% utility function prototype
    %%
    %assign funcDeclarationRoot = "int_T %<utilityName>(%<ptrLabel> x, /
                                                       int_T n, /
                                                       int_T p, /
                                                       %<ptrLabel> s, /
                                                       %<ptrLabel> e, /
                                                       %<ptrLabel> work, /
                                                       %<ptrLabel> u, /
                                                       %<ptrLabel> v, /
                                                       int_T wantv)"
    %openfile funcProto
      %<funcDeclarationRoot>;
    %closefile funcProto
    %%
    %% utility definition
    %%
    %openfile utilityDef
    #include "dsp_rt.h"
    %<funcDeclarationRoot>
      %if ((dTypeIdentifier == "D") || (dTypeIdentifier == "R"))
        %include FEVAL("matlabroot")+"/rtw/c/tlc/lib/dspsvdrealalgo.tlc"
      %else
        %include FEVAL("matlabroot")+"/rtw/c/tlc/lib/dspsvdcplxalgo.tlc"
      %endif
    %closefile utilityDef
    %%
    %<SLibAddMathIncludeForUtilsSourceCode(utilityDef)>
    %<SLibDumpUtilsSourceCodeAndCacheFunctionPrototype(utilityName,funcProto,utilityDef)>/
    %%
    %assign GSUStackBuf = LibPopStackSharedUtilsIncludes()
    %%
  %endif
  
%endfunction %% svd_real
 
%endif %% _DSPSVDLIB_
  
%%[EOF]dspsvd.tlc