This commit is contained in:
2020-10-23 15:17:42 -03:00
parent 6ae04c173f
commit 1d028851b3
93 changed files with 85 additions and 24 deletions

View File

@@ -0,0 +1,3 @@
{
"python.pythonPath": "/home/hideyoshi/anaconda3/bin/python"
}

15
yoshi-seals1.3.2/.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}

View File

@@ -0,0 +1,3 @@
{
"python.pythonPath": "/home/hideyoshi/anaconda3/bin/python"
}

View File

@@ -1,6 +1,6 @@
# Seals - Numeric Calculus # Seals - Numeric Calculus
This python package is made for applied Numeric Calculus of Linear Algebra. It is made with the following objectives in mind: This python namespace is made for applied Numeric Calculus of Linear Algebra. It is made with the following objectives in mind:
* Scan *csv* files to make a numpy matrix. * Scan *csv* files to make a numpy matrix.
@@ -20,17 +20,17 @@ This python package is made for applied Numeric Calculus of Linear Algebra. It i
## Syntax ## Syntax
The module *scan* has a function for *Numpy* arrays and *Pandas* dataframes, and used the following syntax `Seals.scan.np(path)` for *Numpy* and `Seals.scan.pd(path)` for *Pandas*, where `path` is the path to your directory. To call the package *scan* use the syntax: `from Seals import scan`. The package also has a function for *Numpy* arrays and *Pandas* dataframes, and used the following syntax `scan.np(path)` for *Numpy* and `scan.pd(path)` for *Pandas*, where `path` is the path to your directory.
The module *write* has a function for *Numpy* arrays and *Pandas* dataframes, and uses the following syntax `Seals.write.np(array,path)` for *Numpy*, where `array` is the matrix that you desire to output and `path` is the path to your directory, and `Seals.write.pd(df,path)` for *Pandas*, where `df` is the matrix that you desire to output and `path` is the path to your directory. To call the package *write* use the syntax: `from Seals import write`. The package also has a function for *Numpy* arrays and *Pandas* dataframes, and uses the following syntax `write.np(array,path)` for *Numpy*, where `array` is the matrix that you desire to output and `path` is the path to your directory, and `write.pd(df,path)` for *Pandas*, where `df` is the matrix that you desire to output and `path` is the path to your directory.
The module *insert* has a function for *matrix* and another for *vector*, and it has the following syntax `Seals.insert.function(array)`, where `insert` is the *Python Module* and `function` is either a `matrix` or a `vector` and `array` is either a *matrix* or a *vector*. To call the package *insert* use the syntax: `from Seals import insert`. The package also has a function for *matrix* and another for *vector*, and it has the following syntax `insert.function(array)`, where `insert` is the *Python Module* and `function` is either a `matrix` or a `vector` and `array` is either a *matrix* or a *vector*.
There is also a function that given a matrix it return all real eigen values There is also a function that given a matrix it return all real eigen values
### Processes ### Processes
To call the module `process` use the syntax: `sl = Seals.process`, where `sl` is an instance and to use a function you have to append the desired function in front of the instance like: `sl.identity(array)`. To call the module `process` use the syntax: `from Seals import process as sl`, where `sl` is an instance and to use a function you have to append the desired function in front of the instance like: `sl.identity(array)`.
* The function *identity* returns a *numpy* identity matrix of the order of the matrix passed into to it, and it has the following syntax `sl.identity(array)`, which `array` is a square matrix. * The function *identity* returns a *numpy* identity matrix of the order of the matrix passed into to it, and it has the following syntax `sl.identity(array)`, which `array` is a square matrix.

View File

@@ -24,9 +24,11 @@ def eigen(a):
k = 0 k = 0
l = np.ones((a.shape[0])) l = np.ones((a.shape[0]))
while (k < a.shape[0]): at = a #variavel temporaria para A
u = np.random.rand(a.shape[0],1) while (k < at.shape[0]):
u = np.random.rand(at.shape[0],1)
u = u/max(u.min(), u.max(), key=abs) u = u/max(u.min(), u.max(), key=abs)
ctrl = 0 ctrl = 0
@@ -34,7 +36,7 @@ def eigen(a):
while (ctrl != l[k]): while (ctrl != l[k]):
ctrl = l[k] ctrl = l[k]
u = a.dot(u) u = at.dot(u)
l[k] = max(u.min(), u.max(), key=abs) l[k] = max(u.min(), u.max(), key=abs)
u = u/l[k] u = u/l[k]
@@ -44,8 +46,26 @@ def eigen(a):
while (u[i] == 0): while (u[i] == 0):
i += 1 i += 1
a = a - (1/u[i])*u*a[i] at = at - (1/u[i])*u*at[i]
k += 1 k += 1
return l i = 0
b = np.random.rand(a.shape[0],a.shape[1])
while (i < l.shape[0]):
alpha = 0.999*l[i]
t = np.random.rand(a.shape[0],1)
b[i] = b[i]/max(b[i].min(), b[i].max(), key=abs)
t = l/max(l.min(), l.max(), key=abs)
while not (np.allclose(b[i],t,atol=10**(-17))):
t = b[i].copy()
b[i] = np.linalg.solve((a - alpha*np.identity(a.shape[0])),((l[i]-alpha)*t))
b[i] = b[i]/max(b[i].min(), b[i].max(), key=abs)
i += 1
return l, b

View File

@@ -24,9 +24,11 @@ def eigen(a):
k = 0 k = 0
l = np.ones((a.shape[0])) l = np.ones((a.shape[0]))
while (k < a.shape[0]): at = a #variavel temporaria para A
u = np.random.rand(a.shape[0],1) while (k < at.shape[0]):
u = np.random.rand(at.shape[0],1)
u = u/max(u.min(), u.max(), key=abs) u = u/max(u.min(), u.max(), key=abs)
ctrl = 0 ctrl = 0
@@ -34,7 +36,7 @@ def eigen(a):
while (ctrl != l[k]): while (ctrl != l[k]):
ctrl = l[k] ctrl = l[k]
u = a.dot(u) u = at.dot(u)
l[k] = max(u.min(), u.max(), key=abs) l[k] = max(u.min(), u.max(), key=abs)
u = u/l[k] u = u/l[k]
@@ -44,8 +46,26 @@ def eigen(a):
while (u[i] == 0): while (u[i] == 0):
i += 1 i += 1
a = a - (1/u[i])*u*a[i] at = at - (1/u[i])*u*at[i]
k += 1 k += 1
return l i = 0
b = np.random.rand(a.shape[0],a.shape[1])
while (i < l.shape[0]):
alpha = 0.999*l[i]
t = np.random.rand(a.shape[0],1)
b[i] = b[i]/max(b[i].min(), b[i].max(), key=abs)
t = l/max(l.min(), l.max(), key=abs)
while not (np.allclose(b[i],t,atol=10**(-17))):
t = b[i].copy()
b[i] = np.linalg.solve((a - alpha*np.identity(a.shape[0])),((l[i]-alpha)*t))
b[i] = b[i]/max(b[i].min(), b[i].max(), key=abs)
i += 1
return l, b

Binary file not shown.

View File

@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
setuptools.setup( setuptools.setup(
name="yoshi-seals", name="yoshi-seals",
version="1.3", version="1.3.2",
author="Vitor Hideyoshi", author="Vitor Hideyoshi",
author_email="vitor.h.n.batista@gmail.com", author_email="vitor.h.n.batista@gmail.com",
description="Numeric Calculus python module in the topic of Linear Algebra", description="Numeric Calculus python module in the topic of Linear Algebra",

View File

@@ -1,6 +1,6 @@
Metadata-Version: 2.1 Metadata-Version: 2.1
Name: yoshi-seals Name: yoshi-seals
Version: 1.3 Version: 1.3.2
Summary: Numeric Calculus python module in the topic of Linear Algebra Summary: Numeric Calculus python module in the topic of Linear Algebra
Home-page: https://github.com/HideyoshiNakazone/Seals-NumericCalculus.git Home-page: https://github.com/HideyoshiNakazone/Seals-NumericCalculus.git
Author: Vitor Hideyoshi Author: Vitor Hideyoshi
@@ -8,7 +8,7 @@ Author-email: vitor.h.n.batista@gmail.com
License: UNKNOWN License: UNKNOWN
Description: # Seals - Numeric Calculus Description: # Seals - Numeric Calculus
This python package is made for applied Numeric Calculus of Linear Algebra. It is made with the following objectives in mind: This python namespace is made for applied Numeric Calculus of Linear Algebra. It is made with the following objectives in mind:
* Scan *csv* files to make a numpy matrix. * Scan *csv* files to make a numpy matrix.
@@ -28,17 +28,17 @@ Description: # Seals - Numeric Calculus
## Syntax ## Syntax
The module *scan* has a function for *Numpy* arrays and *Pandas* dataframes, and used the following syntax `Seals.scan.np(path)` for *Numpy* and `Seals.scan.pd(path)` for *Pandas*, where `path` is the path to your directory. To call the package *scan* use the syntax: `from Seals import scan`. The package also has a function for *Numpy* arrays and *Pandas* dataframes, and used the following syntax `scan.np(path)` for *Numpy* and `scan.pd(path)` for *Pandas*, where `path` is the path to your directory.
The module *write* has a function for *Numpy* arrays and *Pandas* dataframes, and uses the following syntax `Seals.write.np(array,path)` for *Numpy*, where `array` is the matrix that you desire to output and `path` is the path to your directory, and `Seals.write.pd(df,path)` for *Pandas*, where `df` is the matrix that you desire to output and `path` is the path to your directory. To call the package *write* use the syntax: `from Seals import write`. The package also has a function for *Numpy* arrays and *Pandas* dataframes, and uses the following syntax `write.np(array,path)` for *Numpy*, where `array` is the matrix that you desire to output and `path` is the path to your directory, and `write.pd(df,path)` for *Pandas*, where `df` is the matrix that you desire to output and `path` is the path to your directory.
The module *insert* has a function for *matrix* and another for *vector*, and it has the following syntax `Seals.insert.function(array)`, where `insert` is the *Python Module* and `function` is either a `matrix` or a `vector` and `array` is either a *matrix* or a *vector*. To call the package *insert* use the syntax: `from Seals import insert`. The package also has a function for *matrix* and another for *vector*, and it has the following syntax `insert.function(array)`, where `insert` is the *Python Module* and `function` is either a `matrix` or a `vector` and `array` is either a *matrix* or a *vector*.
There is also a function that given a matrix it return all real eigen values There is also a function that given a matrix it return all real eigen values
### Processes ### Processes
To call the module `process` use the syntax: `sl = Seals.process`, where `sl` is an instance and to use a function you have to append the desired function in front of the instance like: `sl.identity(array)`. To call the module `process` use the syntax: `from Seals import process as sl`, where `sl` is an instance and to use a function you have to append the desired function in front of the instance like: `sl.identity(array)`.
* The function *identity* returns a *numpy* identity matrix of the order of the matrix passed into to it, and it has the following syntax `sl.identity(array)`, which `array` is a square matrix. * The function *identity* returns a *numpy* identity matrix of the order of the matrix passed into to it, and it has the following syntax `sl.identity(array)`, which `array` is a square matrix.

Binary file not shown.

Binary file not shown.