Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning SciPy for Numerical and Scientific Computing Second Edition

You're reading from   Learning SciPy for Numerical and Scientific Computing Second Edition Quick solutions to complex numerical problems in physics, applied mathematics, and science with SciPy

Arrow left icon
Product type Paperback
Published in Feb 2015
Publisher Packt
ISBN-13 9781783987702
Length 188 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Toc

Matrix methods

Besides inheriting all the array methods, matrices enjoy four extra attributes: T for transpose, H for conjugate transpose, I for inverse, and A to cast as ndarray:

>>> A = numpy.matrix("1+1j, 2-1j; 3-1j, 4+1j")
>>> print (A.T); print (A.H)

The output is shown as follows:

[[ 1.+1.j  3.-1.j]
 [ 2.-1.j  4.+1.j]]
[[ 1.-1.j  3.+1.j]
 [ 2.+1.j  4.-1.j]]

Operations between matrices

We have briefly covered the most basic operation between two matrices; the matrix product. For any other kind of product, we resort to the basic utilities in the NumPy libraries, as: dot product for arrays or vectors (dot, vdot), inner and outer products of two arrays (inner, outer), tensor dot product along specified axes (tensordot), or the Kronecker product of two arrays (kron).

Let's see an example of creating an orthonormal basis.

Create an orthonormal basis in the nine-dimensional real space from an orthonormal basis of the three-dimensional real space.

Let's choose...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at R$50/month. Cancel anytime