How to calculate Pearson correlation coefficient of two 3-dimensional features? The book I read mentions:

Even though, single features do not correlate with each other, sets of features can correlate with other sets of features.

I have an accelerometer, gyroscope, and magnetometer data where all of which are 3-dimensional [x, y, z]. How to calculate if they correlate with each other (for example if accelerometer data correlate with gyroscope data)?
Edit: Adding the exact quote from the book per @whuber request.

However, this pre-processing step may not completely eliminate collinearity, since one or more of the predictors may be functions of two or more of the other predictors.


Second, the univariate importance approach will fail to identify groups of predictors that together have a strong relationship with the response. For example, two predictors may not be highly correlated with the response; however, their interaction may be.


The answer is canonical-correlation analysis (CCA) which is already given by @utobu. I am just leaving here, how I have done this in Python:
import numpy as np
from sklearn.cross_decomposition import CCA
from sklearn.preprocessing import StandardScaler

# Standardize with zero mean and unit variance.
scaler = StandardScaler() 
acc_sc = scaler.fit_transform(np_acc_rolled)
gyro_sc = scaler.fit_transform(np_gyro_rolled) 
mag_sc = scaler.fit_transform(np_mag_rolled) 

# Apply CCA. 
n_comp = 3
cca_1 = CCA(scale=False, n_components=n_comp)
cca_2 = CCA(scale=False, n_components=n_comp)
cca_3 = CCA(scale=False, n_components=n_comp)
cca_1.fit(acc_sc, gyro_sc)
cca_2.fit(acc_sc, mag_sc)
cca_3.fit(gyro_sc, mag_sc)
acc_c_1, gyro_c_1 = cca_1.transform(acc_sc, gyro_sc)
acc_c_2, mag_c_1 = cca_2.transform(acc_sc, mag_sc)
gyro_c_2, mag_c_2 = cca_3.transform(gyro_sc, mag_sc)

# Canonical variate correlations.
acc_gyro_corr = [np.corrcoef(acc_c_1[:, i], gyro_c_1[:, i])[1][0] for i in range(n_comp)]
acc_mag_corr = [np.corrcoef(acc_c_2[:, i], mag_c_1[:, i])[1][0] for i in range(n_comp)]
gyro_mag_corr = [np.corrcoef(gyro_c_2[:, i], mag_c_2[:, i])[1][0] for i in range(n_comp)]

print(f"Acc-Gyro cvc: {acc_gyro_corr}")
print(f"Acc-Mag cvc{acc_mag_corr}")
print(f"Gyro-Mag cvc{gyro_mag_corr}")

This prints:
Acc-Gyro cvc: [0.4856137213325398, 0.07371717790419037, 0.028344236059519964]
Acc-Mag cvc: [0.9696215850795505, 0.5802252927965852, 0.2706828800001764]
Gyro-Mag cvc: [0.4117381986036376, 0.3043019981940091, 0.07602987575700093]

So, this confirms that the accelerometer and magnetometer data I have highly correlate.
