How to resolve the algorithm Element-wise operations step by step in the Sidef programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Element-wise operations step by step in the Sidef programming language
Table of Contents
Problem Statement
This task is similar to:
Implement basic element-wise matrix-matrix and scalar-matrix operations, which can be referred to in other, higher-order tasks. Implement:
Extend the task if necessary to include additional basic operations, which should not require their own specialised task.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Element-wise operations step by step in the Sidef programming language
Source code in the sidef programming language
var m1 = [[3,1,4],[1,5,9]]
var m2 = [[2,7,1],[8,2,2]]
say ":: Matrix-matrix operations"
say (m1 ~W+ m2)
say (m1 ~W- m2)
say (m1 ~W* m2)
say (m1 ~W/ m2)
say (m1 ~W// m2)
say (m1 ~W** m2)
say (m1 ~W% m2)
say "\n:: Matrix-scalar operations"
say (m1 ~S+ 42)
say (m1 ~S- 42)
say (m1 ~S/ 42)
say (m1 ~S** 10)
# ...
say "\n:: Scalar-matrix operations"
say (m1 ~RS+ 42)
say (m1 ~RS- 42)
say (m1 ~RS/ 42)
say (m1 ~RS** 10)
# ...
You may also check:How to resolve the algorithm Main step of GOST 28147-89 step by step in the Racket programming language
You may also check:How to resolve the algorithm Archimedean spiral step by step in the Amazing Hopper programming language
You may also check:How to resolve the algorithm RCRPG step by step in the D programming language
You may also check:How to resolve the algorithm Dot product step by step in the Oforth programming language
You may also check:How to resolve the algorithm Find if a point is within a triangle step by step in the jq programming language