In [1]:
%install_ext https://raw.github.com/dragly/cppmagic/master/cppmagic.py
In [2]:
%load_ext cppmagic
In [3]:
%%cpp
#include <iostream>
using namespace std;
class MyClass {
public:
int a;
MyClass() {
a = 10;
}
};
int main() {
MyClass B;
cout << B.a << endl;
return 0;
}
In [4]:
%%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;
}
In [4]: