Skip to content

Commit

Permalink
Fixing sigmoid.h and small LA
Browse files Browse the repository at this point in the history
  • Loading branch information
dannys4 committed Feb 13, 2024
1 parent cf38b42 commit afb55c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions MParT/Sigmoid.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class Sigmoid1d {
Kokkos::View<double*, MemorySpace> widths)
: centers_(centers), widths_(widths) {
Kokkos::View<double*, MemorySpace> weights ("Sigmoid weights", centers.extent(0));
Kokkos::parallel_for(centers.extent(0), KOKKOS_LAMBDA(unsigned int i) { weights(i) = 1.; });
Kokkos::deep_copy(weights, 1.0);
weights_ = weights;
Validate();
}
Expand All @@ -121,7 +121,7 @@ class Sigmoid1d {
* @param max_order Maximum order of basis function to evaluate
* @param input Point to evaluate function
*/
void EvaluateAll(double* output, int max_order, double input) const {
KOKKOS_FUNCTION void EvaluateAll(double* output, int max_order, double input) const {
if (order_ < max_order) {
std::stringstream ss;
ss << "Sigmoid basis evaluation order too large.\n";
Expand Down Expand Up @@ -164,7 +164,7 @@ class Sigmoid1d {
* @param max_order Number of sigmoids to evaluate
* @param input Where to evaluate sigmoids
*/
void EvaluateDerivatives(double* output, double* output_diff, int max_order,
KOKKOS_FUNCTION void EvaluateDerivatives(double* output, double* output_diff, int max_order,
double input) const {
if (order_ < max_order) {
std::stringstream ss;
Expand Down Expand Up @@ -218,7 +218,7 @@ class Sigmoid1d {
* @param max_order Maximum order of sigmoid to evaluate
* @param input Where to evaluate the sigmoids
*/
void EvaluateSecondDerivatives(double* output, double* output_diff,
KOKKOS_FUNCTION void EvaluateSecondDerivatives(double* output, double* output_diff,
double* output_diff2, int max_order,
double input) const {
if (order_ < max_order) {
Expand Down
8 changes: 4 additions & 4 deletions tests/Test_LinearAlgebra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ TEST_CASE( "Testing LU Factorization", "LinearAlgebra_LU" ) {
B(1,0) = 2.; B(1,1) = 5.;
B(2,0) = 3.; B(2,1) = 6.;

auto constA = ToConstKokkos(A.data(), 3, 3);
Kokkos::View<const double**, Kokkos::LayoutLeft, Kokkos::HostSpace> constA = A;
auto eigA = ConstKokkosToMat(constA);
auto eigB = KokkosToMat(B);
unsigned int nrows = eigA.rows();
Expand Down Expand Up @@ -197,7 +197,7 @@ TEST_CASE( "Testing Cholesky Factorization", "LinearAlgebra_Cholesky" ) {
B(1,0) = 2.; B(1,1) = 5.;
B(2,0) = 3.; B(2,1) = 6.;

auto constA = ToConstKokkos(A.data(), 3, 3);
Kokkos::View<const double**, Kokkos::LayoutLeft, Kokkos::HostSpace> constA = A;
auto eigA = ConstKokkosToMat(constA);
auto eigB = KokkosToMat(B);
unsigned int nrows = eigA.rows();
Expand Down Expand Up @@ -364,7 +364,7 @@ TEST_CASE( "Testing LU Factorization on Device", "LinearAlgebra_LUDevice" ) {
B(1,0) = 2.; B(1,1) = 5.;
B(2,0) = 3.; B(2,1) = 6.;

auto constA = ToConstKokkos(A.data(), 3, 3);
Kokkos::View<const double**, Kokkos::LayoutLeft, Kokkos::HostSpace> constA = A;
auto constA_d = ToDevice<mpart::DeviceSpace>(constA);
auto B_d = ToDevice<mpart::DeviceSpace>(B);
auto eigA = ConstKokkosToMat(constA);
Expand Down Expand Up @@ -415,7 +415,7 @@ TEST_CASE( "Testing Cholesky Factorization", "LinearAlgebra_Cholesky" ) {
B_h(1,0) = 2.; B_h(1,1) = 5.;
B_h(2,0) = 3.; B_h(2,1) = 6.;

auto constA_h = ToConstKokkos(A.data(), 3, 3);
Kokkos::View<const double**, Kokkos::LayoutLeft, Kokkos::HostSpace> constA_h = A;
auto constA_d = ToDevice<mpart::DeviceSpace>(constA_h);
auto B_d = ToDevice<mpart::DeviceSpace>(B);
auto eigA = ConstKokkosToMat(constA_h);
Expand Down

0 comments on commit afb55c7

Please sign in to comment.