Where to find what function names standfor? C++ [closed] - c++

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I am learning c++ and I keep running into a common problem: I cannot find the reasons behind function names.
For example, ifstream seekg() function. I attempt to look up the function on websites like:
http://www.cplusplus.com/reference/istream/istream/seekg/
https://en.wikipedia.org/wiki/Seekg
http://en.cppreference.com/w/cpp/io/basic_istream/seekg
Many times, none of these sources will give me a clue as to why it is named "seekg". Why is there a 'g' at the end? why does the ofstream have seekp (instead of g)?
Knowing that kind of information would make memorizing function names so much easier. Essentially, I'm looking for a resource for finding the etymology for function names. :)
Thanks for any help,

I can answer the specific question here. seekg refers to seek implemented over get area, while seekp works on put area.
The reason for the distinction is that streams support to separate areas - one is for reading, commonly refered to as source (get area), and another for writing, known as sink (put area). Quite often one works with streams which are limited to only one of those - std::ifstream only has get area, while std::ofstream has put area - but occasionally you deal with both.

Related

Implementation of scipy.signla.filtfilt in c++? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 10 months ago.
Improve this question
I am trying to implement scipy.signal.filtfilt function in c++ and I am wondering if there is already an implementation available of this?
I know its a long time. but maybe you find this repository useful:
FiltFilt in C++
filtfilt applies an IIR filter twice, once going forward, once going backward. The nontrivial part is how to initialize the IIR filter at the boundaries.
As a starting point, look at how scipy.signal.filtfilt does it. Here is the code:
https://github.com/scipy/scipy/blob/master/scipy/signal/signaltools.py#L3870
You might also find it useful to look at the source code for Octave's filtfilt (M code):
https://sourceforge.net/p/octave/signal/ci/default/tree/inst/filtfilt.m
To reproduce filtfilt in C++, you need a C++ implementation of IIR filtering to take the role of scipy's lfilter plus some boundary handling logic. I don't know about an existing C++ implementation of filtfilt, but at least for the default method='pad' logic, the core computation seems simple enough to consider porting directly.
Scipy's filtfilt is similar to Matlab's filtfilt.
A question for MATLAB's filtfilt was previously asked
An implementation for the same was previously shared on Stackoverflow by #darien-pardinas
Do note I say similar because as mentioned by #paco-wong
The difference is in the default padding length. In matlab's filtfilt, it is 3*(max(len(a), len(b)) - 1), and in scipy's filtfilt, it is 3*max(len(a), len(b)).
So you will have to account for that

How to read MATHEMATICAL functions in C++? [duplicate]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Okay, so what I want to do is to use a string as input (for instance "16*12+25"), convert it to a mathematical evaluation that the computer can comprehend and return the evaluated value. I could probably write this myself, but it would most likely take quite a while and in the end, it still wouldn't end up as good as I'd like it to unless I want to put even more time into it.
So my question is, is there any script, library or api that you know can do this for C++? I have found some for both java, python and .NET. But I am not working with any of these languages and I would like to remain within C++ for as long (hopefully throughout the entire project) as possible. Do you have any good ideas or links?
I found what I was looking for! The downloadable source is C++ and a CodeBlocks project. You can find it here: http://www.speqmath.com/tutorials/expression_parser_cpp/index.html
A far more sophisticated expression parser recommended by Jared: http://www.partow.net/programming/exprtk/index.html
There is nothing built into C++ for this; all the expression parsing code belongs in the compiler. You will need to use some external library. A quick Google search brings up muParser which looks pretty reasonable.

Where can I find an existing implementation of sprintf? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I need to customize c++ sprintf function, after step into sprintf, i got _cfltcvt_l, but there isn't _cfltcvt_l source code in visual studio.
I did the same thing in g++, it lead me to __mingw_vsprintf function, but i don't know where __mingw_vsprintf is.
I know that glibc is one of the implements, after downloaded, i can't find any file related to sprintf, So could anyone tell me where can I find an existing implementation of sprintf?
There's quite a train of functions to follow in glibc:
First, there's sprintf which calls vsprintf which calls vfprintf which does all the work. I believe the io and _IO_ prefixes might be irrelevant. They might not be, in which case my answer is wrong.
On the MinGW-w64 side of things the train follows a different path:
First, you have mingw_sprintf, which calls __pformat or mingw_pformat which looks like it does all the work.
I never got to figuring out how BSD libc is structured, so I can't show you their implementation.
Seems this is what you searching:
https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=stdio-common/sprintf.c;hb=HEAD

Convert string to mathematical evaluation [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Okay, so what I want to do is to use a string as input (for instance "16*12+25"), convert it to a mathematical evaluation that the computer can comprehend and return the evaluated value. I could probably write this myself, but it would most likely take quite a while and in the end, it still wouldn't end up as good as I'd like it to unless I want to put even more time into it.
So my question is, is there any script, library or api that you know can do this for C++? I have found some for both java, python and .NET. But I am not working with any of these languages and I would like to remain within C++ for as long (hopefully throughout the entire project) as possible. Do you have any good ideas or links?
I found what I was looking for! The downloadable source is C++ and a CodeBlocks project. You can find it here: http://www.speqmath.com/tutorials/expression_parser_cpp/index.html
A far more sophisticated expression parser recommended by Jared: http://www.partow.net/programming/exprtk/index.html
There is nothing built into C++ for this; all the expression parsing code belongs in the compiler. You will need to use some external library. A quick Google search brings up muParser which looks pretty reasonable.

Corner Stitching Datastructure, Any Open Source Implementations? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I recall learning about the corner-stitched data structure a number of years ago and have been fascinated with it ever since. It originated with a paper by Ousterhout.
I've searched and not been able to find a free/open implementations. I'd prefer a C++ implementation, but at this point would accept any pointers people might have.
Note: a corner-stitched data structure is a way to store 2 dimensional, rectangluar data, explicitly maintaining the whitespace between inserted elements. This is as opposed to a quad-tree which just stores the inserted data elements. There are many trade-offs, I'm mostly interested in an implementation - but would also accept alternatives that have similar properties.
Ousterhout's own software package Magic implements corner stitching. The C source code is available BSD-licensed at http://opencircuitdesign.com/magic.