Linear algebra using JNumeric
Code: "jnumeric.py". Programming language: Python
DMelt Version 1.4. Last modified: 06/24/2017. License: Pro
https://datamelt.org/code/cache/jnumeric_4372.py
To run this script using the DMelt IDE,
copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.
from jnumeric.JNumeric import *
a = array( [2,3,4] )
print type(a)
print a
print "Operations:"
a = array( [20,30,40,50] )
b = arange( 4 )
c = a-b
print c
print "Elementwise product:"
A = array( [[1,1], [0,1]] )
B = array( [[2,0], [3,4]] )
print A*B # elementwise product
print dot(A,B) # matrix product
print "Functions:"
BB=sqrt(B)
CC=exp(BB)
print CC
D=sum(CC)
print "Reshape:"
a = arange(12)
print reshape(a,[3,4])
print "Linear algebra:"
a = array([[1.0, 2.0], [3.0, 4.0]])
print "Transpose=\n",transpose(a)
print "Trace=",trace(a)
print "Dot=", dot(a,a)
You see the box below because you did not login.