Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

- Added `diagSolve`, `max`, and `abs` vector operations.

- Improved coding guidelines for developers on floating point conventions.

## Changes to Re::Solve in release 0.99.2

### Major Features
Expand Down
18 changes: 9 additions & 9 deletions docs/doxygen/doxygen-awesome.css
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ body, table, div, p, dl, #nav-tree .label, .title,
}

h1, h2, h3, h4, h5 {
margin-top: .9em;
margin-top: 0.9em;
font-weight: 600;
line-height: initial;
}
Expand Down Expand Up @@ -901,7 +901,7 @@ div.contents, div.header .title, div.header .summary {

div.contents, div.header .title {
line-height: initial;
margin: calc(var(--spacing-medium) + .2em) auto var(--spacing-medium) auto;
margin: calc(var(--spacing-medium) + 0.2em) auto var(--spacing-medium) auto;
}

div.header .summary {
Expand Down Expand Up @@ -1019,7 +1019,7 @@ blockquote::before, blockquote::after {
font-weight: bold;
font-family: serif;
font-size: 360%;
opacity: .15;
opacity: 0.15;
position: absolute;
}

Expand Down Expand Up @@ -1945,7 +1945,7 @@ div.dynheader img[src="closed.png"] {
display: block !important;
visibility: visible;
width: calc(100vw - 2 * var(--spacing-large));
animation: fade .5s;
animation: fade 0.5s;
}

@keyframes fade {
Expand Down Expand Up @@ -2344,7 +2344,7 @@ doxygen-awesome-dark-mode-toggle {
}

doxygen-awesome-dark-mode-toggle > svg {
transition: transform .1s ease-in-out;
transition: transform 0.1s ease-in-out;
}

doxygen-awesome-dark-mode-toggle:active > svg {
Expand Down Expand Up @@ -2383,7 +2383,7 @@ doxygen-awesome-fragment-copy-button {
}

.doxygen-awesome-fragment-wrapper:hover doxygen-awesome-fragment-copy-button, doxygen-awesome-fragment-copy-button.success {
opacity: .28;
opacity: 0.28;
}

doxygen-awesome-fragment-copy-button:hover, doxygen-awesome-fragment-copy-button.success {
Expand Down Expand Up @@ -2427,9 +2427,9 @@ a.anchorlink {
margin-left: var(--spacing-small);
color: var(--page-foreground-color) !important;
text-decoration: none;
opacity: .15;
opacity: 0.15;
display: none;
transition: opacity .1s ease-in-out, color .1s ease-in-out;
transition: opacity 0.1s ease-in-out, color 0.1s ease-in-out;
}

a.anchorlink svg {
Expand All @@ -2442,7 +2442,7 @@ h3 a.anchorlink svg, h4 a.anchorlink svg {
}

a.anchorlink:hover {
opacity: .45;
opacity: 0.45;
}

h2:hover a.anchorlink, h1:hover a.anchorlink, h3:hover a.anchorlink, h4:hover a.anchorlink {
Expand Down
6 changes: 6 additions & 0 deletions docs/sphinx/developer_guide/coding_guidelines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ Constants names should be capitalized and words separated by underscores.
constexpr double SQRTTWO_ = 1.4142 // No, there is a trailing underscore but not between words
constexpr double EXP = 2.7183 // Yes

Floating point variables
------------------------------

Use ``real_type`` for floating point variables. This is a typedef defined in ``Common.h`` and can be set to either ``float`` or ``double`` depending on the precision needed.
Always use a leading 0 for floating point numbers less than 1 and use a trailing 0 for whole numbers used as floating point numbers.

Exceptions to naming conventions
--------------------------------

Expand Down
13 changes: 7 additions & 6 deletions tests/unit/vector/VectorHandlerTests.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <string>
#include <vector>

#include <resolve/Common.hpp>
#include <resolve/vector/Vector.hpp>
#include <resolve/vector/VectorHandler.hpp>
#include <resolve/workspace/LinAlgWorkspace.hpp>
Expand Down Expand Up @@ -90,7 +91,7 @@ namespace ReSolve
x.setToConst(3.0, memspace_);
y.setToConst(1.0, memspace_);

real_type alpha = 0.5;
real_type alpha = ReSolve::constants::HALF;

// the result is a vector with y[i] = 2.5 forall i;
handler_.axpy(alpha, &x, &y, memspace_);
Expand Down Expand Up @@ -172,7 +173,7 @@ namespace ReSolve
}
else
{
c = 0.5;
c = ReSolve::constants::HALF;
}
x.setToConst(ii, c, memspace_);
}
Expand Down Expand Up @@ -224,16 +225,16 @@ namespace ReSolve

V.setToConst(1.0, memspace_);
yN.setToConst(-1.0, memspace_);
xN.setToConst(.5, memspace_);
xN.setToConst(ReSolve::constants::HALF, memspace_);
yT.setToConst(-1.0, memspace_);
xT.setToConst(.5, memspace_);
xT.setToConst(ReSolve::constants::HALF, memspace_);

real_type alpha = -1.0;
real_type beta = 1.0;
handler_.gemv('N', K, alpha, beta, &V, &yN, &xN, memspace_);
status *= verifyAnswer(xN, static_cast<real_type>(K) + 0.5);
status *= verifyAnswer(xN, static_cast<real_type>(K) + ReSolve::constants::HALF);
handler_.gemv('T', K, alpha, beta, &V, &yT, &xT, memspace_);
status *= verifyAnswer(xT, static_cast<real_type>(N) + 0.5);
status *= verifyAnswer(xT, static_cast<real_type>(N) + ReSolve::constants::HALF);

return status.report(__func__);
}
Expand Down
Loading