
/*!
 * This file provides structure and function definitions for the Vector2 and
 * Matrix2x2 types, which are vector and matrix types with fixed dimensions.
 * The operations defined for these types compute outputs directly without the
 * use of loops. These types are useful for any algorithm that operates on
 * pairwise data.
 *
 * Since CUDA provides built-in vector types, Vector2 and Matrix2x2 are
 * defined in terms of these types. The following mapping is used to map
 * indices to xyzw:
 *
 *   ELEM(M, 0, 0) = M->x
 *   ELEM(M, 0, 1) = M->y
 *   ELEM(M, 1, 0) = M->z
 *   ELEM(M, 1, 1) = M->w
 */
typedef float2 Vector2;
typedef float4 Matrix2x2;



#define vectorInitZero(a) \
    (a)->x = 0; \
    (a)->y = 0;



#define vectorAdd(a, b) \
    (a)->x += (b)->x; \
    (a)->y += (b)->y;



#define vectorAddScaled(a, c, b) \
    (a)->x += (c) * (b)->x; \
    (a)->y += (c) * (b)->y;



#define vectorSubtract(a, b) \
    (a)->x -= (b)->x; \
    (a)->y -= (b)->y;



#define vectorScale(a, c) \
    (a)->x *= (c); \
    (a)->y *= (c);



#define vectorDot(a, b) \
    ((a)->x * (b)->x + (a)->y * (b)->y)



#define SQR(x) ((x)*(x))
#define vectorDiffNorm(a, b) \
    sqrt(SQR((a)->x - (b)->x) + SQR((a)->y - (b)->y))



#define matrixInitIdentity(M) \
    (M)->x = 1; \
    (M)->y = 0; \
    (M)->z = 0; \
    (M)->w = 1;



#define matrixInitZero(M) \
    (M)->x = 0; \
    (M)->y = 0; \
    (M)->z = 0; \
    (M)->w = 0;



#define matrixScale(A, c) \
    (A)->x *= (c); \
    (A)->y *= (c); \
    (A)->z *= (c); \
    (A)->w *= (c);



#define matrixInverse(A, B, det) \
    *det = (A)->x * (A)->w - (A)->y * (A)->z; \
    (B)->x = +(A)->w / (*det); \
    (B)->y = -(A)->y / (*det); \
    (B)->z = -(A)->z / (*det); \
    (B)->w = +(A)->x / (*det);



#define matrixProduct(A, x_, b) \
    (b)->x = (A)->x * (x_)->x + (A)->y * (x_)->y; \
    (b)->y = (A)->z * (x_)->x + (A)->w * (x_)->y;



#define matrixAddOuterProduct(A, c, x_) \
    (A)->x += (c) * (x_)->x * (x_)->x; \
    (A)->y += (c) * (x_)->x * (x_)->y; \
    (A)->z += (c) * (x_)->y * (x_)->x; \
    (A)->w += (c) * (x_)->y * (x_)->y;

	.file	"tmpxft_00374f50_00000000-6_linalg.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2010:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2010:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2033:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2033:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>

/*!
 * This file provides structure and function definitions for the Vector2 and
 * Matrix2x2 types, which are vector and matrix types with fixed dimensions.
 * The operations defined for these types compute outputs directly without the
 * use of loops. These types are useful for any algorithm that operates on
 * pairwise data.
 *
 * Since CUDA provides built-in vector types, Vector2 and Matrix2x2 are
 * defined in terms of these types. The following mapping is used to map
 * indices to xyzw:
 *
 *   ELEM(M, 0, 0) = M->x
 *   ELEM(M, 0, 1) = M->y
 *   ELEM(M, 1, 0) = M->z
 *   ELEM(M, 1, 1) = M->w
 */
typedef float2 Vector2;
typedef float4 Matrix2x2;



#define vectorInitZero(a) \
    (a)->x = 0; \
    (a)->y = 0;



#define vectorAdd(a, b) \
    (a)->x += (b)->x; \
    (a)->y += (b)->y;



#define vectorAddScaled(a, c, b) \
    (a)->x += (c) * (b)->x; \
    (a)->y += (c) * (b)->y;



#define vectorSubtract(a, b) \
    (a)->x -= (b)->x; \
    (a)->y -= (b)->y;



#define vectorScale(a, c) \
    (a)->x *= (c); \
    (a)->y *= (c);



#define vectorDot(a, b) \
    ((a)->x * (b)->x + (a)->y * (b)->y)



#define SQR(x) ((x)*(x))
#define vectorDiffNorm(a, b) \
    sqrt(SQR((a)->x - (b)->x) + SQR((a)->y - (b)->y))



#define matrixInitIdentity(M) \
    (M)->x = 1; \
    (M)->y = 0; \
    (M)->z = 0; \
    (M)->w = 1;



#define matrixInitZero(M) \
    (M)->x = 0; \
    (M)->y = 0; \
    (M)->z = 0; \
    (M)->w = 0;



#define matrixScale(A, c) \
    (A)->x *= (c); \
    (A)->y *= (c); \
    (A)->z *= (c); \
    (A)->w *= (c);



#define matrixInverse(A, B, det) \
    *det = (A)->x * (A)->w - (A)->y * (A)->z; \
    (B)->x = +(A)->w / (*det); \
    (B)->y = -(A)->y / (*det); \
    (B)->z = -(A)->z / (*det); \
    (B)->w = +(A)->x / (*det);



#define matrixProduct(A, x_, b) \
    (b)->x = (A)->x * (x_)->x + (A)->y * (x_)->y; \
    (b)->y = (A)->z * (x_)->x + (A)->w * (x_)->y;



#define matrixAddOuterProduct(A, c, x_) \
    (A)->x += (c) * (x_)->x * (x_)->x; \
    (A)->y += (c) * (x_)->x * (x_)->y; \
    (A)->z += (c) * (x_)->y * (x_)->x; \
    (A)->w += (c) * (x_)->y * (x_)->y;

	.text
	.file	"linalg.hip"
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_

	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
