Skip to content

Commit

Permalink
run clang-format -i
Browse files Browse the repository at this point in the history
  • Loading branch information
terasakisatoshi committed Jun 14, 2024
1 parent d9a355a commit 34772c7
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions cxxwrap4/deps/src/hello.cpp
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
#include <string>
#include "jlcxx/array.hpp"
#include "jlcxx/jlcxx.hpp"
#include "jlcxx/stl.hpp"
#include "jlcxx/array.hpp"
#include <Eigen/Dense>
#include <string>

auto twice(jlcxx::ArrayRef<double, 1> jlx){
static Eigen::VectorXd y;
auto x = Eigen::Map<Eigen::VectorXd>(&jlx[0],jlx.size());
// do something with x and pass results to y
y = 2 * x;
auto twice(jlcxx::ArrayRef<double, 1> jlx) {
static Eigen::VectorXd y;
auto x = Eigen::Map<Eigen::VectorXd>(&jlx[0], jlx.size());
// do something with x and pass results to y
y = 2 * x;

return jlcxx::make_julia_array(y.data(), y.size());
return jlcxx::make_julia_array(y.data(), y.size());
}

void inplace_twice(jlcxx::ArrayRef<double, 1> jlx){
for (size_t i = 0; i < jlx.size(); i ++){
jlx[i] = 2 * jlx[i];
}
void inplace_twice(jlcxx::ArrayRef<double, 1> jlx) {
for (size_t i = 0; i < jlx.size(); i++) {
jlx[i] = 2 * jlx[i];
}
}

auto triple(jlcxx::ArrayRef<double, 1> v){
static Eigen::VectorXd y;
auto x = Eigen::Map<Eigen::VectorXd>(&v[0], v.size());
// Do something
y = 2 * x + x;
return jlcxx::make_julia_array(y.data(), y.size());
auto triple(jlcxx::ArrayRef<double, 1> v) {
static Eigen::VectorXd y;
auto x = Eigen::Map<Eigen::VectorXd>(&v[0], v.size());
// Do something
y = 2 * x + x;
return jlcxx::make_julia_array(y.data(), y.size());
}

auto inplace_triple(jlcxx::ArrayRef<double, 1> jlx){
auto x = Eigen::Map<Eigen::VectorXd>(&jlx[0],jlx.size());
x = 3 * x;
for (size_t i = 0; i < jlx.size(); i ++){
jlx[i] = x[i];
}
auto inplace_triple(jlcxx::ArrayRef<double, 1> jlx) {
auto x = Eigen::Map<Eigen::VectorXd>(&jlx[0], jlx.size());
x = 3 * x;
for (size_t i = 0; i < jlx.size(); i++) {
jlx[i] = x[i];
}
}

JLCXX_MODULE define_julia_module(jlcxx::Module &mod) {
Expand All @@ -41,4 +41,4 @@ JLCXX_MODULE define_julia_module(jlcxx::Module &mod) {

mod.method("triple", &triple);
mod.method("triple!", &inplace_triple);
}
}

0 comments on commit 34772c7

Please sign in to comment.