Skip to content

Commit

Permalink
change small import, add missing @SInCE annotations
Browse files Browse the repository at this point in the history
Signed-off-by: Martmists <[email protected]>
  • Loading branch information
Martmists-GH committed Jul 21, 2024
1 parent 3525ba1 commit adccf5b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/commonMain/kotlin/com/martmists/ndarray/simd/F64Array.kt
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ interface F64Array {
* @param ax1 the first axis
* @param ax2 the second axis
* @return the transposed array
* @since 1.0.7
*/
fun transpose(ax1: Int = 0, ax2: Int = 1): F64Array

Expand Down Expand Up @@ -1468,6 +1469,7 @@ interface F64Array {
*
* @param shape the shape of the array
* @return the created array
* @since 1.0.7
*/
@JvmStatic
fun random(vararg shape: Int): F64Array = random(*shape, random = Random)
Expand All @@ -1491,6 +1493,7 @@ interface F64Array {
* @param stop the stop value
* @param num the number of values
* @return the created array
* @since 1.0.7
*/
@JvmStatic
@JvmOverloads
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,18 @@ interface F64FlatArray : F64Array {

/**
* Calculates the dot product of this array with another.
*
* @param other The other array to calculate the dot product with.
* @return The dot product of the two arrays.
*/
infix fun dot(other: F64Array): Double = (this * other).sum()

/**
* Calculates the outer product of this array with another.
*
* @param other The other array to calculate the outer product with.
* @return The outer product of the two arrays.
* @since 1.0.7
*/
infix fun outer(other: F64FlatArray): F64Array

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.martmists.ndarray.simd.impl

import com.martmists.ndarray.simd.F64Array
import com.martmists.ndarray.simd.F64Array.Companion.zeros
import com.martmists.ndarray.simd.F64FlatArray
import kotlin.math.*

Expand Down Expand Up @@ -129,7 +128,7 @@ internal open class F64FlatArrayImpl internal constructor(
override fun dot(other: F64Array) = balancedSum { unsafeGet(it) * other[it] }

override fun outer(other: F64FlatArray): F64Array {
val res = zeros(length, other.length)
val res = F64Array.zeros(length, other.length)
for (i in 0 until length) {
for (j in 0 until other.length) {
res[i, j] = unsafeGet(i) * other[j]
Expand Down

0 comments on commit adccf5b

Please sign in to comment.