Yorick (programming language)
| This article does not cite any references or sources. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. (October 2009) |
| Usual file extensions | .i |
|---|---|
| Appeared in | 1996 |
| Designed by | David H. Munro |
| Stable release | 2.1.05 (January 10, 2008) |
| OS | Unix, Linux, Mac, Windows |
| License | BSD |
| Website | Yorick Home Page |
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.
- Range of indices
Several elements can be accessed all at once:
<source lang="python"> > 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] </source>
- Arbitrary elements
<source lang="python"> > 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] </source>
- Pseudo-index
Like "theading" in PDL(Perl Data Language) and "broadcasting" in Numpy ( Numeric extension for Python), Yorick has a mechanism to do this:
<source lang="python"> > 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]] </source>
- Rubber index
".." is a rubber-index to represent zero or more dimensions of the array.
<source lang="python"> > 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 </source>
"*" is a kind of rubber-index to reshape a slice(sub-array) of array to a vector.
<source lang="python"> > x(*) [1,2,3,4,5,6] </source>
- Tensor multiplication
Tensor multiplication is done as follows in Yorick:
P(,+,,)*Q(,,+)
means <math>\sum_{j=1}^{j=N}{P_{ijkl}Q_{mnj}}</math>
<source lang="python"> > 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]] </source>
External links
| File:HelloWorld.svg | This programming language-related article is a stub. You can help Wikipedia by expanding it. |
If you like SEOmastering Site, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...
- Pages where expansion depth is exceeded
- Pages with broken file links
- Articles lacking sources from October 2009
- Articles with invalid date parameter in template
- All articles lacking sources
- Lawrence Livermore National Laboratory
- Programming languages created in 1996
- Programming languages
- Array programming languages
- Curly bracket programming languages
- Programming language topic stubs