update _Matrix__apply exception

This commit is contained in:
Didictateur 2023-10-23 14:25:25 +02:00
parent 8fbab021a1
commit 2b5b92c9f8

View file

@ -1,4 +1,5 @@
import math import math
import numpy as np
I = complex(0, 1) I = complex(0, 1)
@ -42,7 +43,8 @@ class Matrix:
for y in x: for y in x:
if type(y) not in {int, float, complex}: if type(y) not in {int, float, complex}:
TypeError(f"can apply a Matrix to a ") TypeError(f"can apply a Matrix to a ")
assert(self.__size[1] == len(x)) if not self.__size[1] == len(x):
ValueError(f"the vector was expectedd to be of size {self.__size[1]}, but is of size {len(x)}")
y: list[complex] = [0]*self.__size[0] y: list[complex] = [0]*self.__size[0]
for i in range(self.__size[0]): for i in range(self.__size[0]):