العرضar

⊗

Translation status: العربية reader-locale proof. Term names and code fences follow the ar pack; supporting prose may still be English.

Glyph outer product: vector ⊗ vector yields the rank-summed matrix of pairwise products.

Syntax: <expression> ⊗ <expression>

Category#

arithmetic

  • vector
  • matrix

Examples#

radix/corpus/tensor/glyph-outer.fab (canonical · operator-group)#

Glyph outer product: vector ⊗ vector yields the rank-summed matrix of pairwise products.

# =============================================================================
# ⊗ — glyph outer product (متجه ⊗ متجه → مصفوفة).
# =============================================================================
#
# What this teaches:
#   • Outer product — `a ⊗ b` pairs every left مسار with every right مسار into a مصفوفة
#   • Rank sum — the result rank is the sum of the operand ranks (1 + 1 = 2)
#
# Common mistakes:
#   • Kronecker on matrices — مصفوفة ⊗ مصفوفة is deferred (Phase 2); only متجه ⊗ متجه lowers in Phase 1
#   • row/column orientation — rows come from the left متجه, columns from the right متجه
#
# See also: متجه, مصفوفة
# =============================================================================



# متجه ⊗ متجه → مصفوفة (rank sum)
#
# WHY: `⊗` is the outer/Kronecker glyph. Phase 1 registers متجه ⊗ متجه →
# مصفوفة (rows = left width, columns = right width); موتر Kronecker is
# deferred with an explicit diagnostic. Pairwise products fill the result.
#
# a = [1.0, 2.0, 3.0]  b = [4.0, 5.0]
# a ⊗ b = [[1*4, 1*5], [2*4, 2*5], [3*4, 3*5]]
#        = [[4.0, 5.0], [8.0, 10.0], [12.0, 15.0]]
#
# EXPECTED stdout:
#   [[4.0, 5.0], [8.0, 10.0], [12.0, 15.0]]

main {
    const vf32[3] a ← [1.0, 2.0, 3.0] ↦ vf32[3]
    const vf32[2] b ← [4.0, 5.0] ↦ vf32[2]
    const مصفوفة<f32, [3, 2]> o ← a ⊗ b
    print o
}

Expected output:

[[4.0, 5.0], [8.0, 10.0], [12.0, 15.0]]