diff --git a/Source Code - Seals/__init__.py b/Source Code - Seals/__init__.py new file mode 100644 index 0000000..e5d934d --- /dev/null +++ b/Source Code - Seals/__init__.py @@ -0,0 +1,18 @@ +# Seals - Program made for educational intent, can be freely distributed +# and can be used for economical intent. I will not take legal actions +# unless my intelectual propperty, the code, is stolen or change without permission. + +# Copyright (C) 2020 VItor Hideyoshi Nakazone Batista + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published by +# the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. \ No newline at end of file diff --git a/Source Code - Seals/__pycache__/__init__.cpython-37.pyc b/Source Code - Seals/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000..f8ca22e Binary files /dev/null and b/Source Code - Seals/__pycache__/__init__.cpython-37.pyc differ diff --git a/Source Code - Seals/eigen/__init__.py b/Source Code - Seals/eigen/__init__.py new file mode 100644 index 0000000..efa3006 --- /dev/null +++ b/Source Code - Seals/eigen/__init__.py @@ -0,0 +1,20 @@ +# Seals - Program made for educational intent, can be freely distributed +# and can be used for economical intent. I will not take legal actions +# unless my intelectual propperty, the code, is stolen or change without permission. + +# Copyright (C) 2020 VItor Hideyoshi Nakazone Batista + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published by +# the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +from .eigen import eigen \ No newline at end of file diff --git a/Source Code - Seals/eigen/__pycache__/__init__.cpython-37.pyc b/Source Code - Seals/eigen/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000..4359996 Binary files /dev/null and b/Source Code - Seals/eigen/__pycache__/__init__.cpython-37.pyc differ diff --git a/Source Code - Seals/eigen/__pycache__/eigen.cpython-37.pyc b/Source Code - Seals/eigen/__pycache__/eigen.cpython-37.pyc new file mode 100644 index 0000000..ebbe9a2 Binary files /dev/null and b/Source Code - Seals/eigen/__pycache__/eigen.cpython-37.pyc differ diff --git a/Source Code - Seals/eigen/eigen.py b/Source Code - Seals/eigen/eigen.py new file mode 100644 index 0000000..52c62f2 --- /dev/null +++ b/Source Code - Seals/eigen/eigen.py @@ -0,0 +1,64 @@ +# Seals - Program made for educational intent, can be freely distributed +# and can be used for economical intent. I will not take legal actions +# unless my intelectual propperty, the code, is stolen or change without permission. + +# Copyright (C) 2020 VItor Hideyoshi Nakazone Batista + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published by +# the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import numpy as np + +def eigen(a): + + k = 0 + l = np.ones((a.shape[0])) + + at = a #variavel temporaria para A + b = np.random.rand(a.shape[0],a.shape[1]) + + while (k < at.shape[0]): + + u = np.random.rand(at.shape[0],1) + u = u/max(u.min(), u.max(), key=abs) + + ctrl = 0 + + while (ctrl != l[k]): + + ctrl = l[k] + u = at.dot(u) + l[k] = max(u.min(), u.max(), key=abs) + u = u/l[k] + + alpha = 0.999*l[k] + + t = np.random.rand(a.shape[0],1) + + b[k] = b[k]/max(b[k].min(), b[k].max(), key=abs) + t = l/max(l.min(), l.max(), key=abs) + + while not (np.allclose(b[k],t,atol=10**(-17))): + t = b[k].copy() + b[k] = np.linalg.solve((a - alpha*np.identity(a.shape[0])),((l[k]-alpha)*t)) + b[k] = b[k]/max(b[k].min(), b[k].max(), key=abs) + + i = 0 + + while (u[i] == 0): + i += 1 + + at = at - (1/u[i])*u*at[i] + k += 1 + + return l, b \ No newline at end of file diff --git a/Source Code - Seals/insert/__init__.py b/Source Code - Seals/insert/__init__.py new file mode 100644 index 0000000..08ffc8f --- /dev/null +++ b/Source Code - Seals/insert/__init__.py @@ -0,0 +1,21 @@ +# Seals - Program made for educational intent, can be freely distributed +# and can be used for economical intent. I will not take legal actions +# unless my intelectual propperty, the code, is stolen or change without permission. + +# Copyright (C) 2020 VItor Hideyoshi Nakazone Batista + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published by +# the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +from .insert import matrix +from .insert import vector \ No newline at end of file diff --git a/Source Code - Seals/insert/__pycache__/__init__.cpython-37.pyc b/Source Code - Seals/insert/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000..60ad7e4 Binary files /dev/null and b/Source Code - Seals/insert/__pycache__/__init__.cpython-37.pyc differ diff --git a/Source Code - Seals/insert/__pycache__/insert.cpython-37.pyc b/Source Code - Seals/insert/__pycache__/insert.cpython-37.pyc new file mode 100644 index 0000000..9bc1b5a Binary files /dev/null and b/Source Code - Seals/insert/__pycache__/insert.cpython-37.pyc differ diff --git a/Source Code - Seals/insert/insert.py b/Source Code - Seals/insert/insert.py new file mode 100644 index 0000000..003e274 --- /dev/null +++ b/Source Code - Seals/insert/insert.py @@ -0,0 +1,46 @@ +# Seals - Program made for educational intent, can be freely distributed +# and can be used for economical intent. I will not take legal actions +# unless my intelectual propperty, the code, is stolen or change without permission. + +# Copyright (C) 2020 VItor Hideyoshi Nakazone Batista + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published by +# the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +def matrix(matrix): + + i = 0 + + while (i < matrix.shape[0]): + + j = 0 + + while (j < matrix.shape[1]): + + matrix[i][j] = float(input('Insira o elemento {}x{}: '.format((i+1),(j+1)))) + j += 1 + + i += 1 + + return matrix + +def vector(vector): + + j=0 + + while (j < vector.shape[0]): + + vector[j] = float(input('Insira o elemento b{}: '.format((j+1)))) + j += 1 + + return vector \ No newline at end of file diff --git a/Source Code - Seals/process/__init__.py b/Source Code - Seals/process/__init__.py new file mode 100644 index 0000000..985e6e0 --- /dev/null +++ b/Source Code - Seals/process/__init__.py @@ -0,0 +1,25 @@ +# Seals - Program made for educational intent, can be freely distributed +# and can be used for economical intent. I will not take legal actions +# unless my intelectual propperty, the code, is stolen or change without permission. + +# Copyright (C) 2020 VItor Hideyoshi Nakazone Batista + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published by +# the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +from .process import identity +from .process import gauss +from .process import inverse +from .process import cholesky +from .process import decomposition +from .process import cramer \ No newline at end of file diff --git a/Source Code - Seals/process/__pycache__/__init__.cpython-37.pyc b/Source Code - Seals/process/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000..9e70d8d Binary files /dev/null and b/Source Code - Seals/process/__pycache__/__init__.cpython-37.pyc differ diff --git a/Source Code - Seals/process/__pycache__/process.cpython-37.pyc b/Source Code - Seals/process/__pycache__/process.cpython-37.pyc new file mode 100644 index 0000000..0a056ee Binary files /dev/null and b/Source Code - Seals/process/__pycache__/process.cpython-37.pyc differ diff --git a/Source Code - Seals/process/process.py b/Source Code - Seals/process/process.py new file mode 100644 index 0000000..968cd9c --- /dev/null +++ b/Source Code - Seals/process/process.py @@ -0,0 +1,203 @@ +# Seals - Program made for educational intent, can be freely distributed +# and can be used for economical intent. I will not take legal actions +# unless my intelectual propperty, the code, is stolen or change without permission. + +# Copyright (C) 2020 VItor Hideyoshi Nakazone Batista + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published by +# the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import numpy as np +import math + +def identity(matrix): + + i = 0 + + while (i < matrix.shape[0]): + + j = 0 + + while (j < matrix.shape[0]): + + if (i == j): + + matrix[i][j] = 1 + + elif (i != j): + + matrix[i][j] = 0 + + j += 1 + + i += 1 + + return matrix + +def gauss(matrix): + + i = 0 + k = 0 + + while (i < matrix.shape[0]): + + if (matrix[i][i] == 0): + + n = i + + while (matrix[i][i] == 0) and (n < matrix.shape[0]): + + temp = matrix[i].copy() + matrix[i] = matrix[n] + matrix[n] = temp + + n += 1 + + while (k < matrix.shape[0]): + + if (k == i) or (matrix[i][i] == 0): + + k += 1 + + else: + + mult = matrix[k][i]/matrix[i][i] + matrix[k] = matrix[k] - mult*matrix[i] + k += 1 + + i += 1 + k = 0 + + i = 0 + + while ((i) < matrix.shape[0]) and (matrix[i][i] != 0): + + matrix[i] = matrix[i]/matrix[i][i] + i += 1 + + return matrix[:,(matrix.shape[0]):] + +def inverse(matrix): + + return gauss(np.hstack((matrix, identity(np.zeros(matrix.shape))))) + +def cholesky(A, b): + + g = np.zeros((A.shape)) + + i = 0 + j = 0 + + while j < A.shape[1]: + while i < A.shape[0]: + + if i == 0 and j == 0: + + g[i][j] = math.sqrt(A[0][0]) + + elif j == 0: + + g[i][j] = A[i][0]/g[0][0] + + elif i == j: + + k = 0 + theta = 0 + + while k < i: + + theta += g[i][k]**2 + k += 1 + + g[i][j] = math.sqrt(A[i][i] - theta) + + else: + + k = 0 + theta = 0 + + while k < j: + + theta += g[i][k]*g[j][k] + k += 1 + + g[i][j] = (A[i][j] - theta)/g[j][j] + + i += 1 + + j += 1 + i = j + + y = (inverse(g)).dot(b) + + x = (inverse(g.T)).dot(y) + + return x + +def decomposition(U, b): + + L = identity(np.zeros(U.shape)) + + i = 0 + k = 0 + + while (i < U.shape[0]): + + k = 0 + + if (U[i][i] == 0): + + n = i + + while (U[i][i] == 0) and (n < U.shape[0]): + + temp = U[i].copy() + U[i] = U[n] + U[n] = temp + + n += 1 + + while (k < U.shape[0]): + + if (k <= i) or (U[i][i] == 0): + + k += 1 + + else: + L[k][i] = U[k][i]/U[i][i] + U[k] = U[k] - L[k][i]*U[i] + k += 1 + + i += 1 + + y = (inverse(L)).dot(b) + + x = (inverse(U)).dot(y) + + return x + +def cramer(A, b): + + x = np.vstack(np.zeros(b.shape)) + k = 0 + + while (k < A.shape[0]): + + temp = A.copy() + temp[:,k] = b + + x[k] = np.linalg.det(temp)/np.linalg.det(A) + + k += 1 + + return x \ No newline at end of file diff --git a/Source Code - Seals/scan/__init__.py b/Source Code - Seals/scan/__init__.py new file mode 100644 index 0000000..c0167ff --- /dev/null +++ b/Source Code - Seals/scan/__init__.py @@ -0,0 +1,21 @@ +# Seals - Program made for educational intent, can be freely distributed +# and can be used for economical intent. I will not take legal actions +# unless my intelectual propperty, the code, is stolen or change without permission. + +# Copyright (C) 2020 VItor Hideyoshi Nakazone Batista + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published by +# the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +from .scan import numpy as np +from .scan import pandas as pd \ No newline at end of file diff --git a/Source Code - Seals/scan/__pycache__/__init__.cpython-37.pyc b/Source Code - Seals/scan/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000..dfa267e Binary files /dev/null and b/Source Code - Seals/scan/__pycache__/__init__.cpython-37.pyc differ diff --git a/Source Code - Seals/scan/__pycache__/scan.cpython-37.pyc b/Source Code - Seals/scan/__pycache__/scan.cpython-37.pyc new file mode 100644 index 0000000..0452701 Binary files /dev/null and b/Source Code - Seals/scan/__pycache__/scan.cpython-37.pyc differ diff --git a/Source Code - Seals/scan/scan.py b/Source Code - Seals/scan/scan.py new file mode 100644 index 0000000..07c5cbd --- /dev/null +++ b/Source Code - Seals/scan/scan.py @@ -0,0 +1,45 @@ +# Seals - Program made for educational intent, can be freely distributed +# and can be used for economical intent. I will not take legal actions +# unless my intelectual propperty, the code, is stolen or change without permission. + +# Copyright (C) 2020 VItor Hideyoshi Nakazone Batista + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published by +# the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import numpy as np +import pandas as pd + +def numpy(path, sep=None, decimal=None): + + if sep is None: + sep = "," + + if decimal is None: + decimal = "." + + df=pd.read_csv(path, sep=sep, decimal=decimal, header=None) + array = df.to_numpy() + + return array + +def pandas(path, sep=None, decimal=None): + + if sep is None: + sep = "," + + if decimal is None: + decimal = "." + + return pd.read_csv(path, sep=sep, decimal=decimal) + diff --git a/Source Code - Seals/write/__init__.py b/Source Code - Seals/write/__init__.py new file mode 100644 index 0000000..90f152d --- /dev/null +++ b/Source Code - Seals/write/__init__.py @@ -0,0 +1,21 @@ +# Seals - Program made for educational intent, can be freely distributed +# and can be used for economical intent. I will not take legal actions +# unless my intelectual propperty, the code, is stolen or change without permission. + +# Copyright (C) 2020 VItor Hideyoshi Nakazone Batista + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published by +# the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +from .write import numpy as np +from .write import pandas as pd \ No newline at end of file diff --git a/Source Code - Seals/write/__pycache__/__init__.cpython-37.pyc b/Source Code - Seals/write/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000..7b0ac6b Binary files /dev/null and b/Source Code - Seals/write/__pycache__/__init__.cpython-37.pyc differ diff --git a/Source Code - Seals/write/__pycache__/write.cpython-37.pyc b/Source Code - Seals/write/__pycache__/write.cpython-37.pyc new file mode 100644 index 0000000..9beac44 Binary files /dev/null and b/Source Code - Seals/write/__pycache__/write.cpython-37.pyc differ diff --git a/Source Code - Seals/write/write.py b/Source Code - Seals/write/write.py new file mode 100644 index 0000000..b9bd1e9 --- /dev/null +++ b/Source Code - Seals/write/write.py @@ -0,0 +1,33 @@ +# Seals - Program made for educational intent, can be freely distributed +# and can be used for economical intent. I will not take legal actions +# unless my intelectual propperty, the code, is stolen or change without permission. + +# Copyright (C) 2020 VItor Hideyoshi Nakazone Batista + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published by +# the Free Software Foundation. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import csv + +def numpy(array, path): + + with open(path, mode='w') as sistema_linear: + + solution_writer = csv.writer(sistema_linear, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) + solution_writer.writerows(array) + + return array + +def pandas(df, path): + + df.to_csv(path) \ No newline at end of file