Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync main branch to joss-paper branch #504

Merged
merged 1,205 commits into from
Dec 14, 2023
Merged
Changes from 1 commit
Commits
Show all changes
1205 commits
Select commit Hold shift + click to select a range
675e667
Started building an IndexSet class to efficiently store many indices.
mercere99 Jun 20, 2023
52fadaf
Added a _SetBit() helper function to IndexSet
mercere99 Jun 21, 2023
6fef73a
Cleaned up IndexSet conversion to bit representaiton; changed vec to …
mercere99 Jun 22, 2023
01ebeb6
more clean-up; add bibliogrpahy
emilydolson Jul 4, 2023
b949952
Actually commit
emilydolson Jul 4, 2023
e94f5e1
Actually commit
emilydolson Jul 4, 2023
e36d8c0
exlude bibliography from replace_tabs
emilydolson Jul 4, 2023
f016027
Fix formatting
emilydolson Jul 4, 2023
5d6b83b
Fix tidy
emilydolson Jul 4, 2023
ed30ec4
Fix doc erros
emilydolson Jul 4, 2023
3d708a8
Fix link
emilydolson Jul 4, 2023
062a130
Added _ToArray() conversion helper to IndexSet.
mercere99 Jun 24, 2023
f824733
Started building IndexRange and IndexRangeSet structs for IndexSet.
mercere99 Jun 24, 2023
1d2c126
Some initial functions in place for IndexRange and IndexRangeSet.
mercere99 Jun 25, 2023
2c13371
Added Has() to IndexRangeSet; improved docs.
mercere99 Jun 26, 2023
159dc02
Added IsConnected() and Append() to IndexRange.
mercere99 Jun 26, 2023
5d82fa9
Turned IndexRange into a class, added constructors & accessors; added…
mercere99 Jun 27, 2023
3bfe471
Added more boilerplate to IndexRange; fleshed out IndexRangeSet::Inse…
mercere99 Jun 28, 2023
107cb8b
Turned IndexRangeSet from struct to proper class.
mercere99 Jun 29, 2023
6b5fc5e
Added helper functions to clean up IndexRangeSet insertions.
mercere99 Jun 30, 2023
20989ce
Added a IndexRangeSet::Append() that will take a whole range as input.
mercere99 Jul 1, 2023
c0ef4df
Cleaned up IndexRangeSet::Append() so it takes any range extending pa…
mercere99 Jul 2, 2023
fd95ffa
Simplified _FindRange() helper function to be slower, but MUCH cleaner.
mercere99 Jul 3, 2023
4323a53
Addred IndexRange::Merge(); Cleaned up IndexRangeSet::Insert().
mercere99 Jul 4, 2023
6b122a5
Finished IndexRangeSet::Insert(IndexRange in); added IndexRange::Expa…
mercere99 Jul 5, 2023
1b0683e
Cleanup on IndexRangeSet
mercere99 Jul 6, 2023
6c102e1
Added IndexRangeSet::Remove()
mercere99 Jul 7, 2023
7598ee7
Started building IndexBits to handle bit representations
mercere99 Jul 8, 2023
f6414ac
Added first few functions defs to IndexBits
mercere99 Jul 9, 2023
5ca2918
Added a PushFront() member function to Bits.
mercere99 Jul 10, 2023
7ae4e48
Setup a few more functions in IndexBits
mercere99 Jul 11, 2023
03fbdba
Cleaned up IndexBits; added remaining functions.
mercere99 Jul 12, 2023
a9c2a30
Rebuilt _ToBits() and added _ReleaseUnion() in IndexSet.
mercere99 Jul 14, 2023
9028de6
Started building IndexSet::_ToRanges() helper
mercere99 Jul 15, 2023
6caca35
Cleanup on docs in DataMap.
mercere99 Jul 15, 2023
1281da6
Marked a couple of lines as maybe_unused in bitset_utils.
mercere99 Jul 15, 2023
5aafd69
Added Bits::FindZero() to pair with FindOne()
mercere99 Jul 16, 2023
d80a16e
Set up emp::Range with template parameter to indicate if inclusive of…
mercere99 Jul 17, 2023
1f9900b
Updated Range helpers to allow specification of end-point inclusivity.
mercere99 Jul 17, 2023
ebf1d82
Make Range distinguish integrals and non-integrals properly.
mercere99 Jul 17, 2023
26b0c30
Added tests for exclusive end-point ranges.
mercere99 Jul 17, 2023
b932d39
Added lots of tests of Range::Valid()
mercere99 Jul 17, 2023
cac7fae
Cleanup up Range::LimitValue(), renamed it to Clamp() (with alias), a…
mercere99 Jul 17, 2023
8553ab6
Cleaned up function names in Range tests.
mercere99 Jul 17, 2023
1ddea72
Added Range functionality from IndexRange.
mercere99 Jul 17, 2023
48d9936
Added lots more Range tests.
mercere99 Jul 17, 2023
fbc812b
More cleanup on emp::Range; added Append() method.
mercere99 Jul 18, 2023
5b1e949
Added initial verison of emp::RangeSet
mercere99 Jul 18, 2023
6fa14a9
Fixed Range::Merge()
mercere99 Jul 18, 2023
c7803bd
Lots of small fixes throughout RangeSet.
mercere99 Jul 18, 2023
78c47c2
Added RangeSet.cpp test file.
mercere99 Jul 18, 2023
f5c7dde
Fixed memory issue in RangeSet::Remove()
mercere99 Jul 18, 2023
ae2c9be
Added more RangeSet tests.
mercere99 Jul 18, 2023
a7a50ea
More cleanup and updates to RangeSet
mercere99 Jul 19, 2023
303aa28
Checks on number of ranges in a RangeSet
mercere99 Jul 19, 2023
18d4c54
Added functions to remove whole ranges of values from RangeSet.
mercere99 Jul 19, 2023
0ffb4fc
Added tools to Insert and Remove values by position to/from a vector.
mercere99 Jul 19, 2023
f149a52
Added Shift() and CalcOverlap() to emp::Range
mercere99 Jul 20, 2023
e71be0c
Added CalcOverlap() and InsertRange() to RangeSet, plus cleanup.
mercere99 Jul 20, 2023
20d78b7
Started building tests for continuous RangeSets.
mercere99 Jul 20, 2023
766c862
Added ToString() and HasOverlap() to emp::Range.
mercere99 Jul 20, 2023
252f5e6
Added ToString(), HasOverlap(), and RemoveRange() to emp::RangeSet.
mercere99 Jul 20, 2023
c82c6fb
Added various tests for RangeSet for removing sub-ranges.
mercere99 Jul 20, 2023
b5c4188
Added a bunch more RangeSet tests with various combinations of removals.
mercere99 Jul 20, 2023
1468960
Added RangeSet functions CalcInverse() and Invert()
mercere99 Jul 21, 2023
b150469
Added RangeSet tests for Invert().
mercere99 Jul 21, 2023
1f271f2
Implemented various operators to make RangeSet behave like Bits.
mercere99 Jul 21, 2023
e28d55b
Added string converters to RageSet and compound operators
mercere99 Jul 22, 2023
5699361
Made MakeFromLiteral() take a type to convert the Strong to.
mercere99 Jul 23, 2023
94b0845
Setup a version of CharSetBase::CountMatches() to optionally take sta…
mercere99 Jul 25, 2023
f3f110c
Allow CountFrontMatches to specify a starting point.
mercere99 Jul 25, 2023
2ff70e2
Added a document to note what should be done on the next full-pass th…
mercere99 Jul 25, 2023
c0ba1cc
Added a CharQuotes string syntax.
mercere99 Jul 26, 2023
db813d9
Added more String pop Functions; started building Scan functions.
mercere99 Jul 26, 2023
5ac222c
More updates to scans in emp::String.
mercere99 Jul 28, 2023
f7f4da7
More shifting to the use of scan functions.
mercere99 Jul 29, 2023
1af5314
Moved Scan functions to after View functions in String.
mercere99 Jul 30, 2023
faef909
Draft fix for ResetSeed
amlalejini Aug 9, 2023
4d49782
Add test to verify ResetSeed resets emp::Random object's internal state
amlalejini Aug 9, 2023
ae47837
Merge pull request #486 from amlalejini/fix-random-reset-seed
amlalejini Aug 9, 2023
805fe33
Merge branch 'virtual_cpu_merge' into MABE_devel
FergusonAJ Aug 9, 2023
b8c1125
Merge branch 'MABE_devel' of https://github.com/devosoft/Empirical in…
mercere99 Aug 10, 2023
9e56f61
More options for NEXT_PASS
mercere99 Aug 29, 2023
30e7fcc
Added a _FromString() helper function in RangeSet
mercere99 Aug 29, 2023
0269e56
Added SelectRandom() to random_utils
mercere99 Aug 29, 2023
6c0eff2
Put String::no_char into a NoChar() wrapper function.
mercere99 Aug 29, 2023
3167d06
Fix Keep/RemoveIfBegins
FergusonAJ Sep 11, 2023
79609e2
Merge pull request #488 from devosoft/FergusonAJ-patch-1
mercere99 Sep 11, 2023
67bdab8
Cleanup on UnorderedIndexMap and next constructor with weights.
mercere99 Sep 2, 2023
606a038
Added Bits::GetRanges() conversion function.
mercere99 Sep 2, 2023
9c7ce01
Added KeepOnly() functions to RangeSet.
mercere99 Sep 3, 2023
926da8b
Set up RangeSet functions to return *this instead of void.
mercere99 Sep 5, 2023
764c706
Set up RangeSet Insert functions to return *this instead of bool.
mercere99 Sep 6, 2023
edb9b1c
Set up RangeSet Remove and KeepOnly functions to return *this instead…
mercere99 Sep 8, 2023
1d34c86
Updated RangeSet.cpp tests based on changes to Insert and Remove retu…
mercere99 Sep 9, 2023
7d958ca
Updated RangeSet.cpp tests to limit indices to test values.
mercere99 Sep 11, 2023
962f762
Fixed RangeSet::KeepOnly and created RangeSet::Ok()
mercere99 Sep 12, 2023
7070121
Cleanup on Range.hpp
mercere99 Sep 22, 2023
24f5213
Better assers in RangeSet.hpp including tests of OK()
mercere99 Sep 23, 2023
54a2c37
Added lots of check of OK()
mercere99 Sep 24, 2023
2ffc984
Fixed RangeSet::CalcInverse() to work with empty sets
mercere99 Sep 28, 2023
ce2f520
Cleaned up RangeSet::Ok() and some asserts
mercere99 Oct 4, 2023
41fc1f2
Updated RangeSet tests; focusing on first 8 positions.
mercere99 Oct 6, 2023
f1382c2
Added MaxLimit() and MinLimit() to range, plus cleaned up Shifting to…
mercere99 Oct 8, 2023
374c3b3
Cleaned up shifting in RangeSet to respect numeric limits.
mercere99 Oct 8, 2023
d83f386
Revamped NOTES for MarkBack format
mercere99 Oct 18, 2023
dfee3fd
Cleaned up MarkBack notes, esp for code inclusion.
mercere99 Oct 19, 2023
87a0271
More clean up on MarkBack notes
mercere99 Oct 23, 2023
742b831
Added a File::ToCSV() function.
mercere99 Oct 24, 2023
c169dbf
Fixed StringSyntax to identify that chars cannot be quotes or parens …
mercere99 Oct 25, 2023
e8e56e0
More cleanup on MarkBack notes - need to actually implement now
mercere99 Oct 26, 2023
eaf0233
Updated .gitignore with auto-generated demo files.
mercere99 Oct 29, 2023
71828b8
Simplification of Keys in map_utils
mercere99 Nov 3, 2023
d49fee3
Cleanup and simplification in DataManager
mercere99 Nov 4, 2023
c4c0edc
Setup Datum to interact mathematically with regular numerical values.
mercere99 Nov 5, 2023
3e9b6f6
Added mathematical tests for Datum.
mercere99 Nov 8, 2023
417826f
Setup more mathematical Datum tests with double listed first.
mercere99 Nov 9, 2023
984e796
Setup external operator% with double first for Datum
mercere99 Nov 10, 2023
6f9f578
Spacing cleanup in a few files.
mercere99 Nov 12, 2023
908adbb
Added compound operators to Datum.
mercere99 Nov 12, 2023
dc04f80
Added tests for compound operators in Datum.
mercere99 Nov 13, 2023
ad48841
Set up move constructor / operator for Datum.
mercere99 Nov 15, 2023
7c557c8
Added unary operators to Datum
mercere99 Nov 15, 2023
5b7d0bc
Fixed duplication of unary operators.
mercere99 Nov 15, 2023
cbc58f2
Added Datum tests for unary operators and right side of assignments.
mercere99 Nov 16, 2023
a6afc7b
Cleaned up StaticString to allow for larger sizes.
mercere99 Nov 17, 2023
e08c893
Added StaticString manipulation tests.
mercere99 Nov 18, 2023
ad33ac1
Added a push_back() to StaticString
mercere99 Nov 19, 2023
cd7b4d7
Added variations of append() to StaticString
mercere99 Nov 20, 2023
eac49ce
Added tests for StaticString push_back() and append()
mercere99 Nov 20, 2023
401f757
Renamed ShortString.hpp to StaticString.hpp since longer strings are …
mercere99 Nov 21, 2023
4970310
Added a bunch of in-progress filed to be tracked.
mercere99 Nov 21, 2023
dfdcd9b
Merge branch 'MABE_devel' of https://github.com/devosoft/Empirical in…
mercere99 Nov 21, 2023
c046b71
Merged back in from Master
mercere99 Nov 21, 2023
92143af
Dealt with unused parameter warnings in a few files.
mercere99 Nov 23, 2023
7d48f25
Added an extra assert in DataManager::Get()
mercere99 Nov 24, 2023
403025e
Added GetIndexFromSymbol to InstLib.
mercere99 Nov 25, 2023
8bd2d7c
Streamlined VirtualCPU::PushInst
mercere99 Nov 27, 2023
caec263
Cleanup of types in Systematics.
mercere99 Nov 28, 2023
e1aa2ee
Fixed StringSyntax::GetMatch() and added an AsString()
mercere99 Nov 29, 2023
b6229df
Updated Random tests.
mercere99 Nov 30, 2023
85c3b97
Updated emp::slice to respect maximum count.
mercere99 Nov 30, 2023
8689355
Updated tests for emp::slice
mercere99 Nov 30, 2023
42c5d39
Temporarily removed Systematics tests...
mercere99 Nov 30, 2023
50c6359
Cleaned up systematics tests.
mercere99 Nov 30, 2023
4898fa0
Added MapToString() to map_utils.hpp
mercere99 Nov 30, 2023
dc26e41
Reordered tags in MatchBin tests.
mercere99 Nov 30, 2023
b76c2cd
Updated slice limit in keyname_utils.hpp
mercere99 Nov 30, 2023
2329f2e
Moved keyname_utils tests from REQUIRE to CHECK
mercere99 Nov 30, 2023
8be5c7c
Try installing clang 15
mmore500 Nov 30, 2023
8132567
Merge pull request #490 from devosoft/mmore500-clang
mercere99 Nov 30, 2023
0849461
Add iterator traits to emp::array iterator
mmore500 Dec 1, 2023
6ad7a5d
Switch span constructor for opt mode compat
mmore500 Dec 1, 2023
4e402f3
Merge pull request #491 from devosoft/mmore500-array-iteratortraits
mercere99 Dec 1, 2023
2256a71
Cleanup type warnings in _StringSyntax.hpp
mercere99 Dec 1, 2023
694becc
Cleanup type warnings in string_utils.hpp
mercere99 Dec 1, 2023
fd9dc67
Cleanup type warnings in a few files.
mercere99 Dec 1, 2023
74f12c4
Added a String::ConvertTo() and cleaned up String iterator handling.
mercere99 Dec 1, 2023
2b431d7
Updated File example to use emp::String.
mercere99 Dec 1, 2023
25acd17
Fixed attribute typo in assert examples.
mercere99 Dec 1, 2023
bd0d54a
Updated a few files to fix uses of depricated functions.
mercere99 Dec 1, 2023
fe0194d
Setup Bits_Data to only delete memory if it exists.
mercere99 Dec 1, 2023
9c1c07d
Added cstdint header to Signal.hpp and fixed spelling.
mercere99 Dec 1, 2023
7202b9e
Addedi include of <cstdint> to DataFile.hpp
mercere99 Dec 1, 2023
3bef8e0
Added #include <cctype> to String.hpp
mercere99 Dec 1, 2023
8b61e24
Moved #include <cstdint> to type_traits.hpp (where it's really needed).
mercere99 Dec 1, 2023
6d5356b
Added #include <cstdint> to bitset_utils.hpp
mercere99 Dec 1, 2023
fdf4a2f
Fixed operator< in AvidaGP
mercere99 Dec 2, 2023
dd7e3e0
Cleanup on a few files.
mercere99 Dec 2, 2023
7d482ac
Alphabetized headers and ensured newlines at the end of all files.
mercere99 Dec 2, 2023
edf5812
Fixed all include guards.
mercere99 Dec 2, 2023
65e1fd8
Add newlines at the end of files.
mercere99 Dec 2, 2023
e17be46
Fixed filename errors in headers.
mercere99 Dec 2, 2023
97bb567
Added whitespace.
mercere99 Dec 2, 2023
b613f1d
Fixed some spacing issues.
mercere99 Dec 2, 2023
7584e93
Update actions-setup-docker pin
mmore500 Dec 7, 2023
1903f41
Try downgrading ubuntu pin
mmore500 Dec 7, 2023
a62ac2e
Try docker build first then use actions container
mmore500 Dec 7, 2023
8ef69bc
Fix job name
mmore500 Dec 7, 2023
f25f665
Fixup tags and labels
mmore500 Dec 7, 2023
6316c6e
Give workflow package write permissions
mmore500 Dec 7, 2023
e317a65
Try using GH tutorial content for Docker workflow
mmore500 Dec 7, 2023
7d07ec3
Set tag thru docker metadata action
mmore500 Dec 7, 2023
2aa1d84
Use run number instead of id
mmore500 Dec 7, 2023
d015eae
Deploy to ghcr.io too
mmore500 Dec 7, 2023
9897d4a
Include header for uint32_t
mmore500 Dec 7, 2023
8bf11c7
Rename .readthedocs.yml to .readthedocs.yaml
mmore500 Dec 7, 2023
89dfbda
Add build field to rtd yaml
mmore500 Dec 7, 2023
e9918f5
Update comment to note filename change
mmore500 Dec 7, 2023
bba48da
Pick python version by rtd build, not python field
mmore500 Dec 7, 2023
3eaaac4
Bugfix: make action container user root
mmore500 Dec 7, 2023
9638b30
Pin older checkout for container compat
mmore500 Dec 7, 2023
622b044
Bump breathe pin for bugfix
mmore500 Dec 7, 2023
ba90965
Add missing cstdint includes
mmore500 Dec 7, 2023
23b1d12
Drop set pipefail
mmore500 Dec 7, 2023
7840148
Fix path to headtail.sh
mmore500 Dec 7, 2023
a29d988
Add missing includes for size_t
mmore500 Dec 7, 2023
705ed80
Bump coverage clang version for fix to stl
mmore500 Dec 7, 2023
fc374d2
Merge pull request #492 from devosoft/mmore500-patch-4
mmore500 Dec 7, 2023
51415be
Merge branch 'MABE_devel' into update-MABE_devel
mmore500 Dec 7, 2023
60ce0e8
Merge pull request #493 from devosoft/update-MABE_devel
mmore500 Dec 7, 2023
0b3bb0a
Merge branch 'master' into documentation
mmore500 Dec 7, 2023
1b7d397
Strip off-topic diffs from World.hpp
mmore500 Dec 7, 2023
05d6ca8
Strip off-topic diffs from SystematicsAnalysis.hpp
mmore500 Dec 7, 2023
d366721
Remove off-topic diffs from Evolve/Systematics.cpp
mmore500 Dec 7, 2023
3f156a9
Use idiomatic exist_ok
mmore500 Dec 7, 2023
a06b4fa
Systematize make_md prefix exclusion
mmore500 Dec 7, 2023
69a2b9b
Strip illegal characters
mmore500 Dec 7, 2023
ac4b72e
Add header comment for make_md.py
mmore500 Dec 7, 2023
dfb8a8e
Bugfix: ensure intended recursive glob
mmore500 Dec 7, 2023
9af0c20
Make make_md.py executable
mmore500 Dec 7, 2023
631e9f8
Ensure make_md runs in doc/ folder
mmore500 Dec 7, 2023
a773e9a
Only provide python10 in the Docker container
mmore500 Dec 7, 2023
cfd38b1
Set Python310 as default in container
mmore500 Dec 7, 2023
2eedef0
Strip off-topic changes
mmore500 Dec 7, 2023
8bb3f1e
Install doxygen into docker container
mmore500 Dec 7, 2023
93794fc
fixup! Strip off-topic changes
mmore500 Dec 7, 2023
7805e1a
Peg python to python3.10 in container, too
mmore500 Dec 8, 2023
6f8e92d
Use symlink instead of update alternatives
mmore500 Dec 8, 2023
a21c9fd
Drop erring pipefail bash option
mmore500 Dec 8, 2023
41cb216
Make doc cover deploy own job for container compat
mmore500 Dec 8, 2023
3e1b442
Ensure docs deps supersede third-party/requirements
mmore500 Dec 8, 2023
fbf27dc
Revert "Temporarily removed Systematics tests..."
mmore500 Dec 8, 2023
155c3c5
Fix coverage build
mmore500 Dec 8, 2023
6771a03
Update CI.yml
mmore500 Dec 8, 2023
d0f557e
Flex path to doxygen data with glob
mmore500 Dec 8, 2023
e1b4c29
Ensure tabs in Makefile
mmore500 Dec 8, 2023
5ee3b94
Seed Random for reproducible tests
mmore500 Dec 8, 2023
70e4766
Detect uncommitted changes another way for mac compat
mmore500 Dec 8, 2023
73dffd7
Give container deploy step token permisisons
mmore500 Dec 8, 2023
b570bcc
Add diagnostic prints to git status warnings
mmore500 Dec 8, 2023
7f279a6
Update mac git for bugfix?
mmore500 Dec 8, 2023
453f7b8
Bump to v3 checkout
mmore500 Dec 8, 2023
33657b9
Try manually cleaning after mac clone
mmore500 Dec 8, 2023
e24c6c2
Fix bad checkout action on mac ci
mmore500 Dec 8, 2023
3c10ef5
Retore deleted includes
mmore500 Dec 8, 2023
f392da8
Try bumping checkout action to v4
mmore500 Dec 8, 2023
1b6e3df
Fix ghcr.io deploy step
mmore500 Dec 8, 2023
80376f7
Fix whitespace
mmore500 Dec 8, 2023
c9f4505
Try fix ghcr deploy with separate login step
mmore500 Dec 8, 2023
0c48a51
Don’t checkout merge on mac to avoid bug
mmore500 Dec 8, 2023
fcf613a
Fall back to default ref if not pull
mmore500 Dec 8, 2023
07243c4
Try forcing full depth to fix mac dirty git
mmore500 Dec 8, 2023
37d337f
Drop broken ghcr container deploy
mmore500 Dec 8, 2023
8332fef
Merge remote-tracking branch 'origin/documentation'
mmore500 Dec 11, 2023
508818d
Fixup boilerplate
mmore500 Dec 11, 2023
2c2f1a5
Fixup and test emp::Fraction
mmore500 Dec 8, 2023
27f70f0
Merge pull request #498 from devosoft/test-fraction
mmore500 Dec 12, 2023
908c265
Release v1.0.0
mmore500 Dec 14, 2023
22a75a7
Merge branch 'joss-paper' into joss-update
mmore500 Dec 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added Bits::FindZero() to pair with FindOne()
mercere99 committed Jul 16, 2023
commit 5aafd693adf519610213e67552859660ba4e9199
66 changes: 61 additions & 5 deletions include/emp/bits/Bits.hpp
Original file line number Diff line number Diff line change
@@ -64,6 +64,7 @@
#include "../math/constants.hpp"
#include "../math/math.hpp"
#include "../math/Random.hpp"
#include "../math/Range.hpp"
#include "../meta/type_traits.hpp"

#include "_bitset_helpers.hpp"
@@ -582,6 +583,10 @@ namespace emp {
/// @brief Return the position of the first one; return -1 if no ones in vector.
[[nodiscard]] int FindOne() const;

/// @brief Return the position of the first zero; return -1 if no zeroes in vector.
[[nodiscard]] int FindZero() const;


/// Deprecated: Return the position of the first one; return -1 if no ones in vector.
[[deprecated("Renamed to more accurate FindOne()")]]
[[nodiscard]] int FindBit() const { return FindOne(); }
@@ -590,14 +595,26 @@ namespace emp {
/// You can loop through all 1-bit positions of Bits object "bits" with:
///
/// for (int pos = bits.FindOne(); pos >= 0; pos = bits.FindOne(pos+1)) { ... }
///

[[nodiscard]] int FindOne(const size_t start_pos) const;

/// @brief Special version of FindOne takes int; most common way to call.
/// @brief Return the position of the first zero after start_pos (or -1 if none)
/// You can loop through all 0-bit positions of Bits object "bits" with:
///
/// for (int pos = bits.FindZero(); pos >= 0; pos = bits.FindZero(pos+1)) { ... }

[[nodiscard]] int FindZero(const size_t start_pos) const;

/// @brief Special version of FindOne takes int; common way to call.
[[nodiscard]] int FindOne(int start_pos) const {
return FindOne(static_cast<size_t>(start_pos));
}

/// @brief Special version of FindZero takes int; common way to call.
[[nodiscard]] int FindZero(int start_pos) const {
return FindZero(static_cast<size_t>(start_pos));
}

/// Deprecated version of FindOne().
[[deprecated("Renamed to more accurate FindOne(start_pos)")]]
[[nodiscard]] int FindBit(const size_t start_pos) const;
@@ -622,6 +639,10 @@ namespace emp {
/// @brief Find the length of the longest continuous series of ones.
[[nodiscard]] size_t LongestSegmentOnes() const;

/// @brief Find ids of all groups of ones.
/// @return A vector of ranges that identify all ids of ones.
[[nodiscard]] emp::vector<emp::Range<size_t>> GetRanges() const;

/// @brief Return true if any ones are in common with another Bits.
[[nodiscard]] bool HasOverlap(const Bits & in) const;

@@ -1850,16 +1871,26 @@ namespace emp {
(int) (find_bit(_data.bits[field_id]) + (field_id * FIELD_BITS)) : -1;
}

/// Return the position of the first zero; return -1 if no zeros in vector.
template <typename DATA_T, bool ZERO_LEFT>
int Bits<DATA_T,ZERO_LEFT>::FindZero() const {
const size_t NUM_FIELDS = _data.NumFields();
size_t field_id = 0;
while (field_id < NUM_FIELDS && _data.bits[field_id]==FIELD_ALL) field_id++;
return (field_id < NUM_FIELDS) ?
(int) (find_bit(~_data.bits[field_id]) + (field_id * FIELD_BITS)) : -1;
}

/// Return the position of the first one after start_pos; return -1 if no ones in vector.
/// You can loop through all 1-bit positions in "bits" with:
///
/// for (int pos = bits.FindOne(); pos >= 0; pos = bits.FindOne(pos+1)) { ... }

template <typename DATA_T, bool ZERO_LEFT>
int Bits<DATA_T,ZERO_LEFT>::FindOne(const size_t start_pos) const {
if (start_pos >= GetSize()) return -1; // If we're past the end, return fail.
size_t field_id = FieldID(start_pos); // What field do we start in?
const size_t field_pos = FieldPos(start_pos); // What position in that field?
if (start_pos >= GetSize()) return -1; // If we are past the end, return fail.
size_t field_id = FieldID(start_pos); // What field do we start in?
const size_t field_pos = FieldPos(start_pos); // What position in that field?

// If there's a hit in a partial first field, return it.
if (field_pos && (_data.bits[field_id] & ~(MaskField(field_pos)))) {
@@ -1875,6 +1906,31 @@ namespace emp {
(int) (find_bit(_data.bits[field_id]) + (field_id * FIELD_BITS)) : -1;
}

/// Return the position of the first zero after start_pos; return -1 if no zeroes in vector.
/// You can loop through all 0-bit positions in "bits" with:
///
/// for (int pos = bits.FindZero(); pos >= 0; pos = bits.FindZero(pos+1)) { ... }

template <typename DATA_T, bool ZERO_LEFT>
int Bits<DATA_T,ZERO_LEFT>::FindZero(const size_t start_pos) const {
if (start_pos >= GetSize()) return -1; // If we are past the end, return fail.
size_t field_id = FieldID(start_pos); // What field do we start in?
const size_t field_pos = FieldPos(start_pos); // What position in that field?

// If there's a hit in a partial first field, return it.
if (field_pos && (~_data.bits[field_id] & ~(MaskField(field_pos)))) {
return (int) (~find_bit(_data.bits[field_id] & ~(MaskField(field_pos))) +
field_id * FIELD_BITS);
}

// Search other fields...
const size_t NUM_FIELDS = _data.NumFields();
if (field_pos) field_id++;
while (field_id < NUM_FIELDS && _data.bits[field_id]==FIELD_ALL) field_id++;
return (field_id < NUM_FIELDS) ?
(int) (find_bit(~_data.bits[field_id]) + (field_id * FIELD_BITS)) : -1;
}

/// Find the most-significant set-bit.
template <typename DATA_T, bool ZERO_LEFT>
int Bits<DATA_T,ZERO_LEFT>::FindMaxOne() const {