How to resolve the algorithm Kronecker product step by step in the Wren programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Kronecker product step by step in the Wren programming language

Table of Contents

Problem Statement

Implement the   Kronecker product   of two matrices (arbitrary sized) resulting in a block matrix.

Show results for each of the following two samples:

Sample 1 (from Wikipedia): Sample 2:

See implementations and results below in JavaScript and PARI/GP languages.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Kronecker product step by step in the Wren programming language

Source code in the wren programming language

import "./fmt" for Fmt
import "./matrix" for Matrix

var a1 = [
    [1, 2],
    [3, 4]
]

var a2 =  [
    [0, 5],
    [6, 7]
]

var a3 = [
    [0, 1, 0],
    [1, 1, 1],
    [0, 1, 0]
]

var a4 = [
    [1, 1, 1, 1],
    [1, 0, 0, 1],
    [1, 1, 1, 1]
]

var m1 = Matrix.new(a1)
var m2 = Matrix.new(a2)
Fmt.mprint(m1.kronecker(m2), 2, 0)
System.print()
var m3 = Matrix.new(a3)
var m4 = Matrix.new(a4)
Fmt.mprint(m3.kronecker(m4), 2, 0)


  

You may also check:How to resolve the algorithm Modular inverse step by step in the Mathematica/Wolfram Language programming language
You may also check:How to resolve the algorithm Percentage difference between images step by step in the Perl programming language
You may also check:How to resolve the algorithm Loops/Break step by step in the uBasic/4tH programming language
You may also check:How to resolve the algorithm File input/output step by step in the Raku programming language
You may also check:How to resolve the algorithm Sierpinski pentagon step by step in the JavaScript programming language