Comments (5)
Hi @apple-phi it's just an omission really, not by design. I use double vectors less often than I do float vectors and I've dedicated less attention to them. They are meant to have the same interface, I just haven't had the time and people don't seem to be that interested in them either.
The complexity with double is that they have two implementations, one before AVX and the other with AVX. It takes time to implement and verify them. I can see that there are several basic functions that haven't been implemented yet as you say. Reference implementations for them can be found in hlsl++_vector_float, for example
inline n128 _hlslpp_sin_ps(n128 x)
{
static const n128 sin_c1 = f4_1;
static const n128 sin_c3 = _hlslpp_set1_ps(-1.6665578e-1f);
static const n128 sin_c5 = _hlslpp_set1_ps(8.3109378e-3f);
static const n128 sin_c7 = _hlslpp_set1_ps(-1.84477486e-4f);
// Range reduction (into [-pi, pi] range)
// Formula is x = x - round(x / 2pi) * 2pi
x = _hlslpp_subm_ps(x, _hlslpp_round_ps(_hlslpp_mul_ps(x, f4_inv2pi)), f4_2pi);
n128 gtpi2 = _hlslpp_cmpgt_ps(x, f4_pi2);
n128 ltminusPi2 = _hlslpp_cmplt_ps(x, f4_minusPi2);
n128 ox = x;
// Use identities/mirroring to remap into the range of the minimax polynomial
x = _hlslpp_sel_ps(x, _hlslpp_sub_ps(f4_pi, ox), gtpi2);
x = _hlslpp_sel_ps(x, _hlslpp_sub_ps(f4_minusPi, ox), ltminusPi2);
n128 x2 = _hlslpp_mul_ps(x, x);
n128 result;
result = _hlslpp_madd_ps(x2, sin_c7, sin_c5);
result = _hlslpp_madd_ps(x2, result, sin_c3);
result = _hlslpp_madd_ps(x2, result, sin_c1);
result = _hlslpp_mul_ps(result, x);
return result;
}
That can work as a starting point. If there's further interest and this would be useful to you, I can start slowly implementing and adding some of these to the double class.
from hlslpp.
@redorav Thanks for the reply! I'm pretty sure the only ones I'm missing that I need for my project is a cross product and normalisation. I'll probably just use a naive non-SIMD self-implementation for now but it would be great if you could add those into the library when you get the chance :)
from hlslpp.
@apple-phi I added normalization as it was simple to do, I'll see if I can find the time to add the cross product soon
from hlslpp.
@redorav Amazing, thank you! Lmk if you get round to doing the cross product :)
from hlslpp.
Implemented in 24c3168
from hlslpp.
Related Issues (20)
- Cast between types HOT 4
- Memory packing difference C++ <-> HLSL HOT 16
- Integer vector division is working incorrectly on Macs with Apple M1 (ARM) HOT 7
- Integer vector comparison is working incorrectly on Intel based Macs with MacOS >= 11 HOT 3
- Improve HLSL++ unit tests by using full-featured testing framework HOT 2
- Matrix accessor operator HOT 6
- operator / (float1, float3) looks inverted HOT 8
- How well does this cover HLSL202x? HOT 11
- * operator brake mult function in quaternion HOT 7
- Quaternion slerp returning nan values HOT 2
- Clang error: unused variable 't4' in hlsl++_quaternion.h HOT 6
- Upgrade warnings to errors HOT 2
- round() on ARM Neon uses wrong rounding mode HOT 2
- mul() intrinsic is missing some overloads. HOT 2
- clamp() intrinsic is missing overloads for intN HOT 1
- Some non square matrix definitions are incorrect HOT 6
- Missing matrix constructors HOT 2
- Undefined behavior when accessing vector elements with operator[] HOT 10
- internal::round_float gives incorrect results HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hlslpp.