forked from VowpalWabbit/vowpal_wabbit
-
Notifications
You must be signed in to change notification settings - Fork 0
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
[PREVIEW] deprecate last and pop, implement insert, erase, capacity #1
Open
peterychang
wants to merge
3
commits into
parser_string_view
Choose a base branch
from
v_array_pop_refactor
base: parser_string_view
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,7 +103,7 @@ void io_buf::buf_write(char*& pointer, size_t n) | |
flush(); | ||
else // Array is short, so increase size. | ||
{ | ||
space.resize(2 * (space.end_array - space.begin())); | ||
space.resize(2 * space.capacity()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, thankyou! |
||
space.end() = space.begin(); | ||
head = space.begin(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -617,7 +617,7 @@ void add_new_feature(search_private& priv, float val, uint64_t idx) | |
uint64_t idx2 = ((idx & mask) >> ss) & mask; | ||
features& fs = priv.dat_new_feature_ec->feature_space[priv.dat_new_feature_namespace]; | ||
fs.push_back(val * priv.dat_new_feature_value, ((priv.dat_new_feature_idx + idx2) << ss)); | ||
cdbg << "adding: " << fs.indicies.last() << ':' << fs.values.last() << endl; | ||
cdbg << "adding: " << fs.indicies.back() << ':' << fs.values.back() << endl; | ||
if (priv.all->audit) | ||
{ | ||
std::stringstream temp; | ||
|
@@ -628,17 +628,17 @@ void add_new_feature(search_private& priv, float val, uint64_t idx) | |
|
||
void del_features_in_top_namespace(search_private& /* priv */, example& ec, size_t ns) | ||
{ | ||
if ((ec.indices.size() == 0) || (ec.indices.last() != ns)) | ||
if ((ec.indices.size() == 0) || (ec.indices.back() != ns)) | ||
{ | ||
return; | ||
// if (ec.indices.size() == 0) | ||
//{ THROW("internal error (bug): expecting top namespace to be '" << ns << "' but it was empty"); } | ||
// else | ||
//{ THROW("internal error (bug): expecting top namespace to be '" << ns << "' but it was " << | ||
//(size_t)ec.indices.last()); } | ||
//(size_t)ec.indices.back()); } | ||
} | ||
features& fs = ec.feature_space[ns]; | ||
ec.indices.decr(); | ||
ec.indices.pop_back(); | ||
ec.num_features -= fs.size(); | ||
ec.total_sum_feat_sq -= fs.sum_feat_sq; | ||
fs.clear(); | ||
|
@@ -895,7 +895,7 @@ void add_example_conditioning(search_private& priv, example& ec, size_t conditio | |
|
||
void del_example_conditioning(search_private& priv, example& ec) | ||
{ | ||
if ((ec.indices.size() > 0) && (ec.indices.last() == conditioning_namespace)) | ||
if ((ec.indices.size() > 0) && (ec.indices.back() == conditioning_namespace)) | ||
del_features_in_top_namespace(priv, ec, conditioning_namespace); | ||
} | ||
|
||
|
@@ -1080,7 +1080,7 @@ void allowed_actions_to_label(search_private& priv, size_t ec_cnt, const action* | |
template <class T> | ||
void ensure_size(v_array<T>& A, size_t sz) | ||
{ | ||
if ((size_t)(A.end_array - A.begin()) < sz) | ||
if (A.capacity() < sz) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎉 |
||
A.resize(sz * 2 + 1); | ||
A.end() = A.begin() + sz; | ||
} | ||
|
@@ -3484,7 +3484,7 @@ action predictor::predict() | |
: sch.predict(*ec, my_tag, orA, oracle_actions.size(), cOn, cNa, alA, numAlA, alAcosts, learner_id, weight); | ||
|
||
if (condition_on_names.size() > 0) | ||
condition_on_names.pop(); // un-null-terminate | ||
condition_on_names.pop_back(); // un-null-terminate | ||
return p; | ||
} | ||
} // namespace Search | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It just works? It's that easy?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see its a member function, still great!