Пример #1
0
 def generate_random(self):
     # Generate random vectors
     v1 = RandomNumpyVector(self.N)
     v2 = RandomNumpyVector(self.N)
     # Generate random matrix
     A = RandomNumpyMatrix(self.N, self.N)
     # Return
     return (v1, v2, A)
Пример #2
0
 def generate_random(self):
     af_product = OnlineAffineExpansionStorage(self.Qa, self.Qf)
     af_product_legacy = legacy_tensor((self.Qa, self.Qf, self.N))
     for i in range(self.Qa):
         for j in range(self.Qf):
             # Generate random vector
             af_product[i, j] = RandomNumpyVector(self.N)
             for n in range(self.N):
                 af_product_legacy[i, j, n] = af_product[i, j][n]
     # Genereate random theta
     theta_a = RandomTuple(self.Qa)
     theta_f = RandomTuple(self.Qf)
     # Generate random solution
     u = RandomNumpyVector(self.N)
     # Return
     return (theta_a, theta_f, af_product, af_product_legacy, u)
Пример #3
0
 def generate_random(self):
     aa_product = OnlineAffineExpansionStorage(self.Q, self.Q)
     aa_product_legacy = legacy_tensor((self.Q, self.Q, self.N, self.N))
     for i in range(self.Q):
         for j in range(self.Q):
             # Generate random matrix
             aa_product[i, j] = RandomNumpyMatrix(self.N, self.N)
             for n in range(self.N):
                 for m in range(self.N):
                     aa_product_legacy[i, j, n, m] = aa_product[i, j][n, m]
     # Genereate random theta
     theta = RandomTuple(self.Q)
     # Generate random solution
     u = RandomNumpyVector(self.N)
     v = RandomNumpyVector(self.N)
     # Return
     return (theta, aa_product, aa_product_legacy, u, v)
Пример #4
0
 def generate_random(self):
     # Generate random vectors
     S = FunctionsList(self.V)
     for _ in range(self.N):
         b = RandomDolfinFunction(self.V)
         S.enrich(b)
     uN = RandomNumpyVector(self.N)
     # Return
     return (S, uN)
Пример #5
0
 def generate_random(self):
     F = OnlineAffineExpansionStorage(self.Q)
     for i in range(self.Q):
         # Generate random vector
         F[i] = RandomNumpyVector(self.N)
     # Genereate random theta
     theta = RandomTuple(self.Q)
     # Return
     return (theta, F)
Пример #6
0
 def generate_random(self):
     # Generate random vectors
     Z = BasisFunctionsMatrix(self.V)
     Z.init("u")
     for _ in range(self.N):
         b = RandomDolfinFunction(self.V)
         Z.enrich(b)
     uN = RandomNumpyVector(self.N)
     # Return
     return (Z, uN)
 def generate_random(self):
     F = OnlineAffineExpansionStorage(self.Q)
     for i in range(self.Q):
         # Generate random vector
         F[i] = RandomNumpyVector(self.Nmax)
     # Genereate random theta
     theta = RandomTuple(self.Q)
     # Generate slice
     N_stop = RandomSize(1, self.Nmax + 1)
     N_start = RandomSize(0, N_stop)
     # Return
     return (theta, F, slice(N_start, N_stop))
 def generate_random(self):
     aa_product = OnlineAffineExpansionStorage(self.Qa, self.Qa)
     aa_product_legacy = legacy_tensor((self.Qa, self.Qa, self.N, self.N))
     for i in range(self.Qa):
         for j in range(self.Qa):
             # Generate random matrix
             aa_product[i, j] = RandomNumpyMatrix(self.N, self.N)
             for n in range(self.N):
                 for m in range(self.N):
                     aa_product_legacy[i, j, n, m] = aa_product[i, j][n, m]
     af_product = OnlineAffineExpansionStorage(self.Qa, self.Qf)
     af_product_legacy = legacy_tensor((self.Qa, self.Qf, self.N))
     for i in range(self.Qa):
         for j in range(self.Qf):
             # Generate random matrix
             af_product[i, j] = RandomNumpyVector(self.N)
             for n in range(self.N):
                 af_product_legacy[i, j, n] = af_product[i, j][n]
     ff_product = OnlineAffineExpansionStorage(self.Qf, self.Qf)
     ff_product_legacy = legacy_tensor((self.Qf, self.Qf))
     for i in range(self.Qf):
         for j in range(self.Qf):
             # Generate random matrix
             ff_product[i, j] = RandomNumber()
             ff_product_legacy[i, j] = ff_product[i, j]
     # Genereate random theta
     theta_a = []
     theta_f = []
     for t in range(self.Ntrain):
         theta_a.append(RandomTuple(self.Qa))
         theta_f.append(RandomTuple(self.Qf))
     # Generate random solution
     u = []
     v = []
     for t in range(self.Ntrain):
         u.append(RandomNumpyVector(self.N))
         v.append(RandomNumpyVector(self.N))
     # Return
     return (theta_a, theta_f, aa_product, af_product, ff_product,
             aa_product_legacy, af_product_legacy, ff_product_legacy, u, v)
Пример #9
0
 def generate_random(self):
     # Generate random vectors
     v1 = RandomNumpyVector(self.N)
     v2 = RandomNumpyVector(self.N)
     # Return
     return (v1, v2)