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

Method multiply

JSAT/src/jsat/linear/DenseMatrix.java:101–115  ·  view source on GitHub ↗
(Vec b, double z, Vec c)

Source from the content-addressed store, hash-verified

99 }
100
101 @Override
102 public void multiply(Vec b, double z, Vec c)
103 {
104 if(this.cols() != b.length())
105 throw new ArithmeticException("Matrix dimensions do not agree, [" + rows() +"," + cols() + "] x [" + b.length() + ",1]" );
106 if(this.rows() != c.length())
107 throw new ArithmeticException("Target vector dimension does not agree with matrix dimensions. Matrix has " + rows() + " rows but tagert has " + c.length());
108
109 for(int i = 0; i < rows(); i++)
110 {
111 //The Dense construcure does not clone the matrix, it just takes the refernce -making it fast
112 DenseVector row = new DenseVector(matrix[i]);
113 c.increment(i, row.dot(b)*z);//We use the dot product in this way so that if the incoming matrix is sparce, we can take advantage of save computaitons
114 }
115 }
116
117 @Override
118 public void transposeMultiply(double c, Vec b, Vec x)

Calls 9

colsMethod · 0.95
rowsMethod · 0.95
dotMethod · 0.95
blockMultiplyMethod · 0.95
canMultiplyMethod · 0.80
submitMethod · 0.80
lengthMethod · 0.45
incrementMethod · 0.45
awaitMethod · 0.45