Skip to content

Commit 5f16aea

Browse files
authored
Merge branch 'master' into build_teamcity
2 parents fbb1509 + d738a14 commit 5f16aea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3207
-718
lines changed

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,63 @@ When slicing, this is not necessary.
231231
// 6
232232
```
233233

234+
There are three iterators:
235+
236+
##### [NDIterator](src/main/kotlin/org/jetbrains/numkt/core/KtNDArrayIterator.kt).
237+
Calls a standard Python iterator. Always returns an view. If iteration occurs over a flat array, use the `scalar`
238+
property to obtain the element. If the array is not a scalar, the `null` will be returned. To check, use methods
239+
`isScalar` and `isNotScalar`.
240+
```kotlin
241+
val a = linspace<Double>(0, 10).reshape(2, 5, 5)
242+
243+
// Get ten one-dimensional arrays
244+
for (ax1 in a) {
245+
for (ax2 in ax1) {
246+
println(ax2)
247+
}
248+
}
249+
250+
// Sum of all elements
251+
var sum = 0.0
252+
for (ax1 in a) {
253+
for (ax2 in ax1) {
254+
for (el in ax2) {
255+
sum += el.scalar!!
256+
}
257+
}
258+
}
259+
```
260+
261+
##### [KtNDIter](src/main/kotlin/org/jetbrains/numkt/core/KtNDIter.kt).
262+
This iterator is a mapping of the C array iterator API, like in python `np.nditer`.
263+
It also displays items in the order they are in memory.
264+
```kotlin
265+
val a = arange(6).apply { resize(2, 3) }
266+
267+
// Square each element in the array
268+
val iter = KtNDIter(a)
269+
for (i in iter) {
270+
a[iter.multiIndex] = i * i
271+
}
272+
273+
for (x in KtNDIter(a[None..None, 1..None..-1])) {
274+
print("$x ")
275+
}
276+
```
277+
278+
##### [FlatIterator](src/main/kotlin/org/jetbrains/numkt/core/KtNDArrayIterator.kt).
279+
An iterator directly above the buffer. The fastest of all these iterators. Able to display view. Use method `flatIter`.
280+
281+
```kotlin
282+
val a = linspace<Double>(0, 10)
283+
284+
// Displays all items
285+
for (el in a.flatIter()) {
286+
print("$el ")
287+
}
288+
```
289+
290+
234291
#### Stacking
235292

236293
```kotlin

build.gradle

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ plugins {
2121
id 'maven-publish'
2222

2323
id "com.jfrog.bintray" version "1.8.4"
24+
25+
// Documentation
26+
id 'org.jetbrains.dokka' version '0.10.1'
2427
}
2528

2629
ext {
@@ -132,6 +135,7 @@ bintray {
132135
}
133136
}
134137

138+
135139
boolean isMerge() {
136140
def branch = System.getenv("build.branch") as String
137141
println("Current branch: $branch")
@@ -140,3 +144,42 @@ boolean isMerge() {
140144
}
141145
return false
142146
}
147+
148+
dokka {
149+
outputFormat = 'html'
150+
outputDirectory = "$buildDir/dokka"
151+
152+
configuration {
153+
moduleName = 'kotlin-numpy'
154+
155+
// Use to include or exclude non public members.
156+
includeNonPublic = false
157+
158+
// Do not create index pages for empty packages
159+
skipEmptyPackages = true
160+
161+
// Specifies the location of the project source code on the Web.
162+
// If provided, Dokka generates "source" links for each declaration.
163+
// Repeat for multiple mappings
164+
sourceLink {
165+
// Unix based directory relative path to the root of the project (where you execute gradle respectively).
166+
path = "./"
167+
168+
// URL showing where the source code can be accessed through the web browser
169+
url = "https://github.com/kotlin/kotlin-numpy/tree/master"
170+
//remove src/main/kotlin if you use "./" above
171+
172+
// Suffix which is used to append the line number to the URL. Use #L for GitHub
173+
lineSuffix = "#L"
174+
}
175+
176+
// Used for linking to JDK documentation
177+
jdkVersion = 8
178+
179+
// Disable linking to online kotlin-stdlib documentation
180+
noStdlibLink = false
181+
182+
// Disable linking to online JDK documentation
183+
noJdkLink = false
184+
}
185+
}

gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
kotlin.code.style=official
2-
version=0.1.4
2+
dokka_version=0.10.1
3+
version=0.1.4

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy