I am currently working on a project where we using an Open Source library (GPL) for some specific algorithms and computations. This will be later replaced by our own implementation.
What I was wondering now is how much can you let yourself "help" or "inspire" by the Open Source implementation when implementing your own library which should be used by a closed source application later. It is not legal to copy some code segments or procedures directly from the Open Source into your implementation. But how much can you follow the Open Source implementation without actually violating the GPL conditions? If you study and understand the source code it is legal to do your own implementation based on this?