{"id":18002628,"url":"https://github.com/cjen07/julia_port","last_synced_at":"2025-03-26T08:31:17.463Z","repository":{"id":57510605,"uuid":"83195908","full_name":"cjen07/julia_port","owner":"cjen07","description":"example project to invoke julia functions in elixir to do scientific computing using port and metaprogramming","archived":false,"fork":false,"pushed_at":"2018-10-15T09:01:36.000Z","size":572,"stargazers_count":40,"open_issues_count":0,"forks_count":4,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-21T12:21:29.328Z","etag":null,"topics":["elixir","erlang-port","julia","metaprogramming"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cjen07.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-26T09:03:20.000Z","updated_at":"2024-07-12T14:27:37.000Z","dependencies_parsed_at":"2022-09-26T17:50:56.218Z","dependency_job_id":null,"html_url":"https://github.com/cjen07/julia_port","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjen07%2Fjulia_port","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjen07%2Fjulia_port/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjen07%2Fjulia_port/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjen07%2Fjulia_port/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cjen07","download_url":"https://codeload.github.com/cjen07/julia_port/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245618739,"owners_count":20645059,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","erlang-port","julia","metaprogramming"],"created_at":"2024-10-29T23:23:01.914Z","updated_at":"2025-03-26T08:31:16.900Z","avatar_url":"https://github.com/cjen07.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"## julia_port\nexample project to invoke julia functions in elixir to do scientific computing using port and metaprogramming\n\n### news\n* support julia v1.0.1\n* support elixir v1.7.3\n* support erlang 21.0\n* the script_test is supported\n* the real_test is removed because it does not support julia v1.0.1\n\n### remarks\n* the author will experiment with [tensorflow.jl](https://github.com/malmaud/TensorFlow.jl) for good reason\n\n### prerequisite\n* [julia](http://julialang.org/) installed and its access from shell\n\n### Installation\n\nthe package can be installed\nby adding `julia_port` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [{:julia_port, \"~\u003e 0.2.0\"}]\nend\n```\n\nremark: if you install the package as a dependency, in order to run `script_test`,\nyou have to move `./deps/julia_port/julia` and `./deps/julia_port/data` to `./julia` and `./data` respectively\n### usage\n* simple_test: arithmetics\n```elixir\ndef simple_test(port) do\n  port_send(port, \"1+2\")\n  IO.puts port_receive(port, true)\nend\n```\n* complex_test: linear algebra\n```elixir\nuse GenFunction, [rand: 2, sum: 1, *: 2]\n\ndef complex_test(port) do\n  rand(port, :a, 3, 3)\n  rand(port, :b, 3, 3)\n  JuliaPort.*(port, :c, :a, :b)\n  port_receive(port, false)\n  sum(port, :d, :c)\n  IO.puts port_receive(port, true)\nend\n```\n* script_test: linear regression\n```elixir\nuse GenFunction, [load_data: 1, lr_train: 2, lr_test: 3]\n\ndef script_test(port) do\n  include_script(port, \"./julia/lr.jl\")\n  load_data(port, {:x_train, :y_train}, \"./data/train\")\n  load_data(port, {:x_test, :y_test}, \"./data/test\")\n  lr_train(port, :beta, :x_train, :y_train)\n  port_receive(port, false)\n  lr_test(port, :error, :x_test, :y_test, :beta)\n  IO.puts port_receive(port, true)\nend\n```\n* run\n```elixir\niex -S mix\nport = JuliaPort.init\n# =\u003e #Port\u003c0.5310\u003e\nJuliaPort.print_version port\n# =\u003e received data: v\"1.0.0\"\nJuliaPort.simple_test port\n# =\u003e received data: 3\nJuliaPort.complex_test port\n# =\u003e received data: 5.710327361153192\nJuliaPort.script_test port\n# =\u003e received data: 0.9587912087912088\nJuliaPort.terminate port\n# =\u003e {#PID\u003c0.143.0\u003e, :close}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcjen07%2Fjulia_port","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcjen07%2Fjulia_port","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcjen07%2Fjulia_port/lists"}