示例#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)
 def generate_random(self):
     A = OnlineAffineExpansionStorage(self.Q)
     for i in range(self.Q):
         # Generate random matrix
         A[i] = RandomNumpyMatrix(self.N, self.N)
     # Genereate random theta
     theta = RandomTuple(self.Q)
     # Return
     return (theta, A)
示例#3
0
 def generate_random(self):
     A = OnlineAffineExpansionStorage(self.Q)
     for i in range(self.Q):
         # Generate random matrix
         A[i] = RandomNumpyMatrix(self.Nmax, self.Nmax)
     # Genereate random theta
     theta = RandomTuple(self.Q)
     # Generate N <= Nmax
     N = randint(1, self.Nmax + 1)
     # Return
     return (theta, A, N)
示例#4
0
 def generate_random(self):
     A = OnlineAffineExpansionStorage(self.Q)
     for i in range(self.Q):
         # Generate random matrix
         A[i] = RandomNumpyMatrix(self.Nmax, 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, A, slice(N_start, N_stop))
示例#5
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)
 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)