@stdlib/esm
Version:
ES module distribution for Stdlib, a standard library for JavaScript and Node.js.
3 lines • 1.75 kB
JavaScript
// This file is a part of stdlib. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
import r from"./../../../utils/define-nonenumerable-read-only-property.js";import e from"./../../../math/base/assert/is-negative-zero.js";import f from"./../../../math/base/assert/is-nan.js";var o=e,t=f;function a(r,e,f,a,n,i){var s,u,m,l,v,p,d,b,j,y,c,h,g;if(r<=0||0===e)return f;if(e<0&&(a*=-1,i*=-1),i<0?(b=(1-r)*i,j=0):(b=0,j=(r-1)*i),p=b+i,a<0){for(v=0,u=(l=(1-r)*a)+a,g=1;g<r;g++)if(y=f[u],c=n[p],t(y)){for(m=u,d=p;m>v;)f[m]=f[m+a],n[d]=n[d+i],m+=a,d+=i;f[v]=y,n[j]=c}else{for(s=o(y),m=u-a,d=p-i;m<=l&&(!((h=f[m])<=y)||s&&h===y&&!1===o(h));)f[m+a]=h,n[d+i]=n[d],m-=a,d-=i;f[m+a]=y,n[d+i]=c,u+=a,p+=i}return f}for(v=(r-1)*a,u=(l=0)+a,g=1;g<r;g++)if(y=f[u],c=n[p],t(y)){for(m=u,d=p;m<v;)f[m]=f[m+a],n[d]=n[d+i],m+=a,d+=i;f[v]=y,n[j]=c}else{for(s=o(y),m=u-a,d=p-i;m>=l&&(!((h=f[m])<=y)||s&&h===y&&!1===o(h));)f[m+a]=h,n[d+i]=n[d],m-=a,d-=i;f[m+a]=y,n[d+i]=c,u+=a,p+=i}return f}var n=e,i=f;function s(r,e,f,o,t,a,s,u){var m,l,v,p,d,b,j,y,c,h,g,x,z;if(r<=0||0===e)return f;if(e<0&&(t-=(r-1)*(o*=-1),u-=(r-1)*(s*=-1)),d=(p=t)+(r-1)*o,l=p+o,c=(y=u)+(r-1)*s,b=y+s,o<0){for(z=1;z<r;z++)if(h=f[l],g=a[b],i(h)){for(v=l,j=b;v>d;)f[v]=f[v+o],a[j]=a[j+s],v+=o,j+=s;f[d]=h,a[c]=g}else{for(m=n(h),v=l-o,j=b-s;v<=p&&(!((x=f[v])<=h)||m&&x===h&&!1===n(x));)f[v+o]=x,a[j+s]=a[j],v-=o,j-=s;f[v+o]=h,a[j+s]=g,l+=o,b+=s}return f}for(z=1;z<r;z++)if(h=f[l],g=a[b],i(h)){for(v=l,j=b;v<d;)f[v]=f[v+o],a[j]=a[j+s],v+=o,j+=s;f[d]=h,a[c]=g}else{for(m=n(h),v=l-o,j=b-s;v>=p&&(!((x=f[v])<=h)||m&&x===h&&!1===n(x));)f[v+o]=x,a[j+s]=a[j],v-=o,j-=s;f[v+o]=h,a[j+s]=g,l+=o,b+=s}return f}var u=r,m=a,l=s;u(m,"ndarray",l);var v=m;export default v;
//# sourceMappingURL=gsort2ins.js.map