broadcast

vecxt.broadcast
object broadcast

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
broadcast.type

Members list

Type members

Classlikes

class BroadcastException(msg: String) extends RuntimeException

Attributes

Supertypes
class RuntimeException
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
class ShapeMismatchException(msg: String) extends RuntimeException

Attributes

Supertypes
class RuntimeException
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

inline def broadcastPair[A](a: NDArray[A], b: NDArray[A]): (NDArray[A], NDArray[A])

Broadcast both operands to their common shape.

Broadcast both operands to their common shape.

Returns (a', b') where both have shape == broadcastShape(a.shape, b.shape). Throws BroadcastException if shapes are incompatible.

Attributes

inline def broadcastShape(a: Array[Int], b: Array[Int]): Array[Int]

Compute the output shape for broadcasting two shapes.

Compute the output shape for broadcasting two shapes.

Shapes are right-aligned; a dimension of 1 expands to match the other. Throws BroadcastException if shapes are incompatible.

Attributes

inline def broadcastStrides(arr: NDArray[_], outShape: Array[Int]): Array[Int]

Compute broadcast-extended strides for arr viewed as having outShape.

Compute broadcast-extended strides for arr viewed as having outShape.

Prepends 0s for dimensions padded on the left; sets stride to 0 for original dimensions of size 1 (broadcast).

Attributes

inline def sameShape(a: Array[Int], b: Array[Int]): Boolean

True if two shapes have the same rank and element-wise equal dimensions.

True if two shapes have the same rank and element-wise equal dimensions.

Attributes

Extensions

Extensions

extension [A](arr: NDArray[A])
inline def broadcastTo(targetShape: Array[Int]): NDArray[A]

Return a zero-copy view of this NDArray broadcast to targetShape.

Return a zero-copy view of this NDArray broadcast to targetShape.

Dimensions of size 1 are expanded via stride 0; prepended dimensions (when targetShape has more dims) also get stride 0. Throws BroadcastException if shapes are incompatible.

Attributes