The 2019 Coronavirus (COVID-19) epidemic has recently hit most countries hard. Therefore, many researchers around the world are looking for a way to control this virus. Examining existing medications and using them to prevent this epidemic can be helpful. Drug repositioning solutions can be effective because designing and discovering a drug can be very time-consuming. Although no drug has been definitively approved for the treatment of this disease, the effectiveness of a few drugs for the treatment of the disease has been observed. In this study, with the help of computational matrix factorization methods, the associations between drugs and viruses have been predicted. By combining the similarities between the drugs and the similarities between the viruses and using the compressed sensing technique, we investigated the association between the drug and the virus. The Compressed Sensing approach to Drug-Virus Prediction (CSDVP) can work well. We compared the proposed method with other methods in this field and found its accuracy is more desirable than other methods. In fact, the CSDVP approach with the HDVD dataset and evaluation through 5-fold CV, with AUC = 0.96 and AUPR = 0.85, can identify the relationship between drugs and viruses. We also investigated the effect of drug properties on model performance improvement using autoencoder. Thus, with each decrease in the size of the characteristics in different sizes, we examined the performance of the CSDVP model in predicting the drug-virus relationship. The relationship between drugs and coronavirus infection is also analyzed, and the results are presented.