Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some documentation formatting #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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: 0 additions & 2 deletions crates/wgebra/src/geometry/quat.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// In here

#define_import_path wgebra::quat

/// A unit quaternion representing a rotation.
Expand Down
18 changes: 10 additions & 8 deletions crates/wgebra/src/geometry/svd3.wgsl
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// This is a WGSL port of https://github.com/wi-re/tbtSVD/blob/master/source/SVD.h

// which is an implementation of "Computing the Singular Value Decomposition of 3x3 matrices with minimal branching and
// elementary floating point operations" from http://pages.cs.wisc.edu/~sifakis/project_pages/svd.html
//! This is a WGSL port of [wi-re/tbtSVD/SVD.h](https://github.com/wi-re/tbtSVD/blob/master/source/SVD.h)
//!
//! Which is implementation of "Computing the Singular Value Decomposition of 3x3 matrices with minimal branching and
//! elementary floating point operations" from [http://pages.cs.wisc.edu/~sifakis/project_pages/svd.html](http://pages.cs.wisc.edu/~sifakis/project_pages/svd.html)
//!
//! Multiple lines!

#define_import_path wgebra::svd3
#import wgebra::quat as Quat
Expand Down Expand Up @@ -117,7 +119,7 @@ fn approximateGivensQuaternion(A: ptr<function, Symmetric3x3>) -> givens {
let g = givens(2.f * ((*A).mxx - (*A).myy), (*A).myx);
var b = GAMMA * g.sh * g.sh < g.ch * g.ch;
let w = rsqrt(fma(g.ch, g.ch, g.sh * g.sh));
if (w != w) {
if w != w {
b = false;
}

Expand All @@ -131,7 +133,7 @@ fn approximateGivensQuaternion(A: ptr<function, Symmetric3x3>) -> givens {
// Function used to apply a givens rotation S. Calculates the weights and updates the quaternion to contain the cumultative rotation
fn jacobiConjugation(x: i32, y: i32, z: i32, S: ptr<function, Symmetric3x3>, q: ptr<function, Quat::Quat>) {
var g = approximateGivensQuaternion(S);
let scale = 1.f / fma(g.ch, g.ch, g.sh * g.sh);
let scale = 1.f / fma(g.ch, g.ch, g.sh * g.sh);
let a = fma(g.ch, g.ch, -g.sh * g.sh) * scale;
let b = 2.f * g.sh * g.ch * scale;
var _S = (*S);
Expand All @@ -146,7 +148,7 @@ fn jacobiConjugation(x: i32, y: i32, z: i32, S: ptr<function, Symmetric3x3>, q:
var tmp = array<f32, 3>( // TODO: why does it have to be `var` instead of `let` so we can index with z?
(*q).coords[0] * g.sh,
(*q).coords[1] * g.sh,
(*q).coords[2] * g.sh,
(*q).coords[2] * g.sh
);
g.sh *= (*q).coords[3];
// (x,y,z) corresponds to ((0,1,2),(1,2,0),(2,0,1)) for (p,q) = ((0,1),(1,2),(0,2))
Expand Down Expand Up @@ -269,7 +271,7 @@ fn QRDecomposition(in_B: mat3x3<f32>) -> QR {

let q10 = -2.f * g1.ch * g1.sh * sh22;
let q11 = fma(-8.f * g1.ch * g2.ch * g3.ch, g1.sh * g2.sh * g3.sh, sh12 * sh32);
let q12 = fma(-2.f * g3.ch, g3.sh, 4.f * g1.sh * fma(g3.ch * g1.sh, g3.sh, g1.ch * g2.ch*g2.sh*sh32));
let q12 = fma(-2.f * g3.ch, g3.sh, 4.f * g1.sh * fma(g3.ch * g1.sh, g3.sh, g1.ch * g2.ch * g2.sh * sh32));

let q20 = 2.f * g2.ch * g2.sh;
let q21 = -2.f * g3.ch * sh22 * g3.sh;
Expand Down
3 changes: 0 additions & 3 deletions crates/wgebra/src/linalg/shape.wgsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// Module comment
// And a second line

#define_import_path wgblas::shape

// The shape of a (column-major) matrix.
Expand Down