diff --git a/pytensor.h b/pytensor.h index 77d78cb..b6b4be5 100644 --- a/pytensor.h +++ b/pytensor.h @@ -20,18 +20,18 @@ using std::cout; using std::cerr; using std::endl; -template +template using Tensor = Eigen::Tensor; -template +template using TensorRM = Eigen::Tensor; -template +template void assign(Tensor &dest, TensorRM &src) { Eigen::array rev; for (int i = 0; i < n; i++) rev[i] = n - i - 1; dest = src.swap_layout().shuffle(rev); } -template +template void assign(TensorRM &dest, Tensor &src) { Eigen::array rev; for (int i = 0; i < n; i++) rev[i] = n - i - 1; @@ -59,10 +59,10 @@ struct PyServer { string evalf(const char *format, ...) { return ""; } void clf() {} void subplot(int rows, int cols, int n) {} - void plot(Tensor &v, string extra = "") {} - void plot2(Tensor &u, Tensor &v, string extra = "") {} - void imshow(Tensor &a, string extra = "") {} - void imshowT(Tensor &a, string extra = "") {} + void plot(Tensor &v, string extra = "") {} + void plot2(Tensor &u, Tensor &v, string extra = "") {} + void imshow(Tensor &a, string extra = "") {} + void imshowT(Tensor &a, string extra = "") {} }; #else struct PyServer { @@ -98,13 +98,13 @@ struct PyServer { message >> result; return result; } - template + template void add(zmqpp::message &message, Tensor &a) { TensorRM temp; assign(temp, a); message.add_raw((const char *)temp.data(), temp.size() * sizeof(T)); } - template + template string eval(string s, Tensor &a) { if (mode < 0) return ""; @@ -120,7 +120,7 @@ struct PyServer { message >> response; return response; } - template + template string eval(string s, Tensor &a, Tensor &b) { if (mode < 0) return "";