openGPMP
Open Source Mathematics Package
linalg.py
Go to the documentation of this file.
1 #!/usr/bin/python3
2 """
3 since the Matrix class is a template class, there are classes created
4 for both Doubles and Integers
5 
6 The template Matrix class and mtx struct were converted to type double
7 methods instead of declaring a method for each type.
8  *NOTE* there is a respective 'INTEGER' version of each method that
9  defaulted to type double, my recommendation is to use the default
10  methods that converted to type double as data will more than likely
11  follow the scheme.
12 
13  SCHEMES:
14  class Matrix (int) -> class MatrixI
15  an INTEGER type mtx struct is not possible given floating
16  point requirements for certain cases of cassert
17 """
18 from pygpmp import linalg
19 
20 mtx = linalg.Mtx()
21 
22 A = [1,2,3,4]
23 B = [2,3,1,4]
24 C = []
25 
26 A_int = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
27 B_int = [[9, 8, 7], [6, 5, 4], [3, 2, 1]]
28 C_int = []
29 res = mtx.std_mtx_add_int(A_int, B_int, C_int)
30 print(res)
31 
32 
33 # Examples of usage
34 #mtx_add_float_result = mtx.mtx_add([1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [0.0, 0.0, 0.0], 3)
35 #mtx_add_int_result = mtx.mtx_add([1, 2, 3], [4, 5, 6], [0, 0, 0], 3)
36 #mtx_add_res = mtx.mtx_add(A,B,C)
37 
38 #print(mtx_add_res)
39