Generic Class Library - bugs, description, questions, usage and suggestions - page 23
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
The function is declared globally. For this reason there is a conflict with their Compare by users.
To reduce naming conflicts, could the author make all global auxiliary Generic functions public-static-methods?
fxsaber:
To reduce naming conflicts, could the author make all global auxiliary Generic functions public-static-methods?
Forum on trading, automated trading systems and strategy testing
Compiler bug: 'operator=' - structure has objects and cannot be copied
This is for the time being. If you want to include someone's library, you will find out that the author writes as "primitive" as you do, using the same names of classes and functions.
I will nail them with macros.
I wasn't talking about myself.
I've read all the pages of the discussion but still don't understand how to use it ?
Can anyone give me some examples?
I've read all the pages of the discussion but still don't understand how to use it ?
Can anyone give me some examples?
Forget it. You can't use it as it is now. Use the standard CObject + CDictionary instead. For most tasks, it is enough.
Question about retrieving a value by key. In the library code, this method looks like this
ME navigation tools (ALT+G and CTRL+-) by source refuse to work in this library. Therefore it is very difficult to trace the logic. In particular, I haven't figured out the initial value in the highlighted loop yet. But there is an understanding that if there is a speed, this value should be much less than the number of keys.
Please clarify the idea, what is the speed achieved in this function? Overkill is clearly present. But apparently it's short for some reason.
SZ I went through my debugger step by step. All clear on example TKey = int: m_bucket[Array[i]] = i. Only collisions when Array[i] == Array[j] (i != j) are unclear.
The question is about getting the value by the key. In the library code this method looks like this
Please clarify the idea, what makes this function fast? The overshoot is obviously present. But apparently it's short for some reason.
At one time I was reviewing and describing howCHashMap works
You need to search for entries, probably in this thread.
Forum on trading, automated trading systems and trading strategy testing
Generic classes library - bugs, description, questions, peculiarities of usage and suggestions
Sergey Dzyublik, 2017.12.11 13:41
Briefly about currentCHashMap implementation:
First, let's find out what isEntry<TKey,TValue>.
Essentially it is a Node as in CLinkedList which contains:
m_entries[] - array of "cells" where added key and value, hash_code, next are placed. Size of the array corresponds to Capacity.
m_count - specifies index of the first unused cell in m_entries. Initial value is 0, growing to Capacity, next is rebuilding all arrays with increasing Capacity and size of all arrays.
m_buckets[] - index array on m_entries[]. The default value is -1. Array size corresponds to Capacity.
No collision, adding unique value toCHashMap container:
Without collisions, get value by key inCHashMap container:
Collision resolving:
Collision, get value by key inCHashMap container:
Removing a value from theCHashMap container:
Rebuild the hash table (increase capacity process) :
Described behaviour from2017.12.11
Currently, may have added/changed some details/coefficients.
I have at one time disassembled and described howCHashMap works
You need to look for entries, probably in this thread.
I found it on
Forum on trading, automated trading systems and strategy testing
Generic classes library - errors, descriptions, questions, peculiarities of use and suggestions
Sergey Dzyublik, 2017.12.07 14:21
In this example the hash is the student's birthday.
We have a cupboard with 365 shelves containing the students' diaries.
We put each diary on the shelf corresponding to the student's birthday.
We need the diary of the pupil Petrov and we know when he was born.
Now by the date of birth in O(1) we can easily find Petrov's journal, as well as the journal of any other student.
The exception is when two students have the same birthday - this is called a collision.
Solving a collision is using the extra information to find out which of two or more journals we need.
Collision resolving through a list is simply going through all the entries in the collision one by one to find a match. Tear off each diary and see whose it is.
A subhash is to organize a hash table of the items involved in the collision, but by a different criterion. For example by the hour the student was born.
If you are interested in the topic - I advise a course from MailRu on youtube about algorithms and data structures.
Forum on trading, automated trading systems and trading strategy testing
Generic classes library - errors, description, questions, peculiarities of usage and suggestions
Sergey Dzyublik, 2017.12.08 14:40
The basics on this topic are for the lazy ones:
https://www.slideshare.net/mkurnosov/6-32402313
In reality it is much more complicated and is discussed in the relevant literature or in good "algorithms and data structures" courses.
Thanks, debug helped. There are small lists for collisions. Ran through the thread and was horrified. Turns out to have been on topic...
As of now, may have added/changed some details/coefficients.
Thank you very much! Helped a lot with your description.