%install_ext https://raw.github.com/dragly/cppmagic/master/cppmagic.py
Installed cppmagic.py. To use it, type: %load_ext cppmagic
%load_ext cppmagic
%%cpp
#include <iostream>
using namespace std;
class MyClass {
public:
int a;
MyClass() {
a = 10;
}
};
int main() {
MyClass B;
cout << B.a << endl;
return 0;
}
10
%%cpp -llapack -lblas -larmadillo
#include <iostream>
#include <armadillo>
using namespace std;
using namespace arma;
int main() {
mat A = randu<mat>(5,5);
cout << A << endl;
double determinant = det(A);
cout << determinant << endl;
return 0;
}
0.8402 0.1976 0.4774 0.9162 0.0163 0.3944 0.3352 0.6289 0.6357 0.2429 0.7831 0.7682 0.3648 0.7173 0.1372 0.7984 0.2778 0.5134 0.1416 0.8042 0.9116 0.5540 0.9522 0.6070 0.1567 -0.116435