Example #1
0
 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)
 def generate_random(self):
     ff_product = OnlineAffineExpansionStorage(self.Q, self.Q)
     ff_product_legacy = legacy_tensor((self.Q, self.Q))
     for i in range(self.Q):
         for j in range(self.Q):
             # Generate random matrix
             ff_product[i, j] = RandomNumber()
             ff_product_legacy[i, j] = ff_product[i, j]
     # Genereate random theta
     theta = RandomTuple(self.Q)
     # Return
     return (theta, ff_product, ff_product_legacy)
Example #3
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)
Example #4
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)