Kết xuấtvi

⊗

Translation status: Tiếng Việt reader-locale proof. Term names and code fences follow the vi 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 (vectơ ⊗ vectơ → ma_trận).
# =============================================================================
#
# What this teaches:
#   • Outer product — `a ⊗ b` pairs every left làn with every right làn into a ma_trận
#   • Rank sum — the result rank is the sum of the operand ranks (1 + 1 = 2)
#
# Common mistakes:
#   • Kronecker on matrices — ma_trận ⊗ ma_trận is deferred (Phase 2); only vectơ ⊗ vectơ lowers in Phase 1
#   • row/column orientation — rows come from the left vectơ, columns from the right vectơ
#
# See also: vectơ, ma_trận
# =============================================================================



# vectơ ⊗ vectơ → ma_trận (rank sum)
#
# WHY: `⊗` is the outer/Kronecker glyph. Phase 1 registers vectơ ⊗ vectơ →
# ma_trận (rows = left width, columns = right width); ten_xo 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 ma_trận<f32, [3, 2]> o ← a ⊗ b
    print o
}

Expected output:

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