Home
last modified time | relevance | path

Searched refs:norm (Results 1 – 25 of 31) sorted by relevance

12

/libCEED/tests/
H A Dt108-vector.c31 CeedScalar norm; in main() local
32 CeedVectorNorm(x, CEED_NORM_1, &norm); in main()
33 if (len > 0 && fabs(norm - 45.) > 100. * CEED_EPSILON) printf("Error: L1 norm %f != 45.\n", norm); in main()
34 else if (len == 0 && fabs(norm) > CEED_EPSILON) printf("Error: L1 norm %f != 0.\n", norm); in main()
36 CeedVectorNorm(x, CEED_NORM_2, &norm); in main()
37 …if (len > 0 && fabs(norm - sqrt(285.)) > 100. * CEED_EPSILON) printf("Error: L2 norm %f != sqrt(28… in main()
38 else if (len == 0 && fabs(norm) > CEED_EPSILON) printf("Error: L2 norm %f != 0.\n", norm); in main()
40 CeedVectorNorm(x, CEED_NORM_MAX, &norm); in main()
41 if (len > 0 && fabs(norm - 9.) > 100. * CEED_EPSILON) printf("Error: Max norm %f != 9.\n", norm); in main()
42 else if (len == 0 && fabs(norm) > CEED_EPSILON) printf("Error: Max norm %f != 0.\n", norm); in main()
H A Dt108-vector-f.f909 real*8 norm,diff variable
31 call ceedvectornorm(x,ceed_norm_1,norm,err)
32 diff = norm - 45.
35 write(*,*) 'Error L1 norm ',norm,' != 45.'
39 call ceedvectornorm(x,ceed_norm_2,norm,err)
40 diff = norm - sqrt(285.)
43 write(*,*) 'Error L2 norm ',norm,' != sqrt(285.)'
47 call ceedvectornorm(x,ceed_norm_max,norm,err)
48 diff = norm - 9.
51 write(*,*) 'Error Max norm ',norm,' != 9.'
/libCEED/examples/fluids/qfunctions/
H A Dbc_slip.h26 CeedScalar wdetJb, norm[3]; in Slip() local
27 QdataBoundaryUnpack_3D(Q, i, q_data_sur, &wdetJb, NULL, norm); in Slip()
31 const CeedScalar vel_normal = Dot3(s.Y.velocity, norm); in Slip()
32 for (CeedInt j = 0; j < 3; j++) vel_reflect[j] = s.Y.velocity[j] - 2. * norm[j] * vel_normal; in Slip()
36 StateConservative flux = RiemannFlux_HLLC(newt_ctx, s, s_reflect, norm); in Slip()
73 CeedScalar wdetJb, norm[3]; in Slip_Jacobian() local
74 QdataBoundaryUnpack_3D(Q, i, q_data_sur, &wdetJb, NULL, norm); in Slip_Jacobian()
84 const CeedScalar vel_normal = Dot3(s.Y.velocity, norm); in Slip_Jacobian()
85 for (CeedInt j = 0; j < 3; j++) vel_reflect[j] = s.Y.velocity[j] - 2. * norm[j] * vel_normal; in Slip_Jacobian()
90 const CeedScalar dvel_normal = Dot3(ds.Y.velocity, norm); in Slip_Jacobian()
[all …]
H A Dchannel.h98 CeedScalar wdetJb, norm[3]; in Channel_Inflow() local
99 QdataBoundaryUnpack_3D(Q, i, q_data_sur, &wdetJb, NULL, norm); in Channel_Inflow()
130 const CeedScalar u_normal = Dot3(norm, s_exact.Y.velocity); in Channel_Inflow()
137 …= 0; j < 3; j++) v[j + 1][i] -= wdetJb * (rho_in * u_normal * s_exact.Y.velocity[j] + norm[j] * P); in Channel_Inflow()
157 CeedScalar wdetJb, norm[3]; in Channel_Outflow() local
158 QdataBoundaryUnpack_3D(Q, i, q_data_sur, &wdetJb, NULL, norm); in Channel_Outflow()
171 const CeedScalar u_normal = Dot3(norm, u); // Normal velocity in Channel_Outflow()
177 for (CeedInt j = 0; j < 3; j++) v[j + 1][i] -= wdetJb * (rho * u_normal * u[j] + norm[j] * P); in Channel_Outflow()
H A Deulervortex.h551 CeedScalar wdetJb, norm[3]; in TravelingVortex_Inflow() local
552 QdataBoundaryUnpack_3D(Q, i, q_data_sur, &wdetJb, NULL, norm); in TravelingVortex_Inflow()
556 …const CeedScalar face_normal = norm[0] * mean_velocity[0] + norm[1] * mean_velocity[1] + norm[2] *… in TravelingVortex_Inflow()
574 …< 3; j++) v[j + 1][i] -= wdetJb * (rho_inlet * face_normal * mean_velocity[j] + norm[j] * P_inlet); in TravelingVortex_Inflow()
607 CeedScalar wdetJb, norm[3]; in Euler_Outflow() local
608 QdataBoundaryUnpack_3D(Q, i, q_data_sur, &wdetJb, NULL, norm); in Euler_Outflow()
612 …const CeedScalar face_normal = norm[0] * mean_velocity[0] + norm[1] * mean_velocity[1] + norm[2] *… in Euler_Outflow()
621 … const CeedScalar u_normal = norm[0] * u[0] + norm[1] * u[1] + norm[2] * u[2]; // Normal velocity in Euler_Outflow()
627 for (CeedInt j = 0; j < 3; j++) v[j + 1][i] -= wdetJb * (rho * u_normal * u[j] + norm[j] * P); in Euler_Outflow()
H A Dblasius.h148 CeedScalar wdetJb, norm[3]; in Blasius_Inflow() local
149 QdataBoundaryUnpack_3D(Q, i, q_data_sur, &wdetJb, NULL, norm); in Blasius_Inflow()
179 FluxTotal_Boundary(Flux_inviscid, stress, Fe, norm, Flux); in Blasius_Inflow()
204 CeedScalar wdetJb, norm[3]; in Blasius_Inflow_Jacobian() local
205 QdataBoundaryUnpack_3D(Q, i, q_data_sur, &wdetJb, NULL, norm); in Blasius_Inflow_Jacobian()
229 const CeedScalar u_normal = Dot3(norm, s.Y.velocity); in Blasius_Inflow_Jacobian()
233 v[j + 1][i] = -wdetJb * (drho * u_normal * s.Y.velocity[j] + norm[j] * dP); in Blasius_Inflow_Jacobian()
H A Dstg_shur14.h354 CeedScalar wdetJb, dXdx[2][3], norm[3]; in StgShur14Inflow() local
355 QdataBoundaryUnpack_3D(Q, i, q_data_sur, &wdetJb, dXdx, norm); in StgShur14Inflow()
386 const CeedScalar u_normal = Dot3(norm, u); in StgShur14Inflow()
397 for (CeedInt j = 0; j < 3; j++) v[j + 1][i] -= wdetJb * (rho * u_normal * u[j] + norm[j] * P); in StgShur14Inflow()
451 const CeedScalar norm[3] = {q_data_sur[1][i], q_data_sur[2][i], q_data_sur[3][i]}; in StgShur14Inflow_Jacobian() local
453 const CeedScalar u_normal = Dot3(norm, velocity); in StgShur14Inflow_Jacobian()
456 …for (int j = 0; j < 3; j++) v[j + 1][i] = -wdetJb * (drho * u_normal * velocity[j] + norm[j] * dP); in StgShur14Inflow_Jacobian()
H A Dnewtonian.h409 CeedScalar wdetJb, dXdx[2][3], norm[3]; in BoundaryIntegral() local
410 QdataBoundaryUnpack_3D(Q, i, q_data_sur, &wdetJb, dXdx, norm); in BoundaryIntegral()
426 FluxTotal_Boundary(F_inviscid, stress, Fe, norm, Flux); in BoundaryIntegral()
465 CeedScalar wdetJb, dXdx[2][3], norm[3]; in BoundaryIntegral_Jacobian() local
466 QdataBoundaryUnpack_3D(Q, i, q_data_sur, &wdetJb, dXdx, norm); in BoundaryIntegral_Jacobian()
491 FluxTotal_Boundary(dF_inviscid, dstress, dFe, norm, dFlux); in BoundaryIntegral_Jacobian()
H A Dadvection.h526 CeedScalar wdetJb, norm[3]; in Advection_InOutFlowGeneric() local
527 QdataBoundaryUnpack_ND(dim, Q, i, q_data_sur, &wdetJb, NULL, norm); in Advection_InOutFlowGeneric()
530 const CeedScalar u_normal = DotN(norm, u, dim); in Advection_InOutFlowGeneric()
/libCEED/backends/magma/
H A Dceed-magma-gemm-selector.cpp64 double norm = std::numeric_limits<double>::max(); in gemm_selector()
76 if (nrm < norm) { in gemm_selector()
77 norm = nrm; in gemm_selector()
134 double norm = std::numeric_limits<double>::max(); in nontensor_rtc_get_nb()
151 if (nrm < norm) { in nontensor_rtc_get_nb()
152 norm = nrm; in nontensor_rtc_get_nb()
/libCEED/python/tests/
H A Dtest-1-vector.py199 norm = x.norm(normtype=libceed.NORM_1)
201 assert abs(norm - 45.) < TOL
203 norm = x.norm()
205 assert abs(norm - np.sqrt(285.)) < TOL
207 norm = x.norm(normtype=libceed.NORM_MAX)
209 assert abs(norm - 9.) < TOL
/libCEED/julia/LibCEED.jl/docs/src/
H A DCeedVector.md9 LinearAlgebra.norm(v::CeedVector, n::NormType)
10 LinearAlgebra.norm(v::CeedVector, p::Real)
/libCEED/julia/LibCEED.jl/src/
H A DCeedVector.jl1 import LinearAlgebra: norm, axpy!
77 norm(v::CeedVector, ntype::NormType)
79 Return the norm of the given [`CeedVector`](@ref).
81 The norm type can either be specified as one of `NORM_1`, `NORM_2`, `NORM_MAX`.
83 function norm(v::CeedVector, ntype::NormType) function
90 norm(v::CeedVector, p::Real)
92 Return the norm of the given [`CeedVector`](@ref), see [`norm(::CeedVector,
98 function norm(v::CeedVector, p::Real) function
106 error("norm(v::CeedVector, p): p must be 1, 2, or Inf")
108 norm(v, ntype)
H A DGlobals.jl90 Denotes type of vector norm. One of `NORM_1`, `NORM_2`, or `NORM_MAX`.
H A DLibCEED.jl126 norm,
/libCEED/examples/fluids/problems/
H A Ddensitycurrent.c67 …PetscReal norm = PetscSqrtReal(PetscSqr(dc_axis[0]) + PetscSqr(dc_axis[1]) + PetscSqr(dc_axis[2])); in NS_DENSITY_CURRENT() local
68 if (norm > 0) { in NS_DENSITY_CURRENT()
69 for (PetscInt i = 0; i < 3; i++) dc_axis[i] /= norm; in NS_DENSITY_CURRENT()
/libCEED/backends/cuda-ref/
H A Dceed-cuda-ref-vector.c477 static int CeedVectorNorm_Cuda(CeedVector vec, CeedNormType type, CeedScalar *norm) { in CeedVectorNorm_Cuda() argument
504 *norm = 0.0; in CeedVectorNorm_Cuda()
507 … CeedCallCublas(ceed, cublasSasum_64(handle, (int64_t)length, (float *)d_array, 1, (float *)norm)); in CeedVectorNorm_Cuda()
518 *norm += sub_norm; in CeedVectorNorm_Cuda()
523 …eedCallCublas(ceed, cublasDasum_64(handle, (int64_t)length, (double *)d_array, 1, (double *)norm)); in CeedVectorNorm_Cuda()
534 *norm += sub_norm; in CeedVectorNorm_Cuda()
543 … CeedCallCublas(ceed, cublasSnrm2_64(handle, (int64_t)length, (float *)d_array, 1, (float *)norm)); in CeedVectorNorm_Cuda()
556 *norm = sqrt(norm_sum); in CeedVectorNorm_Cuda()
560 …eedCallCublas(ceed, cublasDnrm2_64(handle, (int64_t)length, (double *)d_array, 1, (double *)norm)); in CeedVectorNorm_Cuda()
573 *norm = sqrt(norm_sum); in CeedVectorNorm_Cuda()
[all …]
/libCEED/examples/solids/src/
H A Dcl-options.c88 …PetscScalar norm = sqrt(app_ctx->bc_clamp_max[i][3] * app_ctx->bc_clamp_max[i][3] + app_ctx->bc_cl… in ProcessCommandLineOptions() local
90 if (fabs(norm) < 1e-16) norm = 1; in ProcessCommandLineOptions()
91 for (PetscInt j = 0; j < 3; j++) app_ctx->bc_clamp_max[i][3 + j] /= norm; in ProcessCommandLineOptions()
/libCEED/backends/hip-ref/
H A Dceed-hip-ref-vector.c553 static int CeedVectorNorm_Hip(CeedVector vec, CeedNormType type, CeedScalar *norm) { in CeedVectorNorm_Hip() argument
583 *norm = 0.0; in CeedVectorNorm_Hip()
586 …eedCallHipblas(ceed, hipblasSasum_64(handle, (int64_t)length, (float *)d_array, 1, (float *)norm)); in CeedVectorNorm_Hip()
599 *norm += sub_norm; in CeedVectorNorm_Hip()
604 …dCallHipblas(ceed, hipblasDasum_64(handle, (int64_t)length, (double *)d_array, 1, (double *)norm)); in CeedVectorNorm_Hip()
617 *norm += sub_norm; in CeedVectorNorm_Hip()
626 …eedCallHipblas(ceed, hipblasSnrm2_64(handle, (int64_t)length, (float *)d_array, 1, (float *)norm)); in CeedVectorNorm_Hip()
641 *norm = sqrt(norm_sum); in CeedVectorNorm_Hip()
645 …dCallHipblas(ceed, hipblasDnrm2_64(handle, (int64_t)length, (double *)d_array, 1, (double *)norm)); in CeedVectorNorm_Hip()
660 *norm = sqrt(norm_sum); in CeedVectorNorm_Hip()
[all …]
/libCEED/interface/
H A Dceed-vector.c677 int CeedVectorNorm(CeedVector vec, CeedNormType norm_type, CeedScalar *norm) { in CeedVectorNorm() argument
687 *norm = 0; in CeedVectorNorm()
693 CeedCall(vec->Norm(vec, norm_type, norm)); in CeedVectorNorm()
701 *norm = 0.; in CeedVectorNorm()
705 *norm += fabs(array[i]); in CeedVectorNorm()
710 *norm += fabs(array[i]) * fabs(array[i]); in CeedVectorNorm()
716 *norm = *norm > abs_v_i ? *norm : abs_v_i; in CeedVectorNorm()
719 if (norm_type == CEED_NORM_2) *norm = sqrt(*norm); in CeedVectorNorm()
/libCEED/examples/python/
H A Dtutorial-1-vector.ipynb176 …infty}$ norms of a `libceed.Vector` (keeping in mind that these are local norm computations; not a…
194 "norm_1 = x.norm(normtype=libceed.NORM_1)\n",
197 "norm_2 = x.norm()\n",
200 "norm_max = x.norm(normtype=libceed.NORM_MAX)\n",
/libCEED/julia/LibCEED.jl/test/
H A Druntests.jl82 @test norm(v, p) ≈ norm(v1, p)
84 @test_throws Exception norm(v, 3)
/libCEED/backends/sycl-ref/
H A Dceed-sycl-vector.sycl.cpp449 static int CeedVectorNorm_Sycl(CeedVector vec, CeedNormType type, CeedScalar *norm) { in CeedVectorNorm_Sycl() argument
487 if (type == CEED_NORM_2) *norm = sqrt(*impl->reduction_norm); in CeedVectorNorm_Sycl()
488 else *norm = *impl->reduction_norm; in CeedVectorNorm_Sycl()
/libCEED/python/
H A Dceed_vector.py394 def norm(self, normtype=NORM_2): member in Vector
/libCEED/rust/libceed/src/
H A Dvector.rs613 pub fn norm(&self, ntype: crate::NormType) -> crate::Result<crate::Scalar> { in norm() method

12