Guest User

Untitled

a guest
Oct 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. import os, sys
  2. import numpy as np
  3. from distutils.core import setup, Extension
  4. from distutils import sysconfig
  5.  
  6. args = []
  7. args += ['-std=c++14','-lstdc++']
  8. args += ['-O3', '-march=native','-fopenmp']
  9. args += ['-DMKL_ILP64', '-m64', '-I${MKLROOT}/include']
  10. args += ['-L${MKLROOT}/lib/intel64', '-Wl,--no-as-needed', '-lmkl_intel_ilp64', '-lmkl_intel_thread', '-lmkl_core', '-liomp5', '-lpthread', '-lm', '-ldl']
  11.  
  12. ext_modules = [
  13. Extension(
  14. 'linear_algebra_utilities',
  15. ['linear_algebra_utilities.cpp'],
  16. extra_link_args=args,
  17. extra_compile_args = args,
  18. include_dirs=['pybind11/include','eigen3'],
  19. language='c++14',
  20. ),
  21. ]
  22.  
  23. setup(
  24. name='cpputilities',
  25. version='0.0.1',
  26. author='Benjamin Cohen-Stead',
  27. author_email='bwcohenstead@ucdavis.edu',
  28. description='Linear Algebra Utilities.',
  29. ext_modules=ext_modules,
  30. )
  31.  
  32. running build_ext
  33. building 'linear_algebra_utilities' extension
  34. gcc -pthread -B /home/benwcs/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ipybind11/include -Ieigen3 -I/home/benwcs/anaconda3/include/python3.7m -c linear_algebra_utilities.cpp -o build/temp.linux-x86_64-3.7/linear_algebra_utilities.o -std=c++14 -lstdc++ -O3 -march=native -fopenmp -DMKL_ILP64 -m64 -I${MKLROOT}/include -L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl
  35. cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  36. gcc -pthread -shared -B /home/benwcs/anaconda3/compiler_compat -L/home/benwcs/anaconda3/lib -Wl,-rpath=/home/benwcs/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/linear_algebra_utilities.o -o /home/benwcs/Documents/matrix_stabilization/linear_algebra_utilities.cpython-37m-x86_64-linux-gnu.so -std=c++14 -lstdc++ -O3 -march=native -fopenmp -DMKL_ILP64 -m64 -I${MKLROOT}/include -L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl
  37.  
  38. void QR_to_UdV(const Eigen::Ref<const Eigen::MatrixXd> A,
  39. Eigen::Ref<Eigen::MatrixXd> U,
  40. Eigen::Ref<Eigen::VectorXd> d,
  41. Eigen::Ref<Eigen::MatrixXd> V){
  42.  
  43. U = A.householderQr().householderQ();
  44. V = A.householderQr().matrixQR().triangularView<Eigen::Upper>();
  45.  
  46. d = V.diagonal();
  47. V.array().colwise() /= d.array();
  48. }
Add Comment
Please, Sign In to add comment