Skip to content

Commit 7024790

Browse files
committed
more indentation fixes
1 parent 1436ea0 commit 7024790

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

_posts/2012-12-27-stl-inner-product.md

+7-12
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ One useful function is `inner_product` which can be used to compute
1212
the sum oof the elements of two vectors.
1313

1414

15-
1615
{% highlight cpp %}
1716
#include <Rcpp.h>
1817
#include <numeric>
@@ -25,11 +24,10 @@ double innerProduct(const std::vector<double>& x,
2524
}
2625
{% endhighlight %}
2726

28-
2927
{% highlight r %}
30-
x <- c(1,2,3)
31-
y <- c(4,5,6)
32-
cbind(x,y)
28+
x <- c(1,2,3)
29+
y <- c(4,5,6)
30+
cbind(x,y)
3331
{% endhighlight %}
3432

3533

@@ -44,8 +42,7 @@ double innerProduct(const std::vector<double>& x,
4442

4543

4644
{% highlight r %}
47-
48-
innerProduct(x, y)
45+
innerProduct(x, y)
4946
{% endhighlight %}
5047

5148

@@ -57,7 +54,7 @@ double innerProduct(const std::vector<double>& x,
5754

5855

5956
{% highlight r %}
60-
sum(x*y) # check from R
57+
sum(x*y) # check from R
6158
{% endhighlight %}
6259

6360

@@ -68,9 +65,8 @@ double innerProduct(const std::vector<double>& x,
6865

6966

7067

71-
7268
{% highlight r %}
73-
innerProduct(x, x)
69+
innerProduct(x, x)
7470
{% endhighlight %}
7571

7672

@@ -82,12 +78,11 @@ double innerProduct(const std::vector<double>& x,
8278

8379

8480
{% highlight r %}
85-
sum(x^2)
81+
sum(x^2)
8682
{% endhighlight %}
8783

8884

8985

9086
<pre class="output">
9187
[1] 14
9288
</pre>
93-

src/2012-12-27-stl-inner-product.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ double innerProduct(const std::vector<double>& x,
2222
}
2323

2424
/*** R
25-
x <- c(1,2,3)
26-
y <- c(4,5,6)
27-
cbind(x,y)
25+
x <- c(1,2,3)
26+
y <- c(4,5,6)
27+
cbind(x,y)
2828
29-
innerProduct(x, y)
30-
sum(x*y) # check from R
29+
innerProduct(x, y)
30+
sum(x*y) # check from R
3131
*/
3232

3333
/**
3434
* Similarly, we can use it compute a sum of squares:
3535
*/
3636

3737
/*** R
38-
innerProduct(x, x)
39-
sum(x^2)
38+
innerProduct(x, x)
39+
sum(x^2)
4040
*/

0 commit comments

Comments
 (0)