Package: c3py
Compressed Continuous Computation (C3)Computing with functionsThe Compressed Continuous Computation (C3) package is intended to make it easy to perform continuous linear and multilinear algebra with multidimensional functions. It works by representing multidimensional functions in a low-rank format. Common tasks include taking "matrix" decompositions of vector- or matrix-valued functions, adding or multiplying functions together, integrating multidimensional functions, and much much more. The following is a sampling of capabilitiesAdaptive approximation of a black-box model (specified as a function pointer)Regression of a model from dataBoth linear and nonlinear approximationApproximation in polynomial, piecewise polynomial, linear element, and radial basis function spacesGeneral adaptive integration schemesDifferentiationMultiplicationAdditionRoundingComputing Jacobians and HessiansUQExpectation and varianceSobol sensitivitiesIn addition to the above capabilities, which are unique to the C3 package, I also have general optimization routines includingBFGSLBFGSGradient descentStochastic Gradient with ADAMDocumentation of most functions is provided by Doxygenhere.Installation / Getting startedThe dependencies for this code areBLASLAPACKSWIG (if building non-C interfaces)CMakeUsually, these dependencies can be installed via the package manager of your system (apt or brew or port)From Sourcegitclonehttps://github.com/goroda/Compressed-Continuous-Computation.gitc3cdc3
mkdirbuildcdbuild
cmake..
makeThis will install all shared libraries into c3/build/src. The main shared library is libc3, the rest are all submodules. To install to a particular location usecmake..-DCMAKE_INSTALL_PREFIX=/your/choice
makeinstallPython interfaceYou can install the python interface using the pip utility throughpipinstallpathlib
pipinstallc3pyOne can obtain some examples in the pyexamples subdirectorypythonpywrappers/pytest.pyAn alternative way to install it is to download the git repository and then runpythonsetup.pybuild
pythonsetup.pyinstallOne workflow that works well is to install this package in a new virtual environment. For instance using conda one can run the following (from the c3 directory)condacreate-nc3pyenvpython=3.7
condaactivatec3pyenv
pipinstallnumpy
pythonsetup.pybuild
pythonsetup.pyinstallIf you have an old version installed and would like to upgrade the following command is effective at removing all old code and reinstallingpipinstall--upgrade--force-reinstallc3pyConfiguration OptionsThe following configuration options take boolean (true/false) valuesBUILD_STATIC_LIBDefault: `OFF'Using this option can toggle whether or not static or shared libraries should be built.Note: This option cannot be set to ON if building the python wrapperBUILD_SUB_LIBSDefault: `OFF'Using this option can toggle whether or not to build each sub-library into its own libraryBUILD_TESTSDefault: `OFF'Using this option can toggle whether or not to build unit testsBUILD_EXAMPLESDefault: `OFF'Using this option can toggle whether or not to compile exampelsBUILD_PROFILINGDefault: `OFF'Using this option can toggle whether or not to compile the profiling executablesBUILD_BENCHMARKSDefault: `OFF'Using this option can toggle whether or not to compile the benchmarks testsBUILD_UTILITIESDefault: `OFF'Using this option can toggle whether or not to compile the utilitiesLIB_VISIBILITY_OFFDefault: `OFF'Using this option addes the flag-fvisibility=hiddento compilation. Useful when embedding this library in a C++ library to hide its symbols.Systems I have tested onMac OS X with clang version 8.0Ubuntu with gcc version 5.0Solutions to some possible problemsError: Unable to find 'python.swg'On Mac OS X, if SWIG is installed with macports usingsudoportinstallswigthen the above error might occur. To remedy this error install the swig-python packagesudoportinstallswig-python(On Mac OS X) Error: stdio.h not foundThis happens on some updated versions of Mac OS X. To solve this, the following StackOverflow thread seems to workhttps://stackoverflow.com/questions/52509602/cant-compile-c-program-on-a-mac-after-upgrade-to-mojaveNumpy errorsSometimes you may see the following errors_frozen_importlib:219:RuntimeWarning:numpy.ufuncsizechanged,mayindicatebinaryincompatibility.Expected216,got192orRuntimeError:ThecurrentNumpyinstallation('/Users/alex/anaconda3/envs/pytorch/lib/python3.6/site-packages/numpy/__init__.py')failstopasssimplesanitychecks.ThiscanbecausedforexamplebyincorrectBLASlibrarybeinglinkedin,orbymixingpackagemanagers(pip,conda,apt,...).Searchclosednumpyissuesforsimilarproblems.One way that I have found (https://stackoverflow.com/a/47975375) that seems to solve this is to upgrade numpy by running the following command. I am really not sure why this works ...sudopipinstallnumpy--upgrade--ignore-installedCoding practicesI aim to document (with Doxygen) every function available to the user and provide a unit test. Furthermore, I won't push code to the master branch that has memory leaks. I am constantly looking for more suggestions for improving the robustness of the code if any issues are encountered.ContributingPlease open a Github issue to ask a question, report a bug, or to request features.
To contribute, fork the repository and setup a branch.Author:Alex A. GorodetskyContact:goroda@umich.eduCopyright (c) 2014-2016, Massachusetts Institute of TechnologyCopyright (c) 2016-2017, Sandia National LaboratoriesCopyright (c) 2018-2021, University of MichiganLicense: BSD