Skip to content
Snippets Groups Projects

Binded SVD in the python level and documented

Merged Tiago de Freitas Pereira requested to merge 8-bind-svd into master
2 unresolved threads

Implemented the signal standarization. The signs of U and V is defined analysing the first element of U. If U[0, 0] < 0 then U=-1U and V=-1V With that we have a consistent SVD binds along different implementations (http://prod.sandia.gov/techlib/access-control.cgi/2007/076422.pdf)

Closes #8 (closed)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
125 // I need to create a matrix S_output of size MxN and fits the diagonal of S (NxN) on it.
126 blitz::Array<double,2> S_output(M, N); S_output=0;
127 blitz::Array<double,2> S_diag(N, N); S_diag=0;
128 bob::math::diag(S, S_diag);
129 S_output(blitz::Range(0,N-1), blitz::Range(0,N-1)) = S_diag;
130 //bob::math::diag(S, (reinterpret_cast<blitz::Array<double,2>>)S_output(blitz::Range(0,N-1), blitz::Range(0,N-1)));
131 return Py_BuildValue("NNN",
132 PyBlitzArrayCxx_AsConstNumpy(U),
133 PyBlitzArrayCxx_AsConstNumpy(S_output),
134 PyBlitzArrayCxx_AsConstNumpy(V));
135 }
136 catch (std::exception& e) {
137 PyErr_SetString(PyExc_RuntimeError, e.what());
138 }
139 catch (...) {
140 PyErr_SetString(PyExc_RuntimeError, "norminv failed: unknown exception caught");
  • 20 20 import numpy
    21 21 import nose.tools
    22 22 numpy.random.seed(10)
    23 import pkg_resources
    Please register or sign in to reply
    Loading