jagomart
digital resources
picture1_Programming Computer Vision With Python Pdf 196748 | Cv Hw1


 155x       Filetype PDF       File size 0.10 MB       Source: wp.kntu.ac.ir


File: Programming Computer Vision With Python Pdf 196748 | Cv Hw1
fundamentals of computer vision undergrad b nasihatkon homework 1 python programming one way to represent a matrix in python is to use a list of rows of a matrix a ...

icon picture PDF Filetype PDF | Posted on 07 Feb 2023 | 2 years ago
Partial capture of text on file.
        
       Fundamentals of Computer Vision (Undergrad) - B. Nasihatkon  
                                     
                                     
         Homework 1 - Python Programming 
        
                               
       One way to represent a matrix in python is to use a list of rows of a matrix (a list of 
       lists or a nested list). For example the matrix  
                  
                  
                  
                  
                  
       Can be represented as: 
       A = [ [0 2 -1], [-2 0 -4], [1 4 0] ]  
        
       Your task is to write a function named ​mul​ that receives two matrices as arguments 
       and returns their product as a matrix: 
        def​ mul(A,B): 
          ​  """ 
            returns the product of the matrix A by the matrix B 
            returns the empty list [] if the matrix dimensions  
            are not consistent for multiplication 
            """ 
            # function body 
         
         
        # test the function 
        A = [[1, 0, 0], 
             [0, 0, 3], 
             [0, 2, 0]]; 
         
        B = [[1, 1], 
             [0, .5], 
             [2, 1/3.0]]; 
         
        C = [[ 1,  0,  0 ], 
             [ 0,  0,  0.5], 
             [ 0,  1/3.0, 0]] 
         
        print​ mul(A,B); 
        print​ mul(B,A); 
        print​ mul(A,C) 
       The output of the above piece of code is 
        
       Fundamentals of Computer Vision (Undergrad) - B. Nasihatkon  
                                     
                                     
        
        [[1, 1.0], [6, 1.0], [0, 1.0]] 
        [] 
        [[1, 0.0, 0.0], [0, 1.0, 0.0], [0, 0.0, 1.0]] 
        
         ● The arguments A and B must be of the above format (nested list). ​Do not use 
          numpy arrays or matrices.  
         ● Assume each matrix is consistent (are rows are of the same size). But the 
          dimensions might to be consistent for multiplication (in which case you need 
          to return the empty list [ ]) 
        
        
The words contained in this file might help you see if this file matches what you are looking for:

...Fundamentals of computer vision undergrad b nasihatkon homework python programming one way to represent a matrix in is use list rows lists or nested for example the can be represented as your task write function named mul that receives two matrices arguments and returns their product def by empty if dimensions are not consistent multiplication body test c print output above piece code must format do numpy arrays assume each same size but might which case you need return...

no reviews yet
Please Login to review.