Skip to content

Commit ec9027b

Browse files
committed
Add comments, cpplint
1 parent f69c27d commit ec9027b

3 files changed

Lines changed: 59 additions & 67 deletions

File tree

.github/workflows/main.yml

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -222,64 +222,3 @@ jobs:
222222
with:
223223
name: gtest_outputs_xml
224224
path: '**/*_test.xml'
225-
226-
clang-qual-non-mix:
227-
name: Clang Qualification Version - non mix tests
228-
runs-on: ubuntu-latest
229-
230-
steps:
231-
- uses: actions/checkout@v3
232-
- uses: actions/setup-python@v4
233-
with:
234-
python-version: '3.x'
235-
236-
- name: Install Clang qualification version
237-
run: |
238-
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
239-
sudo apt-get update
240-
sudo apt-get install clang lld
241-
echo "CXX=clang++" > make/local
242-
243-
- name: Run non mix tests
244-
run: |
245-
python runTests.py -j2 test/unit/*_test.cpp
246-
python runTests.py -j2 test/unit/math/*_test.cpp
247-
python runTests.py -j2 test/unit/math/prim
248-
python runTests.py -j2 test/unit/math/rev
249-
python runTests.py -j2 test/unit/math/fwd
250-
python runTests.py -j2 test/unit/math/memory
251-
252-
- name: Upload gtest_output xml
253-
uses: actions/upload-artifact@v3
254-
if: failure()
255-
with:
256-
name: gtest_outputs_xml
257-
path: '**/*_test.xml'
258-
259-
clang-qual-mix:
260-
name: Clang Qualification Version - Mix tests
261-
runs-on: ubuntu-latest
262-
263-
steps:
264-
- uses: actions/checkout@v3
265-
- uses: actions/setup-python@v4
266-
with:
267-
python-version: '3.x'
268-
269-
- name: Install Clang qualification version
270-
run: |
271-
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
272-
sudo apt-get update
273-
sudo apt-get install clang lld
274-
echo "CXX=clang++" > make/local
275-
276-
- name: Run non mix tests
277-
run: |
278-
python runTests.py -j2 test/unit/math/mix
279-
280-
- name: Upload gtest_output xml
281-
uses: actions/upload-artifact@v3
282-
if: failure()
283-
with:
284-
name: gtest_outputs_xml
285-
path: '**/*_test.xml'

stan/math/fwd/core/operator_multiplication.hpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,47 @@ inline fvar<T> operator*(const fvar<T>& x, double y) {
4646
return fvar<T>(x.val_ * y, x.d_ * y);
4747
}
4848

49+
50+
/**
51+
* Return the product of the two complex fvar<T> arguments.
52+
*
53+
* @tparam value and tangent type for variables
54+
* @param[in] x first argument
55+
* @param[in] y second argument
56+
* @return product of arguments
57+
*/
4958
template <typename T>
5059
inline std::complex<stan::math::fvar<T>>
5160
operator*(const std::complex<stan::math::fvar<T>>& x,
5261
const std::complex<stan::math::fvar<T>>& y) {
5362
return internal::complex_multiply(x, y);
5463
}
5564

65+
/**
66+
* Return the product of std::complex<double> and
67+
* std::complex<fvar<T>> arguments.
68+
*
69+
* @tparam value and tangent type for variables
70+
* @param[in] x first argument
71+
* @param[in] y second argument
72+
* @return product of arguments
73+
*/
5674
template <typename T>
5775
inline std::complex<stan::math::fvar<T>>
5876
operator*(const std::complex<double>& x,
5977
const std::complex<stan::math::fvar<T>>& y) {
6078
return internal::complex_multiply(x, y);
6179
}
6280

81+
/**
82+
* Return the product of std::complex<double> and
83+
* std::complex<fvar<T>> arguments.
84+
*
85+
* @tparam value and tangent type for variables
86+
* @param[in] x first argument
87+
* @param[in] y second argument
88+
* @return product of arguments
89+
*/
6390
template <typename T>
6491
inline std::complex<stan::math::fvar<T>>
6592
operator*(const std::complex<stan::math::fvar<T>>& x,

stan/math/rev/core/operator_multiplication.hpp

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,44 @@ inline var operator*(Arith a, const var& b) {
113113
return {new internal::multiply_vd_vari(b.vi_, a)}; // by symmetry
114114
}
115115

116-
inline std::complex<stan::math::var> operator*(const std::complex<stan::math::var>& x,
117-
const std::complex<stan::math::var>& y) {
116+
/**
117+
* Return the product of std::complex<var> arguments.
118+
*
119+
* @param[in] x first argument
120+
* @param[in] y second argument
121+
* @return product of arguments
122+
*/
123+
inline std::complex<stan::math::var>
124+
operator*(const std::complex<stan::math::var>& x,
125+
const std::complex<stan::math::var>& y) {
118126
return internal::complex_multiply(x, y);
119127
}
120128

121-
inline std::complex<stan::math::var> operator*(const std::complex<double>& x,
122-
const std::complex<stan::math::var>& y) {
129+
/**
130+
* Return the product of std::complex<double> and
131+
* std::complex<var> arguments.
132+
*
133+
* @param[in] x first argument
134+
* @param[in] y second argument
135+
* @return product of arguments
136+
*/
137+
inline std::complex<stan::math::var>
138+
operator*(const std::complex<double>& x,
139+
const std::complex<stan::math::var>& y) {
123140
return internal::complex_multiply(x, y);
124141
}
125142

126-
inline std::complex<stan::math::var> operator*(const std::complex<stan::math::var>& x,
127-
const std::complex<double>& y) {
143+
/**
144+
* Return the product of std::complex<double> and
145+
* std::complex<var> arguments.
146+
*
147+
* @param[in] x first argument
148+
* @param[in] y second argument
149+
* @return product of arguments
150+
*/
151+
inline std::complex<stan::math::var>
152+
operator*(const std::complex<stan::math::var>& x,
153+
const std::complex<double>& y) {
128154
return internal::complex_multiply(x, y);
129155
}
130156

0 commit comments

Comments
 (0)