コード例 #1
0
 static SimilarityBase()
 {
     for (int i = 0; i < 256; i++)
     {
         float floatNorm = SmallSingle.SByte315ToSingle((sbyte)i);
         NORM_TABLE[i] = 1.0f / (floatNorm * floatNorm);
     }
 }
コード例 #2
0
ファイル: SimilarityBase.cs プロジェクト: zhuthree/lucenenet
 private static float[] LoadNormTable() // LUCENENET: Avoid static constructors (see https://github.com/apache/lucenenet/pull/224#issuecomment-469284006)
 {
     float[] normTable = new float[256];
     for (int i = 0; i < 256; i++)
     {
         float floatNorm = SmallSingle.SByte315ToSingle((sbyte)i);
         normTable[i] = 1.0f / (floatNorm * floatNorm);
     }
     return(normTable);
 }
コード例 #3
0
 /// <summary>
 /// Encodes the length to a byte via <see cref="SmallSingle"/>. </summary>
 protected internal virtual byte EncodeNormValue(float boost, float length)
 {
     return(SmallSingle.SingleToByte315((boost / (float)Math.Sqrt(length))));
 }