Package: ffp-minvar
FFP_MINVARTable of ContentsInstallationDocumentationGithub DescriptionGSL DownloadOSXUbuntuCompilation and TestCompile .so fileTest in pythonTest in cInstallationTo installffp_minvar, use this command in terminal:pip3installffp_minvarWe assume you are using python >= 3.6DocumentationTo use the library, import the module like following:fromffp_minvarimportffp_minvar_libFunction Descriptionffp_minvar_lib.ffp(theta,B,V,Delta)theta: A K-1 array ofnp.zeros(K)B: An N-Knumpy.ndarrayV: A K-K diagonal matrix asnumpy.ndarray. Note that V must be passed in as a diagonal matrix otherwise aValueErrorwill be raised.Delta: An N-1numpy.ndarray. Contains the diagonal entries of the actual N-N matrix D.ffp_minvar_lib.lo_minvar(B,V,Delta)B: An N-Knumpy.ndarrayV: A K-K diagonal matrix asnumpy.ndarray. Note that V must be passed in as a diagonal matrix otherwise aValueErrorwill be raised.Delta: An N-1numpy.ndarray. Contains the diagonal entries of the actual N-N matrix D.ffp_minvar_lib.psi(B,V,Delta)B: An N-Knumpy.ndarrayV: A K-K diagonal matrix asnumpy.ndarray. Note that V must be passed in as a diagonal matrix otherwise aValueErrorwill be raised.Delta: An N-1numpy.ndarray. Contains the diagonal entries of the actual N-N matrix D.Examples:#------------ ffp Test --------------#print("------------ ffp Test ------------")ffp_res=ffp_minvar_lib.ffp(theta,B,V,D)print(ffp_res)#------------ Psi Test --------------#print("------------ Psi Test ------------")psi_res=ffp_minvar_lib.psi(B,V,D)print(psi_res)#---------- lo_minvar Test ----------#print("------------ lo_minvar Test ------------")lo_minvar_res=ffp_minvar_lib.lo_minvar(B,V,D)print(lo_minvar_res)Github Descriptionlibfolder stores the source python library.lib/sharedfolder stores the .so file used by the python library.includefolder contains the header file of the algorithm.srcfolder contains the C file of the algorithm, which uses the GSL library from GNU.objfolder stores the object file of the compiled C file of the algorithm.testfolder contains tests in C of the functions of the algorithm.ffp_minvar.pyis the original version of the algorithm.test_lib.pyis the test file of the python package.GSL DownloadNote that this part is irrelevant to the installation offfp_minvarpackage and is only for the download of GSL library.OSXApparently GSL can be installed throughHomebrewviabrewinstallgslthough installing it manually is just as simple, which we now describe.Downloadgsl-latest.tar.gzfrom theGSL ftp siteand unzip it anywhere (e.g. /Downloads)Open the unzippedgslfolder in Terminal (e.g.cd ~/Downloads/gsl-2.4Runsudo ./configure && make && make installIf the above gives a "permission denied" error, instead trysudomakeclean
sudochown-R$USER.
./configure&&make
makeinstallUbuntusudoapt-getinstalllibgsl-devYou'll now be able to include GSL into your code from anywhere.CompilationSharedTo compile the .so file of the algorithm used by the python package, use this command under root folder.makealg_lomv.soPythonTestTo run the test of the python package:Compile the .so fileMake sure that your current python interpreter has installednumpy,ctypes,pdb, andpathlib.Use this command under root folder:pythontest_lib.pyCTestTo compile the test of the algorithm in c, use this command under root folder:maketest_alg
./test_alg