486 references to Assert
Microsoft.ML.Core (486)
CommandLine\CharCursor.cs (1)
63
Contracts.
Assert
(0 <= dich && dich <= _ichLim - _ichCur);
CommandLine\CmdLexer.cs (20)
80
Contracts.
Assert
(bldr.Length > ichDst);
120
Contracts.
Assert
(_curs.ChCur == '{');
133
Contracts.
Assert
(count > 0);
168
Contracts.
Assert
(_curs.ChCur == '{');
182
Contracts.
Assert
(count >= 0);
215
Contracts.
Assert
(_curs.ChCur == '\\');
216
Contracts.
Assert
(_escapes);
249
Contracts.
Assert
(_curs.ChCur == '"');
330
Contracts.
Assert
(0 <= ich && ich <= sb.Length);
346
Contracts.
Assert
(curs.IchCur > 0 || lex.Error);
381
Contracts.
Assert
(f == (force || curs.ChCur == '{'));
390
Contracts.
Assert
(v.StartsWith("{") && v.EndsWith("}"));
396
Contracts.
Assert
(!lex.Error);
397
Contracts.
Assert
(curs.Eof);
398
Contracts.
Assert
(str == res.ToString());
415
Contracts.
Assert
(ich == sb.Length);
420
Contracts.
Assert
(ich == sb.Length);
444
Contracts.
Assert
(curs.IchCur > 0 || lex.Error);
517
Contracts.
Assert
(ichMin >= 0 && _str[ichMin] == '\\');
518
Contracts.
Assert
(ichMin == 0 || _str[ichMin - 1] != '\\');
CommandLine\CmdParser.cs (27)
454
Contracts.
Assert
(1 < firstNonUpper && firstNonUpper <= name.Length);
496
Contracts.
Assert
(!isDefault || nicks == null);
529
Contracts.
Assert
(def.ShortNames == null);
531
Contracts.
Assert
(map.ContainsKey(name) && map[name] == def);
568
Contracts.
Assert
(!string.IsNullOrEmpty(str));
622
Contracts.
Assert
(arg != info.ArgDef);
623
Contracts.
Assert
(0 <= arg.Index && arg.Index < info.Args.Length);
1037
Contracts.
Assert
(ich < curs.IchCur || curs.Eof);
1090
Contracts.
Assert
(ich < curs.IchCur || curs.Eof);
1205
Contracts.
Assert
(Args.Where(a => a.Index == argument.Index).Count() == 1);
1269
Contracts.
Assert
(isGeneric);
1271
Contracts.
Assert
(Utils.Size(genArgs) == 1);
1341
Contracts.
Assert
(argDef == null || argDef.Index == -1);
1344
Contracts.
Assert
(map.Count >= args.Length);
1345
Contracts.
Assert
(args.Select((arg, index) => arg.Index == index).All(b => b));
1421
Contracts.
Assert
(index >= -1);
1422
Contracts.
Assert
(!string.IsNullOrWhiteSpace(name));
1440
Contracts.
Assert
(!IsDefault || Utils.Size(ShortNames) == 0);
1681
Contracts.
Assert
(string.IsNullOrEmpty(tag) || tag.StartsWith("[") && tag.EndsWith("]"));
1708
Contracts.
Assert
(newValue is string || newValue == null);
1709
Contracts.
Assert
((string)newValue != "");
1891
Contracts.
Assert
(type.IsEnum);
1928
Contracts.
Assert
(success);
1965
Contracts.
Assert
(value == null || value is Array);
2032
Contracts.
Assert
(IsKeyValuePair(type));
2060
Contracts.
Assert
(value == null || value is Array);
2237
Contracts.
Assert
(false);
ComponentModel\ComponentCatalog.cs (6)
209
Contracts.
Assert
(getter == null || Utils.Size(attr.CtorTypes) == 0);
231
Contracts.
Assert
(ArgType == null || CtorTypes.Length > 0 && CtorTypes[0] == ArgType);
236
Contracts.
Assert
(Utils.Size(ctorArgs) == CtorTypes.Length + ((RequireEnvironment) ? 1 : 0));
241
Contracts.
Assert
(Utils.Size(ctorArgs) == 0);
704
Contracts.
Assert
(getter == null && ctor == null && create == null);
1067
Contracts.
Assert
(false);
Data\ColumnTypeExtensions.cs (2)
135
Contracts.
Assert
(false);
165
Contracts.
Assert
(false);
Data\IFileHandle.cs (3)
99
Contracts.
Assert
(_streams != null);
133
Contracts.
Assert
(IsDisposed);
166
Contracts.
Assert
(_streamWrite == null);
Data\ModelHeader.cs (10)
109
Contracts.
Assert
(Marshal.SizeOf(typeof(ModelHeader)) == Size);
152
Contracts.
Assert
(ns.Id == cv);
157
Contracts.
Assert
(cv == pool.Count);
160
Contracts.
Assert
(header.FpStringChars == header.FpStringTable + header.CbStringTable);
167
Contracts.
Assert
(offset == header.CbStringChars);
210
Contracts.
Assert
(res);
218
Contracts.
Assert
(writer.FpCur() == fpMin + ModelHeader.Size);
503
Contracts.
Assert
(reader.FpCur() == header.FpStringTable + fpMin);
506
Contracts.
Assert
(cstr < int.MaxValue);
508
Contracts.
Assert
(header.FpStringChars == reader.FpCur() - fpMin);
Data\ModelLoading.cs (2)
169
Contracts.
Assert
(fp == ent.Stream.Position);
220
Contracts.
Assert
(fp == ctx.FpMin);
Data\ProgressReporter.cs (7)
115
Contracts.
Assert
(_subChannels.Count == 0);
133
Contracts.
Assert
(entry.Header.MetricNames.Count == 0 && entry.Header.UnitNames.Count == 0);
161
Contracts.
Assert
(res == channel);
233
Contracts.
Assert
(entry.Header.MetricNames.Count == 0 && entry.Header.UnitNames.Count == 0);
242
Contracts.
Assert
(level >= 0);
352
Contracts.
Assert
(index > 0);
537
Contracts.
Assert
(0 <= index && index < Progress.Length);
Data\ReadOnlyMemoryUtils.cs (1)
231
Contracts.
Assert
(j == span.Length);
Data\RoleMappedSchema.cs (3)
166
Contracts.
Assert
(Utils.Size(kvp.Value) > 0);
316
Contracts.
Assert
(Utils.Size(kvp.Value) > 0);
426
Contracts.
Assert
(schema.Schema == data.Schema);
Environment\ConsoleEnvironment.cs (10)
74
Contracts.
Assert
(msg.Kind == ChannelMessageKind.Error);
126
Contracts.
Assert
(commChannel.Verbose);
230
Contracts.
Assert
(ev.Kind == ProgressReporting.ProgressEvent.EventKind.Progress);
231
Contracts.
Assert
(!ev.ProgressEntry.IsCheckpoint);
399
Contracts.
Assert
(source == this || source is Host);
406
Contracts.
Assert
(parent is ConsoleEnvironment);
414
Contracts.
Assert
(parent is ConsoleEnvironment);
457
Contracts.
Assert
(_root._consoleWriter == _newConsoleWriter);
474
Contracts.
Assert
(parent is Host);
482
Contracts.
Assert
(parent is Host);
Environment\HostEnvironmentBase.cs (2)
479
Contracts.
Assert
(dispatcher is Dispatcher<TMessage>);
564
Contracts.
Assert
(ichMin <= ichLim);
Utilities\BigArray.cs (45)
104
Contracts.
Assert
(longBlockCount <= Utils.ArrayMaxSize);
107
Contracts.
Assert
(blockCount > 0);
108
Contracts.
Assert
(0 < lastBlockSize && lastBlockSize <= BlockSize);
157
Contracts.
Assert
(index == lim);
192
Contracts.
Assert
(index == lim);
226
Contracts.
Assert
(0 < longBlockCount && longBlockCount <= Utils.ArrayMaxSize);
229
Contracts.
Assert
(0 < newLastBlockLength && newLastBlockLength <= BlockSize);
243
Contracts.
Assert
(curBlockCount > 0);
246
Contracts.
Assert
(0 < curLastBlockLength && curLastBlockLength <= curLastBlockSize && curLastBlockSize <= BlockSize);
251
Contracts.
Assert
(newBlockCount < curBlockCount || (newBlockCount == curBlockCount && newLastBlockLength < curLastBlockLength));
259
Contracts.
Assert
(curBlockCount == newBlockCount);
264
Contracts.
Assert
(_length == curLastBlockLength);
265
Contracts.
Assert
(newLength == newLastBlockLength);
266
Contracts.
Assert
(_entries.Length == 1);
279
Contracts.
Assert
(newBlockCount > curBlockCount);
296
Contracts.
Assert
(Utils.Size(_entries) == 0);
303
Contracts.
Assert
(maMax >= 0);
304
Contracts.
Assert
(0 < miLim && miLim <= Utils.Size(_entries[maMax]));
331
Contracts.
Assert
(maMin <= maMax); // Could be violated if length == 0, but we already took care of this.
337
Contracts.
Assert
(miLim - miMin == src.Length);
343
Contracts.
Assert
((BlockSize - miMin) + miLim == src.Length);
347
Contracts.
Assert
(_entries[maMax] == null);
362
Contracts.
Assert
(_entries[major] == null);
366
Contracts.
Assert
(srcSoFar < src.Length);
369
Contracts.
Assert
(src.Length - srcSoFar == miLim);
370
Contracts.
Assert
(_entries[maMax] == null);
389
Contracts.
Assert
(0 <= length && length <= dst.Length);
390
Contracts.
Assert
(idx <= Length && length <= Length - idx);
401
Contracts.
Assert
(maMin <= maMax); // Could happen if length == 0, but we already took care of this.
406
Contracts.
Assert
(miLim - miMin == length);
407
Contracts.
Assert
(miLim <= Utils.Size(_entries[maMax]));
412
Contracts.
Assert
((BlockSize - miMin) + miLim == length);
413
Contracts.
Assert
(BlockSize <= Utils.Size(_entries[maMin]));
415
Contracts.
Assert
(miLim <= Utils.Size(_entries[maMax]));
423
Contracts.
Assert
(BlockSize <= Utils.Size(_entries[maMin]));
429
Contracts.
Assert
(BlockSize <= Utils.Size(_entries[major]));
432
Contracts.
Assert
(dstSoFar < length);
435
Contracts.
Assert
(length - dstSoFar == miLim);
436
Contracts.
Assert
(miLim <= Utils.Size(_entries[maMax]));
444
Contracts.
Assert
(min >= 0);
445
Contracts.
Assert
((min >> BlockSizeBits) < int.MaxValue);
448
Contracts.
Assert
((long)major * BlockSize + minor == min);
453
Contracts.
Assert
(lim > 0);
454
Contracts.
Assert
((lim >> BlockSizeBits) < int.MaxValue);
458
Contracts.
Assert
((long)major * BlockSize + minor == lim + 1);
Utilities\BinFinder.cs (52)
51
Contracts.
Assert
(numValues == values.Count + 1);
88
Contracts.
Assert
(_path[0] == 0);
89
Contracts.
Assert
(_path[CountBins] == CountValues);
99
Contracts.
Assert
(bounds[i] > bounds[i - 1]);
129
Contracts.
Assert
(numValues == values.Count + 1);
166
Contracts.
Assert
(_path[0] == 0);
167
Contracts.
Assert
(_path[CountBins] == CountValues);
177
Contracts.
Assert
(bounds[i] > bounds[i - 1]);
203
Contracts.
Assert
(path[0] == 0);
204
Contracts.
Assert
(path[CountBins] == CountValues);
216
Contracts.
Assert
(a < b);
232
Contracts.
Assert
(a <= ave);
245
Contracts.
Assert
(a < b);
261
Contracts.
Assert
(a <= ave);
331
Contracts.
Assert
(CountValues > CountBins);
332
Contracts.
Assert
(counts.Count == CountValues);
333
Contracts.
Assert
(path.Length >= CountBins + 1);
362
Contracts.
Assert
(_segmentHeap.Count > 0);
373
Contracts.
Assert
(_path[0] == 0);
374
Contracts.
Assert
(_path[CountBins] == CountValues);
391
Contracts.
Assert
(min < max - 1);
434
Contracts.
Assert
(0 <= min && min < split && split < max && max <= CountValues);
442
Contracts.
Assert
(a < b && b < c);
482
Contracts.
Assert
(peg.Energy >= 0);
491
Contracts.
Assert
(pegs[peg.Index] == peg);
492
Contracts.
Assert
(_path[peg.Index] != peg.Split);
495
Contracts.
Assert
(FindSplitPosition(out e, _path[peg.Index - 1], _path[peg.Index + 1], peg.Index) == peg.Split);
520
Contracts.
Assert
(peg.Energy >= 0);
568
Contracts.
Assert
(CountBins >= 2);
569
Contracts.
Assert
(CountValues > CountBins);
570
Contracts.
Assert
(counts.Count == CountValues);
571
Contracts.
Assert
(path.Length >= CountBins + 1);
611
Contracts.
Assert
(bestWorst < EnergyType.MaxValue);
618
Contracts.
Assert
(ccol > 0);
628
Contracts.
Assert
(ivBase == (row - 1) * width);
651
Contracts.
Assert
(eBest > 0);
652
Contracts.
Assert
(0 <= colBest && colBest <= col);
665
Contracts.
Assert
(bestWorst < EnergyType.MaxValue);
673
Contracts.
Assert
(ccol > 0);
677
Contracts.
Assert
(height + width == CountValues);
691
Contracts.
Assert
(eBest < EnergyType.MaxValue);
695
Contracts.
Assert
(height == CountBins - 1);
704
Contracts.
Assert
(ivBase == (row - 1) * width);
706
Contracts.
Assert
(_pathInfo[ivBase + colBest] <= colBest);
709
Contracts.
Assert
(_path[row] < _path[row + 1]);
711
Contracts.
Assert
(ivBase == 0);
716
Contracts.
Assert
(d > 0);
730
Contracts.
Assert
(0 <= row && row < CountBins - 1);
731
Contracts.
Assert
(0 <= col && col <= _cskip);
738
Contracts.
Assert
(0 < cbin && cbin <= span);
744
Contracts.
Assert
(0 <= rem && rem < cbin);
755
Contracts.
Assert
(worst >= best);
Utilities\DoubleParser.cs (34)
94
Contracts.
Assert
(res != Result.Empty || ((flags & OptionFlags.EmptyAsNaN) == 0 && value == 0) || Single.IsNaN(value));
104
Contracts.
Assert
(res != Result.Empty || ((flags & OptionFlags.EmptyAsNaN) == 0 && value == 0) || Double.IsNaN(value));
340
Contracts.
Assert
((long)(Double)(long)num == (long)num);
360
Contracts.
Assert
((long)(Double)(long)num == (long)num);
390
Contracts.
Assert
((num & TopTwoBits) != 0);
391
Contracts.
Assert
((mul & TopBit) != 0);
413
Contracts.
Assert
((num & TopThreeBits) != 0);
433
Contracts.
Assert
(exp > 0);
440
Contracts.
Assert
(exp < 0);
444
Contracts.
Assert
(e2 > 0);
448
Contracts.
Assert
(0 < e2 && e2 < 0x7FF);
551
Contracts.
Assert
(0 <= ich && ich <= span.Length);
552
Contracts.
Assert
(!neg);
553
Contracts.
Assert
(num == 0);
554
Contracts.
Assert
(exp == 0);
616
Contracts.
Assert
(i < span.Length);
632
Contracts.
Assert
(i < span.Length);
638
Contracts.
Assert
(i < span.Length);
639
Contracts.
Assert
(span[i] == decimalMarker);
651
Contracts.
Assert
(i < span.Length);
664
Contracts.
Assert
(i < span.Length);
686
Contracts.
Assert
(i < span.Length);
705
Contracts.
Assert
(Math.Abs(exp) < int.MaxValue);
711
Contracts.
Assert
(i < span.Length);
934
Contracts.
Assert
(_mpe10Man.Length == _mpe10e2.Length);
935
Contracts.
Assert
(_mpne10Man.Length == _mpne10ne2.Length);
939
Contracts.
Assert
(_mpe10Dbl.Length <= _mpe10Man.Length);
952
Contracts.
Assert
(0 < e2 && e2 < 0x7FF);
957
Contracts.
Assert
((Single)_mpe10Dbl[_mpe10Dbl.Length - 1] == Single.PositiveInfinity);
958
Contracts.
Assert
((Single)_mpe10Dbl[_mpe10Dbl.Length - 2] < Single.PositiveInfinity);
963
Contracts.
Assert
(_mpne10Dbl.Length <= _mpne10Man.Length);
968
Contracts.
Assert
(0 < e2 && e2 < 0x7FF);
975
Contracts.
Assert
((Single)(_mpne10Dbl[_mpne10Dbl.Length - 1] * two64) == 0);
976
Contracts.
Assert
((Single)(_mpne10Dbl[_mpne10Dbl.Length - 2] * two64) > 0);
Utilities\FixedSizeQueue.cs (4)
33
Contracts.
Assert
(Utils.Size(_array) >= 0);
34
Contracts.
Assert
(0 <= _startIndex && _startIndex < _array.Length);
35
Contracts.
Assert
(0 <= _count && _count <= _array.Length);
70
Contracts.
Assert
(index >= 0 && index < _count);
Utilities\FloatUtils.cs (8)
65
Contracts.
Assert
(-RawExpZero < exp && exp < RawExpInf - RawExpZero);
109
Contracts.
Assert
((man & ~MaskMan) == MaskMan + 1);
132
Contracts.
Assert
(Bits != 0);
159
Contracts.
Assert
(IsFiniteNormal());
258
Contracts.
Assert
(-RawExpZero < exp && exp < RawExpInf - RawExpZero);
302
Contracts.
Assert
((man & ~MaskMan) == MaskMan + 1);
325
Contracts.
Assert
(Bits != 0);
352
Contracts.
Assert
(IsFiniteNormal());
Utilities\HashArray.cs (14)
65
Contracts.
Assert
(0 <= _ct && _ct <= Utils.Size(_entries));
69
Contracts.
Assert
(Utils.Size(_rgit) >= _ct || Utils.Size(_rgit) == HashHelpers.MaxPrimeArrayLength);
79
Contracts.
Assert
(0 <= it && it < _ct);
91
Contracts.
Assert
(val != null);
100
Contracts.
Assert
(0 <= iit && iit < _rgit.Length);
104
Contracts.
Assert
(it < _ct);
110
Contracts.
Assert
(it == -1);
150
Contracts.
Assert
(val != null);
151
Contracts.
Assert
(0 <= iit && iit < _rgit.Length);
155
Contracts.
Assert
(_ct == Utils.Size(_entries));
158
Contracts.
Assert
(_ct < _entries.Length);
178
Contracts.
Assert
(size >= _rgit.Length);
262
Contracts.
Assert
(0 <= min && min < MaxPrimeArrayLength);
271
Contracts.
Assert
(false);
Utilities\Hashing.cs (23)
128
Contracts.
Assert
((bits & 0x7) == 0);
129
Contracts.
Assert
((uint)bits <= 24);
130
Contracts.
Assert
(cur <= 0x00FFFFFF);
145
Contracts.
Assert
(ch <= 0xFFFF);
158
Contracts.
Assert
((bits & 0x7) == 0);
159
Contracts.
Assert
((uint)bits <= 24);
160
Contracts.
Assert
(cur <= 0x00FFFFFF);
194
Contracts.
Assert
((bits & 0x7) == 0);
195
Contracts.
Assert
((uint)bits <= 24);
196
Contracts.
Assert
(cur <= 0x00FFFFFF);
218
Contracts.
Assert
(ch <= 0x10FFFF);
232
Contracts.
Assert
((bits & 0x7) == 0);
233
Contracts.
Assert
((uint)bits <= 24);
234
Contracts.
Assert
(cur <= 0x00FFFFFF);
277
Contracts.
Assert
(0 <= ichMin && ichMin <= ichLim && ichLim <= Utils.Size(data));
289
Contracts.
Assert
((bits & 0x7) == 0);
290
Contracts.
Assert
((uint)bits <= 24);
291
Contracts.
Assert
(cur <= 0x00FFFFFF);
306
Contracts.
Assert
(ch <= 0xFFFF);
319
Contracts.
Assert
((bits & 0x7) == 0);
320
Contracts.
Assert
((uint)bits <= 24);
321
Contracts.
Assert
(cur <= 0x00FFFFFF);
335
Contracts.
Assert
(hash == MurmurHash(seed, data.ToString().AsSpan()));
Utilities\Heap.cs (16)
47
Contracts.
Assert
(capacity >= 0);
61
Contracts.
Assert
(_rgv.Count > 0);
103
Contracts.
Assert
(iv > 0);
170
Contracts.
Assert
(0 < iv && iv < _rgv.Count);
181
Contracts.
Assert
(0 < iv && iv < _rgv.Count);
208
Contracts.
Assert
(!InHeap);
247
Contracts.
Assert
(capacity >= 0);
261
Contracts.
Assert
(_rgv.Count > 0);
303
Contracts.
Assert
(iv > 0);
311
Contracts.
Assert
(0 < index && index < _rgv.Count);
313
Contracts.
Assert
(result._index == index);
368
Contracts.
Assert
(!vRes.InHeap);
404
Contracts.
Assert
(ivSrc >= ivDst);
416
Contracts.
Assert
(!item.InHeap);
421
Contracts.
Assert
(0 < iv && iv < _rgv.Count);
432
Contracts.
Assert
(0 < iv && iv < _rgv.Count);
Utilities\HybridMemoryStream.cs (5)
100
Contracts.
Assert
(_memStream == null);
101
Contracts.
Assert
(_overflowStream == null);
105
Contracts.
Assert
((_memStream == null) != (_overflowStream == null));
106
Contracts.
Assert
(Length <= _overflowBoundary || _overflowStream != null);
159
Contracts.
Assert
(_memStream != null);
Utilities\LruCache.cs (2)
47
Contracts.
Assert
(key.GetHashCode() == node.Value.Key.GetHashCode());
64
Contracts.
Assert
(!_cache.ContainsKey(key));
Utilities\MathUtils.cs (27)
285
Contracts.
Assert
(FloatUtils.IsFinite(maxRelErr));
286
Contracts.
Assert
(FloatUtils.IsFinite(maxAbsError));
407
Contracts.
Assert
(tol > 0);
436
Contracts.
Assert
(0 <= x && x <= 1);
437
Contracts.
Assert
(0 < a);
438
Contracts.
Assert
(0 < b);
545
Contracts.
Assert
(0 <= exp && exp < ExpInf);
572
Contracts.
Assert
(0 <= n && n < ExpInf);
574
Contracts.
Assert
(0 <= f && f < 1);
578
Contracts.
Assert
(1 <= r && r < float.PositiveInfinity);
611
Contracts.
Assert
(0 <= n && n < ExpInf);
613
Contracts.
Assert
(0 <= f && f < 1);
617
Contracts.
Assert
(1 <= r && r < float.PositiveInfinity);
651
Contracts.
Assert
(0 <= n && n < ExpInf);
653
Contracts.
Assert
(0 <= f && f < 1);
657
Contracts.
Assert
(1 <= r && r < float.PositiveInfinity);
673
Contracts.
Assert
(src.Length == dst.Length);
682
Contracts.
Assert
(src.Length == dst.Length);
683
Contracts.
Assert
(0 <= start && start <= end && end <= src.Length);
705
Contracts.
Assert
(count >= 0);
706
Contracts.
Assert
(Utils.Size(src) >= count);
718
Contracts.
Assert
(ivMin <= ivLim);
724
Contracts.
Assert
(!float.IsNaN(src[ivLim - 1]));
738
Contracts.
Assert
(len > 0);
739
Contracts.
Assert
(aIdx >= 0 && aIdx <= a.Length - len);
740
Contracts.
Assert
(bIdx >= 0 && bIdx <= b.Length - len);
754
Contracts.
Assert
(-1 - epsilon <= similarity && similarity <= 1 + epsilon);
Utilities\MatrixTransposeOps.cs (4)
34
Contracts.
Assert
(src.Length <= m * n);
35
Contracts.
Assert
(dst.Length <= m * n);
85
Contracts.
Assert
(src.Length <= m * n);
86
Contracts.
Assert
(dst.Length <= m * n);
Utilities\MinWaiter.cs (4)
80
Contracts.
Assert
(_waiters.Count < _maxWaiters);
85
Contracts.
Assert
(_waiters.Count < _maxWaiters);
103
Contracts.
Assert
(_waiters.Count < _maxWaiters);
106
Contracts.
Assert
(_maxWaiters == 0 || _waiters.Count < _maxWaiters);
Utilities\NormStr.cs (15)
31
Contracts.
Assert
(id >= 0 || id == -1 && str.IsEmpty);
73
Contracts.
Assert
(_rgins.Length == _mask + 1);
74
Contracts.
Assert
(Utils.IsPowerOfTwo(_mask + 1));
76
Contracts.
Assert
(0 <= _cns && _cns <= Utils.Size(_rgns));
77
Contracts.
Assert
(Utils.Size(_rgns) == Utils.Size(_rgmeta));
114
Contracts.
Assert
(ins == -1);
137
Contracts.
Assert
(ins == -1);
196
Contracts.
Assert
(ins == -1);
214
Contracts.
Assert
(str.Length >= 0);
215
Contracts.
Assert
(Hashing.HashString(str.Span) == hash);
219
Contracts.
Assert
(_cns == 0);
225
Contracts.
Assert
(_cns == _rgns.Length);
230
Contracts.
Assert
(_cns < _rgns.Length);
253
Contracts.
Assert
(0 <= ins && ins < _cns);
254
Contracts.
Assert
(_rgns[ins].Id == ins);
Utilities\Random.cs (3)
182
Contracts.
Assert
(n >= 0);
193
Contracts.
Assert
(0 <= res && (res < maxValue || res == 0));
233
Contracts.
Assert
((uint)(float)u == u);
Utilities\ReservoirSampler.cs (1)
195
Contracts.
Assert
(_counts.Contains(0));
Utilities\Stream.cs (19)
149
Contracts.
Assert
(0 <= count && count <= Utils.Size(values));
162
Contracts.
Assert
(0 <= count && count <= Utils.Size(values));
191
Contracts.
Assert
(cv < count);
195
Contracts.
Assert
(cv == count);
479
Contracts.
Assert
(size >= 0);
509
Contracts.
Assert
(0 <= start && start < array.Length);
510
Contracts.
Assert
(0 < count && count <= array.Length - start);
543
Contracts.
Assert
(size >= 0);
580
Contracts.
Assert
(size >= 0);
617
Contracts.
Assert
(size >= 0);
655
Contracts.
Assert
(size >= 0);
693
Contracts.
Assert
(size >= 0);
731
Contracts.
Assert
(size >= 0);
775
Contracts.
Assert
(size >= 0);
813
Contracts.
Assert
(size >= 0);
838
Contracts.
Assert
(bytesToRead >= 0);
839
Contracts.
Assert
(destinationSizeInBytes >= bytesToRead);
840
Contracts.
Assert
(destination != null);
859
Contracts.
Assert
(offset == bytesToRead);
Utilities\SubsetStream.cs (1)
44
Contracts.
Assert
(!length.HasValue || length >= 0);
Utilities\SupervisedBinFinder.cs (16)
69
Contracts.
Assert
(_valueCount == labels.Count);
88
Contracts.
Assert
(pair.Value >= curValue);
104
Contracts.
Assert
(curIndex == _distinctValueCount - 1);
107
Contracts.
Assert
(Utils.Size(boundaries) > 0);
109
Contracts.
Assert
(boundaries[boundaries.Length - 1] == _distinctValueCount);
122
Contracts.
Assert
(FloatUtils.IsFinite(result[i]));
147
Contracts.
Assert
(_valueCount == labels.Count);
166
Contracts.
Assert
(pair.Value >= curValue);
182
Contracts.
Assert
(curIndex == _distinctValueCount - 1);
185
Contracts.
Assert
(Utils.Size(boundaries) > 0);
187
Contracts.
Assert
(boundaries[boundaries.Length - 1] == _distinctValueCount);
200
Contracts.
Assert
(FloatUtils.IsFinite(result[i]));
214
Contracts.
Assert
(result[i] > result[i - 1]);
223
Contracts.
Assert
(result[i] > result[i - 1]);
259
Contracts.
Assert
(leftCount + rightCount == totalCount);
337
Contracts.
Assert
(intervals.Count == 0);
Utilities\TextReaderStream.cs (10)
111
Contracts.
Assert
(_buffCur == _buffLim);
116
Contracts.
Assert
(_lineCur == 0);
125
Contracts.
Assert
(_lineCur <= _line.Length);
134
Contracts.
Assert
(0 < _buffLim && _buffLim <= _buff.Length);
141
Contracts.
Assert
(charCount > 0);
143
Contracts.
Assert
(0 < _buffLim && _buffLim <= _buff.Length);
145
Contracts.
Assert
(_lineCur <= _line.Length);
159
Contracts.
Assert
(_buffCur < _buffLim);
161
Contracts.
Assert
(toCopy > 0);
174
Contracts.
Assert
(_eof || _buffCur < _buffLim);
Utilities\Tree.cs (2)
146
Contracts.
Assert
(!ContainsKey(key));
164
Contracts.
Assert
(_parent._children.ContainsKey(Key));
Utilities\Utils.cs (55)
189
Contracts.
Assert
(src != null);
190
Contracts.
Assert
(!count.HasValue || (0 <= count && count <= src.Count));
191
Contracts.
Assert
(src.Count <= dst.Length);
288
Contracts.
Assert
(0 <= min && min <= lim && lim <= input.Count);
295
Contracts.
Assert
(minCur <= mid && mid < limCur);
302
Contracts.
Assert
(min <= minCur && minCur <= limCur && limCur <= lim);
303
Contracts.
Assert
(minCur == min || input[minCur - 1] < value);
304
Contracts.
Assert
(limCur == lim || input[limCur] >= value);
306
Contracts.
Assert
(min <= minCur && minCur == limCur && limCur <= lim);
307
Contracts.
Assert
(minCur == min || input[minCur - 1] < value);
308
Contracts.
Assert
(limCur == lim || input[limCur] >= value);
322
Contracts.
Assert
(0 <= min && min <= lim && lim <= input.Count);
323
Contracts.
Assert
(!float.IsNaN(value));
330
Contracts.
Assert
(minCur <= mid && mid < limCur);
331
Contracts.
Assert
(!float.IsNaN(input[mid]));
338
Contracts.
Assert
(min <= minCur && minCur <= limCur && limCur <= lim);
339
Contracts.
Assert
(minCur == min || input[minCur - 1] < value);
340
Contracts.
Assert
(limCur == lim || input[limCur] >= value);
342
Contracts.
Assert
(min <= minCur && minCur == limCur && limCur <= lim);
343
Contracts.
Assert
(minCur == min || input[minCur - 1] < value);
344
Contracts.
Assert
(limCur == lim || input[limCur] >= value);
358
Contracts.
Assert
(0 <= min && min <= lim && lim <= input.Length);
359
Contracts.
Assert
(!Double.IsNaN(value));
366
Contracts.
Assert
(minCur <= mid && mid < limCur);
367
Contracts.
Assert
(!Double.IsNaN(input[mid]));
374
Contracts.
Assert
(min <= minCur && minCur <= limCur && limCur <= lim);
375
Contracts.
Assert
(minCur == min || input[minCur - 1] < value);
376
Contracts.
Assert
(limCur == lim || input[limCur] >= value);
378
Contracts.
Assert
(min <= minCur && minCur == limCur && limCur <= lim);
379
Contracts.
Assert
(minCur == min || input[minCur - 1] < value);
380
Contracts.
Assert
(limCur == lim || input[limCur] >= value);
393
Contracts.
Assert
(0 <= min && min <= lim && lim <= input.Length);
400
Contracts.
Assert
(minCur <= mid && mid < limCur);
407
Contracts.
Assert
(min <= minCur && minCur <= limCur && limCur <= lim);
408
Contracts.
Assert
(minCur == min || !func(input[minCur - 1]));
409
Contracts.
Assert
(limCur == lim || func(input[limCur]));
411
Contracts.
Assert
(min <= minCur && minCur == limCur && limCur <= lim);
412
Contracts.
Assert
(minCur == min || !func(input[minCur - 1]));
413
Contracts.
Assert
(limCur == lim || func(input[limCur]));
426
Contracts.
Assert
(0 <= min && min <= lim && lim <= input.Length);
433
Contracts.
Assert
(minCur <= mid && mid < limCur);
440
Contracts.
Assert
(min <= minCur && minCur <= limCur && limCur <= lim);
441
Contracts.
Assert
(minCur == min || !func(input[minCur - 1], value));
442
Contracts.
Assert
(limCur == lim || func(input[limCur], value));
444
Contracts.
Assert
(min <= minCur && minCur == limCur && limCur <= lim);
445
Contracts.
Assert
(minCur == min || !func(input[minCur - 1], value));
446
Contracts.
Assert
(limCur == lim || func(input[limCur], value));
453
Contracts.
Assert
(size >= 0);
463
Contracts.
Assert
(0 <= lim && lim <= a.Length);
494
Contracts.
Assert
(0 <= j && j < perm.Length);
495
Contracts.
Assert
(res[j] == 0 && (j != perm[0] || i == 0));
504
Contracts.
Assert
(size >= 0);
890
Contracts.
Assert
(nn != null || size == 0);
891
Contracts.
Assert
((ne == null) == (size == 0));
910
Contracts.
Assert
(ivDst == size);
Utilities\VBufferUtils.cs (32)
370
Contracts.
Assert
(i <= indices[i]);
423
Contracts.
Assert
(lim < denseCount);
480
Contracts.
Assert
(j < sparseCount);
487
Contracts.
Assert
(j == sparseCount);
718
Contracts.
Assert
(newCount > 0);
719
Contracts.
Assert
(0 < srcValues.Length && srcValues.Length <= newCount);
720
Contracts.
Assert
(0 < dstValues.Length && dstValues.Length <= newCount);
779
Contracts.
Assert
(sIndex >= 0);
780
Contracts.
Assert
(sIndex == dIndex);
797
Contracts.
Assert
(srcValues.Length == dstValues.Length);
800
Contracts.
Assert
(srcIndices[i] == dstIndices[i]);
806
Contracts.
Assert
(newCount > srcValues.Length);
830
Contracts.
Assert
(dstIndices[dI] == sIndex);
850
Contracts.
Assert
(srcIndices[sI] == bIndex);
867
Contracts.
Assert
(false);
894
Contracts.
Assert
(srcValues.Length == src.Length);
904
Contracts.
Assert
(0 < count && count < length);
938
Contracts.
Assert
(srcValues.Length == src.Length);
947
Contracts.
Assert
(0 < count && count < length);
988
Contracts.
Assert
(dstCount > 0);
1032
Contracts.
Assert
(srcValues.Length > 0);
1053
Contracts.
Assert
(0 < resCount && resCount <= length);
1054
Contracts.
Assert
(resCount <= srcValues.Length + dstCount);
1055
Contracts.
Assert
(srcValues.Length <= resCount);
1056
Contracts.
Assert
(dstCount <= resCount);
1077
Contracts.
Assert
(i < length || j < length);
1107
Contracts.
Assert
(ii == srcValues.Length && jj == dstCount);
1108
Contracts.
Assert
(i == length && j == length);
1264
Contracts.
Assert
(aIndices[aI] == bIndices[aI]);
1275
Contracts.
Assert
(aIndices[aI] >= bIndices[bI]);
1290
Contracts.
Assert
(bIndices[bI] >= aIndices[aI]);
1323
Contracts.
Assert
(index == bIndices[bI]);