LESSON 50 OF 52 · CHAPTER 06

Linear Transform

matmul composition of a 2×3 and a 3×2 tile

ORIGINAL SOURCE

09-linear-transform.srp

// Composition of rectangular linear transformations.
bind left = tile([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], 2, 3);
bind right = tile([7.0, 8.0, 9.0, 10.0, 11.0, 12.0], 3, 2);
print(matmul(left, right));
EXPECTED OUTPUT

stdout

Verified
tile(2x2)[[58.0, 64.0], [139.0, 154.0]]

UNDERSTAND THE CODE

Explanation & practice

What this example teaches

matmul composition of a 2×3 and a 3×2 tile

Expected behavior

tile(2x2)[[58.0, 64.0], [139.0, 154.0]]

Practice: Read the source before looking at the output. Predict the values and their order, then use the pinned compiler to execute this lesson and compare the exact fixture. Identify which operation produces the result.

आयताकार मैट्रिक्स का गुणन

matmul(left, right) दो tile मैट्रिक्स का संयोजन करता है। 2×3 और 3×2 मैट्रिक्स से 2×2 परिणाम मिलता है। पहली पंक्ति की पहली संख्या के लिए 1×7 + 2×9 + 3×11 = 58। यह मैट्रिक्स सुविधा है, कोई पूर्ण वैज्ञानिक कम्प्यूटिंग प्रणाली नहीं।

आउटपुट: tile(2x2)[[58.0, 64.0], [139.0, 154.0]]।

अभ्यास: परिणाम में दो पंक्तियाँ और दो स्तंभ क्यों आते हैं?

Explanations are sourced from the project's English chapter guide and हिन्दी अध्याय. The Scarp program and output are unchanged.

TRY IT LOCALLY

Verify, then execute

Use the pinned compiler from the course root. Keep any imported _support files next to the source.

scarp verify examples/06-ai-foundations/09-linear-transform.srp scarp exec examples/06-ai-foundations/09-linear-transform.srp

The website does not run code. Read the CLI guide ↗

Pinned compiler: Scarp v0.0.6-alpha.3 · ceff07d9014f. No simulated output.