{"id":14563,"date":"2019-01-05T14:22:49","date_gmt":"2019-01-05T19:22:49","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/basic-matrix-operations\/"},"modified":"2019-01-05T14:22:49","modified_gmt":"2019-01-05T19:22:49","slug":"basic-matrix-operations","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=14563","title":{"rendered":"Basic Matrix Operations:"},"content":{"rendered":"<h2 dir=\"ltr\">Basic Matrix Operations:<\/h2>\n<p dir=\"ltr\">def matrix_multiplication ( m, n ):<\/p>\n<p dir=\"ltr\"> # Creates a list containing 5 lists, each of 8 items, all set to 0<\/p>\n<p dir=\"ltr\"> o_row, o_col = len(m), len(n[0]);<\/p>\n<p dir=\"ltr\"> output_matrix = [[0 for x in range(o_row)] for y in range(o_col)]<\/p>\n<p dir=\"ltr\"> one_output_cell = 0<\/p>\n<p dir=\"ltr\"> rowCount = 0<\/p>\n<p dir=\"ltr\"> colCount = 0<\/p>\n<p dir=\"ltr\"> temp = 0<\/p>\n<p dir=\"ltr\"> for aRow in m:<\/p>\n<p dir=\"ltr\"> colCount = 0<\/p>\n<p dir=\"ltr\"> for aCol in range(len(n[0])):<\/p>\n<p dir=\"ltr\"> for anItem in aRow:<\/p>\n<p dir=\"ltr\"> temp += anItem * n[colCount][rowCount]<\/p>\n<p dir=\"ltr\"> colCount += 1<\/p>\n<p dir=\"ltr\"> output_matrix[rowCount][colCount] = temp<\/p>\n<p dir=\"ltr\"> temp = 0<\/p>\n<p dir=\"ltr\"> rowCount += 1<\/p>\n<p dir=\"ltr\"> &quot;&quot;&quot;<\/p>\n<p dir=\"ltr\"> for row in range(o_row):<\/p>\n<p dir=\"ltr\"> out_col = 0<\/p>\n<p dir=\"ltr\"> for col in range(o_col):<\/p>\n<p dir=\"ltr\"> one_output_cell += m[row][col] * n[col][row]<\/p>\n<p dir=\"ltr\"> output_matrix[row][out_col] = one_output_cell<\/p>\n<p dir=\"ltr\"> one_output_cell = 0<\/p>\n<p dir=\"ltr\"> out_col += 1<\/p>\n<p dir=\"ltr\"> &quot;&quot;&quot;<\/p>\n<p dir=\"ltr\"> return(output_matrix)<\/p>\n<p dir=\"ltr\"># 3 * 2<\/p>\n<p dir=\"ltr\">m = [ <\/p>\n<p dir=\"ltr\" style=\"line-height:1.38;margin-top:0pt;margin-bottom:0pt\"><span style=\"font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap\"> \u00a0\u00a0\u00a0\u00a0[1, 2],<\/p>\n<p dir=\"ltr\"> [1,2],<\/p>\n<p dir=\"ltr\"> [1,2]<\/p>\n<p dir=\"ltr\"> ]<\/p>\n<p dir=\"ltr\"># 2 * 3<\/p>\n<p dir=\"ltr\">n = [ <\/p>\n<p><\/span><\/p>\n<p dir=\"ltr\" style=\"line-height:1.38;margin-top:0pt;margin-bottom:0pt\"><span style=\"font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[1, 2, 3],<\/p>\n<p dir=\"ltr\"> [1, 2, 3 ]<\/p>\n<p dir=\"ltr\"> ]<\/p>\n<p dir=\"ltr\">m[2][1]*n[1][2]<\/p>\n<p dir=\"ltr\">print(n[0][0])<\/p>\n<p dir=\"ltr\">output_matrix = matrix_multiplication (m, n)<\/p>\n<p dir=\"ltr\">print(output_matrix)<\/p>\n<p><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Basic Matrix Operations: def matrix_multiplication ( m, n ): # Creates a list containing 5 lists, each of 8 items, all set to 0 o_row, o_col = len(m), len(n[0]); output_matrix = [[0 for x in range(o_row)] for y in range(o_col)] one_output_cell = 0 rowCount = 0 colCount = 0 temp = 0 for aRow in &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=14563\">Continue reading<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[182],"tags":[],"class_list":["post-14563","post","type-post","status-publish","format-standard","hentry","category---blog","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":14575,"url":"http:\/\/bangla.sitestree.com\/?p=14575","url_meta":{"origin":14563,"position":0},"title":"\u09ae\u09c7\u09b6\u09bf\u09a8 \u09b2\u09be\u09b0\u09a8\u09bf\u0982 \u0983 Implement: Multivariate Regression: Python","author":"Sayed","date":"January 7, 2019","format":false,"excerpt":"\u09ae\u09c7\u09b6\u09bf\u09a8 \u09b2\u09be\u09b0\u09a8\u09bf\u0982 \u0983 Implement: Multivariate Regression: Python \u09b6\u09a4 \u09ad\u09be\u0997 \u09b8\u09a0\u09bf\u0995 \u09a8\u09be\u0989 \u09b9\u09a4\u09c7 \u09aa\u09be\u09b0\u09c7\u0964 Theory reference: https:\/\/www.cmpe.boun.edu.tr\/~ethem\/i2ml\/slides\/v1-1\/i2ml-chap5-v1-1.pdf . This is an approximate solution to start with. Understand the theory and then adjust\/fix\/improve import numpy as np import random print('Iterations: rows: Please enter the number of samples for each variable\/dimension') n_number_of_samples_rows =\u2026","rel":"","context":"In &quot;\u09ac\u09cd\u09b2\u0997 \u0964 Blog&quot;","block_context":{"text":"\u09ac\u09cd\u09b2\u0997 \u0964 Blog","link":"http:\/\/bangla.sitestree.com\/?cat=182"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26828,"url":"http:\/\/bangla.sitestree.com\/?p=26828","url_meta":{"origin":14563,"position":1},"title":"DatabaseUtilities.java: Several general-purpose utilities discussed and used in the chapter. #Programming Code Examples #Java\/J2EE\/J2ME #JDBC","author":"Author-Check- Article-or-Video","date":"May 2, 2021","format":false,"excerpt":"package cwp; import java.sql.*; \/** Three database utilities: * 1) getQueryResults. Connects to a database, executes * a query, retrieves all the rows as arrays * of strings, and puts them inside a DBResults * object. Also places the database product name, * database version, and the names of all\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":68578,"url":"http:\/\/bangla.sitestree.com\/?p=68578","url_meta":{"origin":14563,"position":2},"title":"C++ Syntax: in brief #77","author":"Author-Check- Article-or-Video","date":"August 5, 2021","format":false,"excerpt":"Just to review cout < < \"Enter two integers:\" << endl; \/\/ output to screen cin >> n >> m; \/\/ Note: Using endl prints out a newline and flushes the output buffer.cout << \"number of digits in char: \" << numeric_limits::digits < < 'n'; if (n > m) {\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26487,"url":"http:\/\/bangla.sitestree.com\/?p=26487","url_meta":{"origin":14563,"position":3},"title":"C++ Syntax: in brief #Programming #C++","author":"Author-Check- Article-or-Video","date":"April 26, 2021","format":false,"excerpt":"This will make sense only if you want to refresh your memory on C++ syntax. cout << \"Enter two integers:\" << endl; \/\/ output to screen cin >> n >> m; \/\/ Note: Using endl prints out a newline and flushes the output buffer. cout << \"number of digits in\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26830,"url":"http:\/\/bangla.sitestree.com\/?p=26830","url_meta":{"origin":14563,"position":4},"title":"DBResults.java: Class to store completed results of a JDBC Query. Differs from a ResultSet in several ways #Programming Code Examples #Java\/J2EE\/J2ME #JDBC","author":"Author-Check- Article-or-Video","date":"May 2, 2021","format":false,"excerpt":"# DBResults.java Class to store completed results of a JDBC Query. Differs from a ResultSet in several ways: * ResultSet doesn?t necessarily have all the data; reconnection to database occurs as you ask for later rows. * This class stores results as strings, in arrays. * This class includes DatabaseMetaData\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7885,"url":"http:\/\/bangla.sitestree.com\/?p=7885","url_meta":{"origin":14563,"position":5},"title":"\u09b8\u09bf \u098f\u09ac\u0982  \u0985\u09cd\u09af\u09be\u09b0\u09c7 : Array in C","author":"Author-Check- Article-or-Video","date":"March 29, 2015","format":false,"excerpt":"int marks[4][10] = {{80, 70, 92, 78, 58, 83, 85, 66, 99, 81}, {75, 67, 55, 100, 91, 84, 79, 61, 90, 97}, {98, 67, 75, 89, 81, 83, 80, 90, 88, 77}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; \u00a0 #include <stdio.h> int main() { int\u2026","rel":"","context":"In &quot;\u09a1\u099f \u09a8\u09c7\u099f\/.Net&quot;","block_context":{"text":"\u09a1\u099f \u09a8\u09c7\u099f\/.Net","link":"http:\/\/bangla.sitestree.com\/?cat=264"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/14563","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14563"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/14563\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14563"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14563"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14563"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}