  Reconfigurable intelligent surfaces (RISs) are envisioned as a promising
technology for future wireless communications. With various hardware
realizations, RISs can work under different modes
(reflective/transmissive/hybrid) or have different architectures
(single/group/fully-connected). However, most existing research focused on
single-connected reflective RISs, mathematically characterized by diagonal
phase shift matrices, while there is a lack of a comprehensive study for RISs
unifying different modes/architectures. In this paper, we solve this issue by
analyzing and proposing a general RIS-aided communication model. Specifically,
we establish an RIS model not limited to diagonal phase shift matrices, a novel
branch referred to as beyond diagonal RIS (BD-RIS), unifying modes and
architectures. With the proposed model, we develop efficient algorithms to
jointly design transmit precoder and BDRIS matrix to maximize the sum-rate for
RIS-aided systems. We also provide simulation results to compare the
performance of BD-RISs with different modes/architectures. Simulation results
show that under the same mode, fully- and group-connected RIS can effectively
increase the sum-rate performance compared with single-connected RIS, and that
hybrid RIS outperforms reflective/transmissive RIS with the same architecture.
