internal GatheredChildStats() { const int ALIGNMENT = 64; // For AVX efficiency N = new SpanAligned <float>(MCTSScoreCalcVector.MAX_CHILDREN, ALIGNMENT); InFlight = new SpanAligned <float>(MCTSScoreCalcVector.MAX_CHILDREN, ALIGNMENT); P = new SpanAligned <float>(MCTSScoreCalcVector.MAX_CHILDREN, ALIGNMENT); W = new SpanAligned <float>(MCTSScoreCalcVector.MAX_CHILDREN, ALIGNMENT); }
/// <summary> /// Returns a copy of the input matrix which is reblocked /// </summary> /// <param name="aIn"></param> /// <param name="aOut"></param> /// <param name="numIn"></param> /// <param name="numOutAtATime"></param> /// <param name="numInAtATime"></param> public static float[] BlockedMatrix(float[] aIn, int numOut, int numIn, int numOutAtATime, int numInAtATime) { Span <float> aOut = new SpanAligned <float>(aIn.Length, 128).Span; int dstIndex = 0; for (int i = 0; i < numOut; i += numOutAtATime) { for (int j = 0; j < numIn; j += numInAtATime) { for (int ofsI = 0; ofsI < numOutAtATime; ofsI++) { for (int ofsJ = 0; ofsJ < numInAtATime; ofsJ++) { int col = i + ofsI; int row = j + ofsJ; aOut[dstIndex++] = aIn[col * numIn + row]; } } } } return(aOut.ToArray()); }