MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / transposeMultiply

Method transposeMultiply

JSAT/src/jsat/linear/SparseMatrix.java:308–334  ·  view source on GitHub ↗
(Matrix B, Matrix C)

Source from the content-addressed store, hash-verified

306 }
307
308 @Override
309 public void transposeMultiply(Matrix B, Matrix C)
310 {
311 if(this.rows() != B.rows())//Normaly it is A_cols == B_rows, but we are doint A'*B, not A*B
312 throw new ArithmeticException("Matrix dimensions do not agree");
313 else if(this.cols() != C.rows() || B.cols() != C.cols())
314 throw new ArithmeticException("Destination matrix does not have matching dimensions");
315 final SparseMatrix A = this;
316 ///Should choose step size such that 2*NB2^2 * dataTypeSize <= CacheSize
317
318 final int kLimit = this.rows();
319
320 for (int k = 0; k < kLimit; k++)
321 {
322 Vec bRow_k = B.getRowView(k);
323 Vec aRow_k = A.getRowView(k);
324
325 for (IndexValue iv : aRow_k)//iterating over "i"
326 {
327
328 Vec cRow_i = C.getRowView(iv.getIndex());
329 double a = iv.getValue();//A.get(k, i);
330
331 cRow_i.mutableAdd(a, bRow_k);
332 }
333 }
334 }
335
336 @Override
337 public void transposeMultiply(final Matrix B, final Matrix C, ExecutorService threadPool)

Callers

nothing calls this directly

Calls 8

rowsMethod · 0.95
colsMethod · 0.95
getRowViewMethod · 0.95
mutableAddMethod · 0.95
getIndexMethod · 0.45
getValueMethod · 0.45
lengthMethod · 0.45
mutableAddMethod · 0.45

Tested by

no test coverage detected