Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/web-klick.de/dsh/50_dev2017/1310__algorithms/Julia/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : /var/www/web-klick.de/dsh/50_dev2017/1310__algorithms/Julia/mapreduce.jl

const PAIRWISE_SUM_BLOCKSIZE = 1024

macro code_mapsum(AN, sumf)
    _sumf = symbol("_$(sumf)")
    _seqsumf = symbol("_seq$(sumf)")
    _cassumf = symbol("_cas$(sumf)")
    
    h = codegen_helper(AN)
    ti1 = h.term(:i1)
    ti2 = h.term(:i2)
    
    quote
	global $(_seqsumf)
	function $(_seqsumf)(ifirst::Int, ilast::Int, $(h.aparams...))
	    i1 = ifirst
	    i2 = ifirst + 1
            
	    s1 = $(ti1)
	    if ilast > ifirst
		@inbounds s2 = $(ti2)
                
		i1 += 2
		i2 += 2
		while i1 < ilast
		    @inbounds s1 += $(ti1)
		    @inbounds s2 += $(ti2)
		    i1 += 2
		    i2 += 2
		end
                
		if i1 == ilast
		    @inbounds s1 += $(ti1)
		end
                
		return s1 + s2
	    else
		return s1
	    end			
	end
        
	global $(_cassumf)
	function $(_cassumf)(ifirst::Int, ilast::Int, $(h.aparams...))
	    if ifirst + PAIRWISE_SUM_BLOCKSIZE >= ilast
		$(_seqsumf)(ifirst, ilast, $(h.args...))
	    else
		imid = ifirst + ((ilast - ifirst) >> 1)
		$(_cassumf)(ifirst, imid, $(h.args...)) + $(_cassumf)(imid+1, ilast, $(h.args...))
	    end
	end
        
	global $(_sumf)
	$(_sumf)(ifirst::Int, ilast::Int, $(h.aparams...)) = $(_cassumf)(ifirst, ilast, $(h.args...))

	global $(sumf)
	$(sumf)($(h.aparams...)) = $(_cassumf)(1, $(h.inputlen), $(h.args...))
    end
end

@code_mapsum 1 sum
@code_mapsum 2 sum
@code_mapsum 3 sum
@code_mapsum (-2) sumfdiff

sumsqdiff(a::ArrOrNum, b::ArrOrNum) = sumfdiff(Abs2Fun(), a, b)

sumsq(a::NumericArray) = sum(Abs2Fun(), a)
meansq(a::NumericArray) = mean(Abs2Fun(), a)

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net