Friday, March 15, 2019

[tutorial][python] Matrix of ones

All elements in matrix are number 1, that’s so called Matrix of ones.

Reference:
https://en.wikipedia.org/wiki/Matrix_of_ones

Calculation with python:
A = np.array([[13,9,7],[8,7,4],[6,4,0]])
B = np.array([[1,1,1],[1,1,1],[1,1,1]])
print(A.dot(B))
Result :
[[29 29 29]
 [19 19 19]
 [10 10 10]]
It’s special that elements in 1st line in output matrix are all values 13+9+7 = 29, it’s the amount of the 1st line in  input elements.

All elements in 2nd lines of output matrix valued 19, which’s the amount of the 2nd line in  input elements (8+7+4).

All elements in 3rd lines of output matrix valued 10, which’s the amount of the 2rd line in  input elements (6+4+0).

1 comment :

  1. I'm a long-serving digital marketing professional and full-service as a social media marketing manager. I'm offering services at a competitively low cost. I have experience in keyword research, Article writing or Rewriting, Guest posting, B2B Lead Generation , Data Entry ,link building, web 2.0 backlink ,
    . I have 5 years of experience in the field and are assured of delivering High Quality and manual work. I have my own site name as AbidhTech. My Blog site also here. This is a Bangla deshi Science club site .

    ReplyDelete