We present a computationally efficient method for the calculation of impedance (Z-) matrices for a large class of standing- and traveling-wave structures used in klystrons, traveling-wave tubes, and other RF vacuum electronic devices. We apply joining formulas by which the Z-matrix of a structure can be constructed from the Z-matrices of its component parts without a full-scale finite-element (FE) electromagnetic (EM) simulation of the whole structure. For the inverse operation, we apply subtraction formulas that define the Z-matrix of a structure from which a selected section has been removed. New Z-matrix modification equations are derived which determine the Z-matrix of a modified structure, without recomputing the entire structure Z-matrix. The approach and examples are extended to multibeam RF structures. The obtained Z-matrices are suitable for the large-signal 1-D and 2-D beam-wave interaction codes CHRISTINE-CC and TESLA-Z. Application of the techniques described here greatly facilitates the accurate calculation of Z-matrices and optimization of large, complex circuits that are difficult to model whole in a single FE simulation.