Yorick (programming language): Difference between revisions
Appearance
Content deleted Content added
→External links: removed dead link |
→External links: removed 2 more dead links |
||
Line 131: | Line 131: | ||
==External links== |
==External links== |
||
*[http://www.linuxjournal.com/article/2184 Linux Journal Review] |
*[http://www.linuxjournal.com/article/2184 Linux Journal Review] |
||
*[https://dhmunro.github.io/yorick-doc/qref/index.html Yorick Language Quick Reference Guide] |
|||
*[https://dhmunro.github.io/yorick-doc/manual/yorick.html Yorick manual] |
|||
*[https://web.archive.org/web/20170102091157/http://www.jeh-tech.com/yorick.html Yorick tutorial on JehTech] |
*[https://web.archive.org/web/20170102091157/http://www.jeh-tech.com/yorick.html Yorick tutorial on JehTech] |
||
{{Lawrence Livermore National Laboratory|state=autocollapse}} |
{{Lawrence Livermore National Laboratory|state=autocollapse}} |
Revision as of 03:08, 23 January 2023
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these messages)
|
Designed by | David H. Munro |
---|---|
First appeared | 1996 |
Stable release | 2.2.04
/ May 2015 |
OS | Unix-like systems including macOS, Microsoft Windows |
License | BSD |
Filename extensions | .i |
Website | github |
Yorick is an interpreted programming language designed for numerics, graph plotting, and steering large scientific simulation codes. It is quite fast due to array syntax, and extensible via C or Fortran routines. It was created in 1996 by David H. Munro of Lawrence Livermore National Laboratory.
Features
Indexing
Yorick is good at manipulating elements in N-dimensional arrays conveniently with its powerful syntax.
Several elements can be accessed all at once:
> x=[1,2,3,4,5,6];
> x
[1,2,3,4,5,6]
> x(3:6)
[3,4,5,6]
> x(3:6:2)
[3,5]
> x(6:3:-2)
[6,4]
- Arbitrary elements
> x=[[1,2,3],[4,5,6]]
> x
[[1,2,3],[4,5,6]]
> x([2,1],[1,2])
[[2,1],[5,4]]
> list=where(1<x)
> list
[2,3,4,5,6]
> y=x(list)
> y
[2,3,4,5,6]
- Pseudo-index
Like "theading" in PDL and "broadcasting" in Numpy, Yorick has a mechanism to do this:
> x=[1,2,3]
> x
[1,2,3]
> y=[[1,2,3],[4,5,6]]
> y
[[1,2,3],[4,5,6]]
> y(-,)
[[[1],[2],[3]],[[4],[5],[6]]]
> x(-,)
[[1],[2],[3]]
> x(,-)
[[1,2,3]]
> x(,-)/y
[[1,1,1],[0,0,0]]
> y=[[1.,2,3],[4,5,6]]
> x(,-)/y
[[1,1,1],[0.25,0.4,0.5]]
- Rubber index
".." is a rubber-index to represent zero or more dimensions of the array.
> x=[[1,2,3],[4,5,6]]
> x
[[1,2,3],[4,5,6]]
> x(..,1)
[1,2,3]
> x(1,..)
[1,4]
> x(2,..,2)
5
"*" is a kind of rubber-index to reshape a slice(sub-array) of array to a vector.
> x(*)
[1,2,3,4,5,6]
- Tensor multiplication
Tensor multiplication is done as follows in Yorick:
P(,+, )*Q(, +)
means
> x=[[1,2,3],[4,5,6]]
> x
[[1,2,3],[4,5,6]]
> y=[[7,8],[9,10],[11,12]]
> x(,+)*y(+,)
[[39,54,69],[49,68,87],[59,82,105]]
> x(+,)*y(,+)
[[58,139],[64,154]]