久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

Julia編程04:Julia調(diào)用R和Python

 生信探索 2023-04-16 發(fā)布于云南

參考使用homebrew管理linux和mac軟件安裝homebrew,、mamba和Python

Python環(huán)境

mamba create -y -n jlpy python=3.10
mamba activate jlpy
mamba install matplotlib
which python
# /opt/homebrew/Caskroom/mambaforge/base/envs/jlpy/bin/python

R環(huán)境

在R中運(yùn)行,,找到R_HOME

R.home()
# /Library/Frameworks/R.framework/Resources

Build

在Julia中運(yùn)行

using Pkg
Pkg.add(["PyCall","RCall"])
ENV["PYTHON"]="/opt/homebrew/Caskroom/mambaforge/base/envs/jlpy/bin/python"
Pkg.build("PyCall")

ENV["R_HOME"] = "/Library/Frameworks/R.framework/Resources"
Pkg.build("RCall")

調(diào)用R

還有許多用法,,可以參考官網(wǎng)

using RCall
@rimport base as rbase
rbase.sum([123])
# RObject{IntSxp}
# [1] 6

跟在R中寫代碼已經(jīng)沒什么區(qū)別了

R"
library(ggplot2)
qplot(iris$Sepal.Length,iris$Sepal.Width,color=iris$Species)
ggsave('iris.png')
"

調(diào)用Python

還有許多用法,可以參考官網(wǎng)

using PyCall
math = pyimport("math")
math.sin(math.pi / 4# returns ≈ 1/√2 = 0.70710678...
plt = pyimport("matplotlib.pyplot")
x = range(0;stop=2*pi,length=1000); y = sin.(3*x + 4*cos.(2*x));
plt.plot(x, y, color="blue", linewidth=2.0, linestyle="--")
plt.show()

Reference

https://juliainterop./RCall.jl/stable/
https://github.com/JuliaPy/PyCall.jl


Julia is a high-level, dynamic programming language. Its features are well suited for numerical analysis and computational science. Distinctive aspects of Julia's design include a type system with parametric polymorphism in a dynamic programming language; with multiple dispatch as its core programming paradigm.
The most significant departures of Julia from typical dynamic languages are:
The core language imposes very little; Julia Base and the standard library are written in Julia itself, including primitive operations like integer arithmetic
A rich language of types for constructing and describing objects, that can also optionally be used to make type declarations
The ability to define function behavior across many combinations of argument types via multiple dispatch
Automatic generation of efficient, specialized code for different argument types
Good performance, approaching that of statically-compiled languages like C

    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多