Beispiel #1
0
        public static string[] KernelHyperNames(IKernelFunctionWithParams kf)
        {
            int K      = kf.ThetaCount;
            var result = new string[K];

            for (int i = 0; i < K; i++)
            {
                result[i] = kf.IndexToName(i);
            }
            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// Helper method for building maps between container and containees
        /// </summary>
        protected void buildMaps()
        {
            clearMaps();

            int thetaSum = 0;

            thetaCount = new int[kernels.Count];
            for (int kx = 0; kx < kernels.Count; kx++)
            {
                IKernelFunctionWithParams k = kernels[kx];
                thetaCount[kx] = k.ThetaCount;
                thetaSum      += k.ThetaCount;
            }
            indexOfKernel   = new int[thetaSum];
            indexInKernel   = new int[thetaSum];
            thetaNames      = new string[thetaSum];
            thetaName2Index = new Dictionary <string, int>();

            int idxOf = 0;
            int idx   = 0;

            foreach (IKernelFunctionWithParams k in kernels)
            {
                for (int idxIn = 0; idxIn < k.ThetaCount; idxIn++, idx++)
                {
                    indexOfKernel[idx] = idxOf;
                    indexInKernel[idx] = idxIn;
                    string name = k.IndexToName(idxIn);
                    thetaNames[idx] = name;
                    // For index look-up, hoose a unique name in case there are clashes between two kernels
                    while (thetaName2Index.ContainsKey(name))
                    {
                        name += "_" + idxOf.ToString(CultureInfo.InvariantCulture);
                    }
                    thetaName2Index.Add(name, idx);
                }
                idxOf++;
            }
        }