Element by element tensor multiplication in python


I am trying to solve a problem in computational algebra using python.

Basically given two sets, say A={a,b} and B={e}, I need to compute the element by element tensor products and get a final set say C={a\tensor{e},b\tensor{e}} containing these products of elements.

I can do an element by element multiplication using arrays with numbers but I can't do an element by element tensor multiplication of letters instead of numbers.


Not sure if I understood correctly, this below code multiplies each letter of one set with each letter of the the other set

def getProduct(A,B): prod=[] for a in A: for b in B: prod.append(a+b) return prod A=['a','b'] B=['e'] print(getProduct(A,B)) Output: ['ae', 'be']


  • Image not displaying - where is style “display: none” coming from?
  • Accessing the expression language in javascript of a jsp page
  • Is there an Kotlin equivalent `with` function in Swift?
  • Is using new keyword in method signature generally just for readability?
  • How to turn of electric-indent-mode for specific Major mode?
  • CodenameOne Error while trying to read theme property
  • Why I getting the last promise?
  • Make localStorage Data read-Only
  • expand ipv6 address in shell script
  • Condition on a timestamp column to select data for a year
  • How can I send data in text field using Selenium?
  • I am trying to create an app in android to insert data into sql server through a web service.
  • GAE python NDB projection query working in development but not in production
  • Intersection of characters in two strings
  • React / Webpack - “Module parse failed: Unexpected token - You may need an appropriate loader to han
  • Multiple git user in single device
  • Firebase suddenly reports invalid signature
  • Hyperlink to Outlook Attachment
  • Use 2D Text into 3D scenes in JavaFX results in blurry texts
  • Custom progress dialog not working
  • Modifying native query cannot have named parameter bindings?
  • PHP: Need to close STDIN in order to read STDOUT?
  • Use AutoIt with java applications
  • Set SelectedIndex of ListView in FlipView_SelectionChanged event
  • Wireshark Display Filter for Unique Source/Destination IP and Protocol
  • Rotating Towards Path in OpenGL
  • Android: Unable to detect vertical plane
  • Will this work on all screen sizes?
  • Debug `Unexpected end of JSON input Error` on content script
  • Apple Mach-O Linker error (“duplicate symbol”)
  • Cross compile glibc for arm, got undefined reference to some unwind functions
  • Angular FormGroup won't update it's value immediately after patchValue or setValue