___|  _ \   |  |    |   |_ _|\ \     / ____|
 |     |   |  |  |    |   |  |  \ \   /  __|
 |   | |   | ___ __|  ___ |  |   \ \ /   |
\____|\___/     _|   _|  _|___|   \_/   _____| 

 --- A GOPHER-LIKE INTERFACE FOR HIVE BLOCKCHAIN ---

Know the Matrix and Its Operations in Java

BY: @erikaa | CREATED: Feb. 27, 2018, 8:54 a.m. | VOTES: 5 | PAYOUT: $0.00 | [ VOTE ]

[IMAGE: https://steemitimages.com/DQmRUa2Zkg8nj269h38CtfKUKi2BtnN6KX4zAZvXazHvYgK/pertama.png]
An array in Java can be formed by defining a two-dimensional array. Then we can fill each element manually by accessing each element. Here is an example:
[IMAGE: https://steemitimages.com/DQme6Ei8bXzxNj1yhwUrZ8hN3ZVQSLxHD6MYGXytqnXC9Hu/kedua.png]
In this tutorial, we will only discuss basic matrix operations such as addition, subtraction, and multiplication.

Accessing Matrix Elements

We can use nested loop for to access an element at a certain coordinate. For example let's look at the following source code:[IMAGE: https://steemitimages.com/DQmPSipy6ABGQ11kL5y1MJscP9zGo2hepkATw6Uoch9iovf/ketiga.png]
Here is the output of the source code:
[IMAGE: https://steemitimages.com/DQmVCxti4UDhGER6aKfMcD2uG33AHgyZaNUtWA6zJSwCCgE/ke%20empat.png]

Reducing Two Matrices

To perform the matrix reduction, each element of the two matrices we subtract then the result into a new element of a matrix. The following example is the source code in Java:[IMAGE: https://steemitimages.com/DQmWmRbADYw9fg8TZVgEZdAFm98GX1B3eGHzT5FK1dBJCQt/ke%20lima.png]If the source code we run, then the output will appear as follows:[IMAGE: https://steemitimages.com/DQmVQMGsJH6vKLVwxYvABJaymyuhtN6hwmPrFTrbXosDYiH/terakhir.png]

source of :
https://www.codepolitan.com/tutorial/mengenal-matriks-dan-operasinya-di-java

Follow Me :Erikaa

TAGS: [ #science ] [ #programming ] [ #fiction ] [ #bussy ]

Replies

NO REPLIES FOUND.

[ BACK TO TRENDING ] [ BACK TO MENU ]
CMD>