in benchmarks/run_benchmarks.py [0:0]
def __init__(self, config, random_state=0):
self.config = config
self.problems = config.problems
self.operator_modes = config.operator_modes
self.algo_modes = config.algo_modes
self.accel_params = config.accel_params
self.solvers = config.solvers
self.sparse_formats = config.sparse_formats
self.sketch_sizes = config.sketch_sizes
self.kernel_parameters = config.kernel_parameters
self.random_state = random_state
np.random.seed(seed=random_state)
density = config.density # make a for loop here
larger_dimension, smaller_dimension = (
config.larger_dimension,
config.smaller_dimension,
)
# Setting data to sparse random matrices if required
if "primal_random" in self.problems:
if "csc" in self.sparse_formats:
self.X_primal_csc_random = sprandom(
larger_dimension, smaller_dimension, density=density, format="csc",
)
if "csr" in self.sparse_formats:
self.X_primal_csr_random = sprandom(
larger_dimension, smaller_dimension, density=density, format="csr"
)
if "dense" in self.sparse_formats:
self.X_primal_dense_random = np.random.rand(
larger_dimension, smaller_dimension
)
self.y_primal_random = np.random.rand(larger_dimension, 1)
if "dual_random" in self.problems:
if "csc" in self.sparse_formats:
self.X_dual_csc_random = sprandom(
smaller_dimension, larger_dimension, density=density, format="csc"
)
if "csr" in self.sparse_formats:
self.X_dual_csr_random = sprandom(
smaller_dimension, larger_dimension, density=density, format="csr"
)
if "dense" in self.sparse_formats:
self.X_dual_dense_random = np.random.rand(
smaller_dimension, larger_dimension
)
self.y_dual_random = np.random.rand(smaller_dimension, 1)
self.times_df, self.residual_norms_df = None, None