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

Method blockMultiply

JSAT/src/jsat/linear/DenseMatrix.java:136–167  ·  view source on GitHub ↗
(Matrix b)

Source from the content-addressed store, hash-verified

134 }
135 }
136 @SuppressWarnings("unused")
137 private Matrix blockMultiply(Matrix b)
138 {
139 if(!canMultiply(this, b))
140 throw new ArithmeticException("Matrix dimensions do not agree");
141 DenseMatrix result = new DenseMatrix(this.rows(), b.cols());
142 ///Should choose step size such that 2*NB2^2 * dataTypeSize <= CacheSize
143
144 int iLimit = result.rows();
145 int jLimit = result.cols();
146 int kLimit = this.cols();
147
148 for(int i0 = 0; i0 < iLimit; i0+=NB2)
149 for(int k0 = 0; k0 < kLimit; k0+=NB2)
150 for(int j0 = 0; j0 < jLimit; j0+=NB2)
151 {
152 for(int i = i0; i < min(i0+NB2, iLimit); i++)
153 {
154 double[] c_row_i = result.matrix[i];
155
156 for(int k = k0; k < min(k0+NB2, kLimit); k++)
157 {
158 double a = this.matrix[i][k];
159
160 for(int j = j0; j < min(j0+NB2, jLimit); j++)
161 c_row_i[j] += a * b.get(k, j);
162 }
163 }
164 }
165
166 return result;
167 }
168
169 /**
170 * Copies the values from A_k to vk

Callers 1

multiplyMethod · 0.95

Calls 9

rowsMethod · 0.95
colsMethod · 0.95
canMultiplyMethod · 0.80
submitMethod · 0.80
logMethod · 0.80
getNameMethod · 0.65
minMethod · 0.45
getMethod · 0.45
awaitMethod · 0.45

Tested by

no test coverage detected