A matrix operation for analyzing series-parallel multiports