Last active
December 19, 2015 07:39
-
-
Save lambday/5920296 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * This program is free software; you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 3 of the License, or | |
| * (at your option) any later version. | |
| * | |
| * Written (W) 2013 Soumyajit De | |
| */ | |
| #include <shogun/lib/common.h> | |
| #ifdef HAVE_EIGEN3 | |
| #include <shogun/lib/SGVector.h> | |
| #include <shogun/lib/SGMatrix.h> | |
| #include <shogun/mathematics/logdet/DenseMatrixOperator.h> | |
| using namespace shogun; | |
| void test() | |
| { | |
| const index_t size=2; | |
| SGMatrix<complex64_t> m(size, size); | |
| SGVector<complex64_t> diag(size); | |
| m.set_const(complex64_t(0.0)); | |
| CDenseMatrixOperator<complex64_t>* op=new CDenseMatrixOperator<complex64_t>(m); | |
| CDenseMatrixOperator<complex64_t>* cloned | |
| =dynamic_cast<CDenseMatrixOperator<complex64_t>*>(op->clone()); | |
| //diag=cloned->get_diagonal(); //this does not fail on require but gives segfaults | |
| CDenseMatrixOperator<complex64_t>* copied | |
| =new CDenseMatrixOperator<complex64_t>(op); | |
| diag=copied->get_diagonal(); // this fails on require | |
| delete op; | |
| delete cloned; | |
| delete copied; | |
| } | |
| #endif // HAVE_EIGEN3 | |
| int main(int argc, char** argv) | |
| { | |
| init_shogun_with_defaults(); | |
| sg_io->set_loglevel(MSG_GCDEBUG); | |
| #ifdef HAVE_EIGEN3 | |
| test(); | |
| #endif // HAVE_EIGEN3 | |
| exit_shogun(); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment