@@ -128,6 +128,28 @@ class PCAClient : public FluidBaseClient,
128
128
outBuf.samps (0 , k, 0 ) = dest;
129
129
return OK ();
130
130
}
131
+
132
+ MessageResult<void > inverseTransformPoint (BufferPtr in, BufferPtr out) const
133
+ {
134
+ if (!mAlgorithm .initialized ()) return Error (NoDataFitted);
135
+ InOutBuffersCheck bufCheck (mAlgorithm .dims ());
136
+ BufferAdaptor::Access inBuf (in.get ());
137
+ BufferAdaptor::Access outBuf (out.get ());
138
+ if (!inBuf.exists ()) return Error (" Input buffer not found" );
139
+ if (!inBuf.valid ()) return Error (" Input buffer may be zero sized" );
140
+ if (!outBuf.exists ()) return Error (" Output buffer not found" );
141
+
142
+ FluidTensor<double , 1 > src (mAlgorithm .dims ());
143
+ FluidTensor<double , 1 > dst (mAlgorithm .dims ());
144
+ index k = std::min (inBuf.numFrames (),mAlgorithm .dims ());
145
+
146
+ src (Slice (0 ,k)) = inBuf.samps (0 ,k,0 );
147
+ Result resizeResult = outBuf.resize (mAlgorithm .dims (), 1 , outBuf.sampleRate ());
148
+
149
+ mAlgorithm .inverseProcessFrame (src,dst);
150
+ outBuf.samps (0 ,mAlgorithm .dims (),0 ) = dst;
151
+ return OK ();
152
+ }
131
153
132
154
static auto getMessageDescriptors ()
133
155
{
@@ -136,6 +158,7 @@ class PCAClient : public FluidBaseClient,
136
158
makeMessage (" transform" , &PCAClient::transform),
137
159
makeMessage (" fitTransform" , &PCAClient::fitTransform),
138
160
makeMessage (" transformPoint" , &PCAClient::transformPoint),
161
+ makeMessage (" inverseTransformPoint" , &PCAClient::inverseTransformPoint),
139
162
makeMessage (" cols" , &PCAClient::dims),
140
163
makeMessage (" size" , &PCAClient::size),
141
164
makeMessage (" clear" , &PCAClient::clear),
0 commit comments