How is arctangent [function a()] implemented in bc? - bc

I wanted to see and possibly modify how the arctangent function a() was implemented in bc (the arbitrary precision calculator language) but was unable to find it. I even found a git repo of the project https://github.com/gavinhoward/bc, however was unable to locate the implementation code for it. This should be part of the matlib library for bc.
Please share link, location of the directory or source code below.

Related

Ways to find where a function is defined on a github repo without having to do a manual search?

I've been looking at the pytorch repo. In particular, I'm trying to find where this function is defined: https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/core/TensorBase.h#L505-L506
It's declared here in the header file but I can't seem to find where it's actually defined. Is there a quick way I can do this for a github repo?
You can search a lot of things without downloading the repo by using github search bar :
If you want full vscode search abilities, you can also use this marvelous project :
https://github1s.com/pytorch/pytorch
Edit #1: It have been brought to my attention, that you can have a similar effect by pressing the dot on you keyboard from -any- github repository directly ;) Enjoy !
Edit #2 : I also learnt that there is also this : https://gitpod.io/#{repository github url} that you can use to read and edit your own repo. Wow, the things we discover every days !
I don't think github has any such functionality and the search function often times doesn't work well for me.
However, depending on the specific case, there are some heuristic methods using the web interface that are quicker than scrolling through the search results.
For example in this case, have a look at the git blame for the line. The commit putting the declaration there should also have put the definition somewhere, usually.
In this case you will get this commit, which by a quick search on the page shows you that there is a macro for explicit specialization definitions of the function template in this file.
I also couldn't find a definition of the primary template with a quick look. Presumably the function is supposed to be explicitly specialized for all types it is used with.
The best way I know is to get a local copy with git clone and use git grep -n <fn_name> from the root of the directory (or wherever the source code is stored, either is fine). That will list all instances of the last argument and what file and line number it appears on, so it's typically pretty easy to tell which is the definition because it will have a { instead of a ; at the end.

I'm recently reading opencv source code. Is there some better ways to find class definitions in opencv library?

For example, I find a declaration of UMat class in mat.hpp, but how do I find the definition of UMat? There is no mat.cpp over there. And I checked almost all cpp files related on matrix, still cannot target it. I swear I tried my best. Anyone has some suggestions that help me find definitions efficiently? By the way, I didn't download the source code but read it on github. Thanks!
OpenCV maintain a site for documentation. It's not perfect, but it might help; found here. If you just need information on what the classes do I'd look here.
If you do need to stare at the internal gubbins of their classes, there is a standard file hierarchy they use in their github repo.
For a given module (in the case of Umat, the Core Module) there will be a folder with several subfolders. The subfolder /include/opencv2 will have the class declarations, the subfolder \src will have the definitions. In the case of Umat the definition is located here as far as I can see.

How can you obtain an AST for Microsoft C++ (MSVC)?

I want to be able to query what dependencies there are for C++ functions and variables in my source code. You could do that with Clang on the Linux side, but for Windows(.NET, etc) I can't seem to find a way to get access to the AST.
Background:
Say I fixed a part of my code. I'm trying to find a tool to easily identify all the areas in my source code affected by this fix. For example, if I changed Foo(), I'll check all areas that Foo() is used and all functions that Foo() calls, gather them, and print them out in a list. Preferably, it will also be able to gather multiple levels of dependencies. If it were to be represented visually, it'll look something like Sourcetrail. Unfortunately, I want to be able to do this programmatically instead of via a UI, so that link isn't what I'm looking for. I looked at DMS Search Engine but I can't seem to make its trial version to download. So I was wondering if I can just do it myself. But I can't seem to figure out how Sourcetrail, for example, was able to get the AST from a Visual Studio C++ project.

Coder on Matlab to C++ , sym and perms function?

I am discovering the coder tool in Matlab. some of my code was successfully converted but it fails in functions which contain the functions "sym" for symbolic and "perms" for permutations. Also I seem to get an error when I save the answer "ans" of for example "A==B". Any idea how to solve this problem?
Thank you for your help
Here is an example of parts of my matlab function that cannot be transformed into c++ with coder:
b=4;
s=2;
one=ones(factorial(b),1);
two=2*ones(factorial(b),1);
B=perms(s+1:b+s);
S=[one,two,B];
sz=size(S);
%%%%%%%%%%%%%%%%%%%
L=[1,3;1,4;1,5;1,6;2,3;2,4;2,5;2,6];
x=perms(1:8);
M=[];
Some toolbox functions cannot be compiled, i.e. they can only be run from a MATLAB session. The following post tells us that functionality in the Symbolic toolbox cannot be compiled.
http://se.mathworks.com/matlabcentral/answers/96441-why-am-i-unable-to-compile-functions-from-the-symbolic-math-toolbox
So most likely this is the reason why you are running into problems when you try to run it in compiled form.
More info about compiler support for various toolboxes can be found here:
http://se.mathworks.com/products/compiler/supported/compiler_support.html
Symbolic Math toolbox does not appear on the list and any toolbox that is not listed is not supported (i.e. cannot be compiled).

Sphinx + Doxygen + Breathe: How do I get a documentation like the one of Google's Ceres Solver?

I'm working on a C++ project and really fell in love with the Sphinx documentation build system. I managed to setup Doxygen and Breathe to produce and provide the C++ descriptions to Sphinx.
I can't figure out how Google's Ceres Solver documentation was done. Their API reference for example contains class names followed by lots of text, sometimes even with code block examples as shown in the previous link. Is there a way to write Doxygen documentation inside the source files and achieve this?
Another example is this class documentation, which has around two pages of text. I somehow doubt that all this text is located in the source files as Doxygen comments. I have the feeling that all the extra text has been written in the restructured text sources for the documentation and nothing in the c++ source files. But then what is the point of using doxygen and breathe...
Or asked differently, where should I put high-level information about the code? I mean I can document class1 and class2 in their sources, but somewhere I need to explain how both of them interact and are used together. This is what the documentation of the Ceres Solver does so nicely in my opinion.
Alternatively you could point me to a C++ project with the Sphinx + Doxygen + Breathe pipeline and open source documentation. Then I can see for myself how to do these things. Unfortunately I don't know about any project.
I missed the github link for the Ceres Solver. There the sources of the documentation can be found. I'm a bit disappointed, because the complete documentation is written in the Restructured Text source files and NOT inside the c++ code. Basically they reference the class name with .. class:: className and then add ReST markdown for informative text, example code blocks etc. One example is given in "Modeling Non-linear Least Squares"