Ejemplo n.º 1
0
        public override float Product(int element1, int element2)
        {
            if (element1 >= problemElements.Length)
            {
                throw new IndexOutOfRangeException("element1 out of range");
            }

            if (element2 >= problemElements.Length)
            {
                throw new IndexOutOfRangeException("element2 out of range");
            }


            float prod = 0f;

            if (element1 == element2)
            {
                //all parts are the same
                //so we can prod set to 1 beceause exp(0)==1
                prod = 1f;
            }
            else
            {
                //when element1 and element2 are different we have to compute all parts
                float chi = ChiSquaredKernel.ChiSquareDist(problemElements[element1], problemElements[element2]);
                prod = (float)Math.Exp(-Gamma * chi);
            }
            return(prod);
        }
Ejemplo n.º 2
0
        public CuChi2EllKernel()
        {
            chiSquared = new ChiSquaredKernel();

            cudaModuleName = "KernelsEllpack.cubin";

            cudaProductKernelName = "chi2EllpackKernel";
        }
Ejemplo n.º 3
0
        public CuChiSquaredEllpackKernel2()
        {
           
            chiSquared = new ChiSquaredKernel();

            cudaModuleName = "KernelsEllpack.cubin";
            
            cudaProductKernelName = "chiSquaredEllpackKernel";
            
        }
Ejemplo n.º 4
0
        public override float Product(SparseVec element1, SparseVec element2)
        {
            float chi = ChiSquaredKernel.ChiSquareDist(element1, element2);

            return((float)Math.Exp(-Gamma * chi));
        }